16 #ifndef DABC_Application
17 #define DABC_Application
83 static const char*
stHalted() {
return "Halted"; }
84 static const char*
stReady() {
return "Ready"; }
85 static const char*
stRunning() {
return "Running"; }
86 static const char*
stFailure() {
return "Failure"; }
186 {
return Execute(
"StartAllModules"); }
189 {
return Execute(
"StopAllModules"); }
196 bool AddObject(
const std::string &kind,
const std::string &name);
#define DABC_REFERENCE(RefClass, ParentClass, T)
Reference on dabc::Application class
bool AddObject(const std::string &kind, const std::string &name)
Adds object into application list List used when objects must be destroyed or application start/stop ...
bool ChangeState(const std::string &state)
Base class for user-specific applications.
virtual int DoTransition(const std::string &state, Command cmd)
Do action, required to make transition into specified state.
virtual int ExecuteCommand(Command cmd)
Main method where commands are executed.
virtual bool IsModulesRunning()
Return true if all application-relevant modules are running.
static const char * stcmdDoHalt()
void * ExternalFunction()
virtual bool Find(ConfigIO &cfg)
Method to locate object in xml file.
virtual void OnThreadAssigned()
Method called at thread assignment - application may switch into running state.
bool fAnyModuleWasRunning
indicate when any module was running, than once can automatically stop application
static const char * StateParName()
static const char * stcmdDoStop()
virtual int SMCommandTimeout() const
Default state machine command timeout.
static const char * stFailure()
void SetInitFunc(ExternalFunction *initfunc)
Set external function, which creates all necessary components of the application.
virtual void BuildFieldsMap(RecordFieldsMap *cont)
Fill fields map, which is relevant for the object Objects hierarchy produced from dabc::Manager.
void SetAppState(const std::string &name)
Directly changes value of the state parameter.
std::string GetState() const
Application(const char *classname=0)
static const char * stHalted()
bool fSelfControl
when true, application itself decide when stop main loop
static const char * stReady()
virtual bool StartModules()
Start all application modules.
virtual double ProcessTimeout(double)
Timeout used by application to control stop state of modules and brake application.
static const char * stTransition()
static const char * stRunning()
virtual bool ReplyCommand(Command cmd)
Reimplement this method to react on command reply Return true if command can be destroyed by framewor...
virtual bool CreateAppModules()
Create application modules.
virtual bool CleanupApplication()
Delete all components created in application, excluding state parameter.
std::vector< std::string > fAppDevices
list of devices, created by application
std::vector< std::string > fAppPools
list of pools, created by application
virtual const char * ClassName() const
Returns class name of the object instance.
ExternalFunction * fInitFunc
double fConnTimeout
time for connecting all modules, default 5s
static const char * stcmdDoConfigure()
int CallInitFunc(Command statecmd, const std::string &tgtstate)
virtual bool StopModules()
Stop all application modules.
virtual void ObjectCleanup()
Cleanup application.
std::vector< std::string > fAppModules
list of modules, created by application
static const char * stcmdDoStart()
CmdStateTransition(const std::string &state)
DABC_COMMAND(CmdStateTransition, "CmdStateTransition")
Represents command with its arguments.
bool SetStr(const std::string &name, const char *value)
Interface class between xml configuration and dabc objects.
Manager of everything in DABC
RecordField Value() const
Returns parameter value.
std::string AsStr(const std::string &dflt="") const
Reference on dabc::Worker
bool Execute(Command cmd, double tmout=-1.)
Active object, which is working inside dabc::Thread.
Parameter Par(const std::string &name) const
Returns reference on worker parameter object.