void main(int argc, const char *argv[]) { if (ParseArgv(argc, argv)) exit(1); if (Options.printUsage) PrintUsage(argv[0]); else StartModel(); exit(0); }
ccsCOMPL_STAT wsf2ex1APPLICATION::Init(int argCount, char *arg[]) { wsf2libLOG_TRACE(); ErrReset(); // Turn off logging of warning on EXIT command evhTASK::LogExitWarning(FALSE); // Parses the command line arguments // and extract the configuration parameters // for ENV NAME, DB POINT and PROC NAME from the // command line or from the enviroment variables if (EvaluateArgs(argCount, arg, wsf2ex1DB_ROOT_POINT) == FAILURE) { errAdd(wsf2ex1MOD, wsf2ex1ERR_INIT, __FILE_LINE__, "wrong argument(s)"); return FAILURE; } // Initialize CCS and connect to database if(InitCCS() == FAILURE) { errAdd(wsf2ex1MOD, wsf2ex1ERR_INIT, __FILE_LINE__, "cannot init CCS"); return FAILURE; } // Logs current startup configuration eccsLOG_1(("%s - Application started (proc name: %s, DB root point: %s)", GetProcName(), GetProcName(), GetDbRoot())); logData(wsf2ex1MOD,"%s - Application started (proc name: %s, DB root point: %s)", GetProcName(), GetProcName(), GetDbRoot()); /* * Create factory for ACTIONS, DATA, CONFIG and CONTROL */ wsf2libASSERT(mActionMgr == NULL); mActionMgr = new wsf2ex1ACTION_MGR(GetDbRoot(), argCount, arg, GetEventMgr()); if (mActionMgr == NULL) { errAdd(wsf2ex1MOD, wsf2ex1ERR_FATAL, __FILE_LINE__, "no memory for allocating wsf2ex1ACTION_MGR"); return FAILURE; } if (wsf2libHELPER::ObjectOk(mActionMgr, "ACTION_MGR") == ccsFALSE) { errAdd(wsf2ex1MOD, wsf2ex1ERR_CREATE, __FILE_LINE__, "wsf2ex1ACTION_MGR"); return FAILURE; } /* * Set FSM context * TBD: rename method */ SetControl(mActionMgr->GetControl()); /* * Instantiate events and actions */ if (CreateEvents(wsf2ex1EVENTS_FILENAME) == FAILURE) { errAdd(wsf2ex1MOD, wsf2ex1ERR_CREATE, __FILE_LINE__, "Events"); return FAILURE; } if (mActionMgr->CreateActions() == FAILURE) { errAdd(wsf2ex1MOD, wsf2ex1ERR_CREATE, __FILE_LINE__, "Actions"); return FAILURE; } /* * Load SCXML Model */ if (LoadModel(wsf2ex1MODEL_FILENAME, mActionMgr->SCXMLGetActions(), mActionMgr->SCXMLGetActivities()) == FAILURE) { errAdd(wsf2ex1MOD, wsf2ex1ERR_FATAL, __FILE_LINE__, "cannot load SCXML model"); return FAILURE; } /* * Initialize all events and actions and data structures */ if (mActionMgr->Init() == FAILURE) { errAdd(wsf2ex1MOD, wsf2ex1ERR_FATAL, __FILE_LINE__, "initializing actions and data structures"); return FAILURE; } /* * Start the execution of SCXML model */ if (StartModel() == FAILURE) { errAdd(wsf2ex1MOD, wsf2ex1ERR_FATAL, __FILE_LINE__, "cannot start SCXML model execution"); return FAILURE; } return SUCCESS; }
void Visualizer::start() { emit StartModel(); }