本文整理汇总了C++中Action::Execute方法的典型用法代码示例。如果您正苦于以下问题:C++ Action::Execute方法的具体用法?C++ Action::Execute怎么用?C++ Action::Execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Action
的用法示例。
在下文中一共展示了Action::Execute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TakeAction
/**
* Lookup the action for a value, and if we find one, execute it. Otherwise
* execute the default action if there is one.
* @param context the Context to use
* @param value the value to look up.
*/
void Slot::TakeAction(Context *context,
uint8_t value) {
if (m_old_value_defined && value == m_old_value)
// nothing to do
return;
// set the context correctly
if (context) {
context->SetSlotOffset(m_slot_offset + 1);
context->SetSlotValue(value);
}
bool rising = true;
if (m_old_value_defined)
rising = value > m_old_value;
Action *action = LocateMatchingAction(value, rising);
if (action) {
action->Execute(context, value);
} else {
if (rising && m_default_rising_action)
m_default_rising_action->Execute(context, value);
else if (!rising && m_default_falling_action)
m_default_falling_action->Execute(context, value);
}
m_old_value_defined = true;
m_old_value = value;
}
示例2: Build
int CompilationGraph::Build (const sys::Path& TempDir,
const LanguageMap& LangMap) {
InputLanguagesSet InLangs;
bool WasSomeActionGenerated = !InputFilenames.empty();
// Traverse initial parts of the toolchains and fill in InLangs.
if (int ret = BuildInitial(InLangs, TempDir, LangMap))
return ret;
std::vector<const Node*> JTV;
if (int ret = TopologicalSortFilterJoinNodes(JTV))
return ret;
// For all join nodes in topological order:
for (std::vector<const Node*>::iterator B = JTV.begin(), E = JTV.end();
B != E; ++B) {
const Node* CurNode = *B;
JoinTool* JT = &static_cast<JoinTool&>(*CurNode->ToolPtr.getPtr());
// Are there any files in the join list?
if (JT->JoinListEmpty() && !(JT->WorksOnEmpty() && InputFilenames.empty()))
continue;
WasSomeActionGenerated = true;
Action CurAction;
if (int ret = JT->GenerateAction(CurAction, CurNode->HasChildren(),
TempDir, InLangs, LangMap)) {
return ret;
}
if (int ret = CurAction.Execute())
return ret;
if (CurAction.StopCompilation())
return 0;
const Edge* Edg = ChooseEdge(CurNode->OutEdges, InLangs, CurNode->Name());
if (Edg == 0)
return 1;
const Node* NextNode = getNode(Edg->ToolName());
if (NextNode == 0)
return 1;
if (int ret = PassThroughGraph(sys::Path(CurAction.OutFile()), NextNode,
InLangs, TempDir, LangMap)) {
return ret;
}
}
if (!WasSomeActionGenerated) {
PrintError("no input files");
return 1;
}
return 0;
}
示例3: update
EBTStatus ActionTask::update(Agent* pAgent, EBTStatus childStatus)
{
BEHAVIAC_UNUSED_VAR(pAgent);
BEHAVIAC_UNUSED_VAR(childStatus);
BEHAVIAC_ASSERT(Action::DynamicCast(this->GetNode()));
Action* pActionNode = (Action*)(this->GetNode());
EBTStatus result = pActionNode->Execute(pAgent, childStatus);
return result;
}
示例4: update
EBTStatus PlannerTaskAction::update(Agent* pAgent, EBTStatus childStatus)
{
BEHAVIAC_UNUSED_VAR(pAgent);
BEHAVIAC_UNUSED_VAR(childStatus);
BEHAVIAC_ASSERT(Action::DynamicCast(this->m_node) != 0);
Action* action = (Action*)this->m_node;
//this->m_status = action.Execute(pAgent, this->ParamsValue);
this->m_status = action->Execute(pAgent, childStatus);
return this->m_status;
}
示例5: PassThroughGraph
// Pass input file through the chain until we bump into a Join node or
// a node that says that it is the last.
int CompilationGraph::PassThroughGraph (const sys::Path& InFile,
const Node* StartNode,
const InputLanguagesSet& InLangs,
const sys::Path& TempDir,
const LanguageMap& LangMap) const {
sys::Path In = InFile;
const Node* CurNode = StartNode;
while(true) {
Tool* CurTool = CurNode->ToolPtr.getPtr();
if (CurTool->IsJoin()) {
JoinTool& JT = static_cast<JoinTool&>(*CurTool);
JT.AddToJoinList(In);
break;
}
Action CurAction;
if (int ret = CurTool->GenerateAction(CurAction, In, CurNode->HasChildren(),
TempDir, InLangs, LangMap)) {
return ret;
}
if (int ret = CurAction.Execute())
return ret;
if (CurAction.StopCompilation())
return 0;
const Edge* Edg = ChooseEdge(CurNode->OutEdges, InLangs, CurNode->Name());
if (Edg == 0)
return 1;
CurNode = getNode(Edg->ToolName());
if (CurNode == 0)
return 1;
In = CurAction.OutFile();
}
return 0;
}
示例6: readCommandsFile
// ------------------------------------readCommandsFile--------------------------------------
// Description: reads from .txt file and creates actions
// ------------------------------------------------------------------------------------------
void Store::readCommandsFile()
{
const string commandsFileName = "data4commands.txt";
fstream infile(commandsFileName, ios_base::in);
if (infile.fail())
{
cerr << "Can't find commands file: " << commandsFileName << endl;
return;
}
while(!infile.eof())
{
Action *action = ActionFactory::Create(infile, this);
if (action)
{
action->Execute(this);
}
}
}
示例7: ExecuteAction
////////////////////////////////////////////////////////////////////////////////////
//Creates an action and executes it
void ApplicationManager::ExecuteAction(ActionType ActType)
{
Action* pAct = NULL;
//According to ActioType, create the corresponding action object
switch (ActType)
{
case ADD_SMPL_ASSIGN:
pAct = new AddSmplAssign(this);
break;
case ADD_END:
///create AddCondition Action here
break;
case ADD_SELECT:
///create Select Action her
pAct = new Select(this);
break;
// case Move:
// pAct = new Move(this);
//break;
case DEL:
///create Exit Action here
pAct = new Delete(this);
break;
case STATUS:
return;
}
//Execute the created action
if(pAct != NULL)
{
pAct->Execute();//Execute
delete pAct; //Action is not needed any more ==> delete it
}
}
示例8: Execute
void EditConnector::Execute()
{
Output *pOut = pManager->GetOutput();
if (pManager->ZM)
{
pOut->MsgBox("You can't Edit Connectors in zoom mode !!", "Error", true);
return;
}
if (pManager->ConnSelectedCount > 0)
{
int toBeEdited = pManager->ConnSelectedCount;
Action* DeleteConnAct = new Delete(pManager);
DeleteConnAct->Execute();
for (int i = 0; i < pManager->StatCount; i++)
{
pManager->StatList[i]->SetSelected(false);
}
pManager->EmptySelectedList();
pManager->UpdateInterface();
pOut->ClearStatusBar();
for (int i = 0; i < toBeEdited; ++i)
{
pManager->UpdateInterface();
Point SrcP, DstP;
Statement *SrcS, *DstS;
while (1)
{
pOut->PrintMessage("Select new source for Selected connector " + to_string(i + 1) + ": ");
pManager->pIn->GetPointClicked(SrcP);
SrcS = pManager->GetStatement(SrcP);
if (SrcS)
{
SrcS->SetSelected(true);
pManager->AddSelected(SrcS);
}
pManager->UpdateInterface();
pOut->PrintMessage("Select new destination for Selected connector " + to_string(i + 1) + ": ");
pManager->pIn->GetPointClicked(DstP);
DstS = pManager->GetStatement(DstP);
if (DstS)
{
DstS->SetSelected(true);
pManager->AddSelected(DstS);
}
pManager->UpdateInterface();
if (SrcS && DstS && SrcS != DstS && !SrcS->hasConn() && !dynamic_cast<End*>(SrcS) && !dynamic_cast<Start*>(DstS))
{
break;
}
else
{
if (SrcS)
{
SrcS->SetSelected(false);
pManager->RemoveSelected(SrcS);
}
if (DstS)
{
DstS->SetSelected(false);
pManager->RemoveSelected(DstS);
}
pManager->EmptySelectedList();
pManager->UpdateInterface();
pOut->MsgBox("Invalid source or destination !! Click ok to Re-select", "Error", true);
}
}
Action* AddConnAct = new AddConnector(pManager);
AddConnAct->Execute();
delete AddConnAct;
}
DeleteConnAct = new Delete(pManager);
DeleteConnAct->Execute();
delete DeleteConnAct;
pOut->PrintMessage("Edited Successfully !");
}
else
pOut->MsgBox("You Should select the connector(s) first then click on the action", "Info", false);
}
示例9: ExecuteAction
void ApplicationManager::ExecuteAction(ActionType Act)
{
Action* dummyAction = NULL;
switch (Act)
{
case ADD:
dummyAction = new Add(this);
break;
case ADD_CONNECTION:
dummyAction = new AddConnection(this);
break;
case ADD_LABEL:
MainInterface.PrintMsg("Add Label");
break;
case EDIT_LABEL:
MainInterface.PrintMsg("Edit Label");
break;
case CREATE_TRUTHTABLE:
MainInterface.PrintMsg("Create TruthTable");
break;
case ACTIVE_BAR_CLICK:
dummyAction = new HandleActiveBar(this);
break;
case CANVAS_LEFT_CLICK:
dummyAction = new HandleLeftClick(this);
break;
case CANVAS_RIGHT_CLICK:
break;
case MULTI_SELECT:
break;
case DELETE:
dummyAction = new Delete(this);
break;
case DRAG:
dummyAction = new Drag(this);
break;
case COPY:
dummyAction = new Copy(this);
break;
case CUT:
dummyAction = new Cut(this);
break;
case PASTE:
dummyAction = new Paste(this);
break;
case SAVE:
MainInterface.PrintMsg("Save");
break;
case LOAD:
MainInterface.PrintMsg("Load");
break;
case UNDO:
MainInterface.PrintMsg("Undo");
break;
case REDO:
MainInterface.PrintMsg("Redo");
break;
case SWITCH_MODE:
MainInterface.SwitchAppMode();
MainInterface.PrintMsg("Switching Mode");
break;
case SWITCH_THEME:
MainInterface.SwitchAppTheme();
MainInterface.PrintMsg("Switching Theme");
break;
case ADJUST_OFFSET:
dummyAction = new AdjustOffset(this);
break;
case ZOOM_IN:
dummyAction = new ZoomIn(this);
break;
case ZOOM_OUT:
dummyAction = new ZoomOut(this);
break;
case EXIT:
exit(0);
break;
case STATUS_BAR:
break;
case NONE:
break;
default:
dummyAction = new AddComponent(this, Act);
}
if(dummyAction != NULL)
{
dummyAction->Execute();
delete dummyAction;
}
}
示例10: Execute
void Load::Execute()
{
Output *pOut = pManager->GetOutput();
if (pManager->StatCount>0)
{
pOut->MsgBox("You Should delete any existing statements before loading a new flowchart !!", "Error", true);
return;
}
ifstream In;
In.open("Out.txt");
if (!In.good())
{
pOut->MsgBox("File couldn't be Loaded !!", "Error", true);
return;
}
int N1;
In >> N1;
string ST;
for (int i = 0; i <N1; i++)
{
In >> ST;
if (ST=="START")
{
Start* pT = new Start;
pT->Load(In, pOut);
pManager->AddStatement(pT,true);
}
else if (ST=="END")
{
End* pT = new End;
pT->Load(In,pOut);
pManager->AddStatement(pT, true);
}
else if (ST == "ASSIGN")
{
Assign* pT = new Assign;
pT->Load(In, pOut);
pManager->AddStatement(pT, true);
}
else if (ST == "COND")
{
Cond* pT = new Cond;
pT->Load(In, pOut);
pManager->AddStatement(pT, true);
}
else if (ST == "WRITE")
{
Write* pT = new Write;
pT->Load(In, pOut);
pManager->AddStatement(pT, true);
}
else if (ST == "READ")
{
Read* pT = new Read;
pT->Load(In, pOut);
pManager->AddStatement(pT, true);
}
}
int N2;
In >> N2;
for (int i = 0; i < N2; i++)
{
int s, d,t;
In >> s >> d>>t;
Statement *S, *D; S = D = NULL;
Point p1, p2;
for (int j = 0; j < pManager->StatCount; j++)
{
if (s == pManager->StatList[j]->getID())
{
S = pManager->StatList[j];
p1 = pManager->StatList[j]->getOutlet();
}
if (d == pManager->StatList[j]->getID())
{
D = pManager->StatList[j];
p2 = pManager->StatList[j]->getInlet();
}
if (S && D)
//.........这里部分代码省略.........