48 #ifndef _MIRA_FRAMEWORK_H_ 49 #define _MIRA_FRAMEWORK_H_ 51 #include <serialization/adapters/std/list> 52 #include <serialization/adapters/std/map> 53 #include <serialization/adapters/boost/shared_ptr.hpp> 73 #define MIRA_FW mira::Framework::instance() 83 class FrameworkTransformer;
102 FrameworkStartup(
int argc,
char** argv);
103 FrameworkStartup(
const std::vector<std::string>& args);
108 ProgramOptions mOptions;
109 typedef std::vector<std::string> CommandLineStrings;
110 CommandLineStrings mCommandLineVariables;
111 CommandLineStrings mCommandLineKnownFrameworks;
116 class FrameworkAuthority :
public Authority 119 FrameworkAuthority(Framework* framework,
const ResourceName& ns,
121 :
Authority(ns, name, flags), mFramework(framework)
125 boost::shared_ptr<PropertyNode> getProperties();
128 Framework* mFramework;
161 Framework(
int argc,
char** argv,
bool startImmediately =
false);
168 Framework(
const std::vector<std::string>& args,
bool startImmediately =
false);
173 template<
typename Reflector>
179 r.property(
"RemoteModule", mRemoteModule,
"The remote module", boost::shared_ptr<RemoteModule>());
181 r.method(
"getUptime", &
Framework::getUptime,
this,
"Get the time since the framework was started");
184 "Terminate framework (and thus, the process). Use with care!",
185 "exitcode",
"the exitcode returned by the process", 0u);
187 r.interface(
"IVariableRegistry");
191 r.interface(
"ILibraryRegistry");
192 r.method(
"getLibraries",
195 r.method(
"getLoadedLibraries",
198 for (
auto it = reg.begin(); it != reg.end(); ) {
199 if (it->second.mIsLoaded)
202 auto succ = it; ++succ;
209 "Query only loaded libraries");
211 r.interface(
"IConfigurationLoader");
212 r.method(
"loadConfig",
213 boost::function<
void(
const XMLDom&)>(
214 [&](
const XMLDom& xml) { this->load(const_cast<XMLDom&>(xml)); } ),
215 "Load a configuration",
216 "xml",
"XML document",
XMLDom());
241 void load(
const std::string& configFile);
286 virtual void requestTermination(
int exitcode=0);
291 virtual bool isTerminationRequested()
const;
298 int getTerminationExitCode()
const;
325 boost::shared_ptr<FrameworkTransformer>
getTransformer() {
return mTransformer; }
349 std::string
getID()
const {
return mAuthority->getID(); }
355 std::string
getGlobalID()
const {
return mAuthority->getGlobalID(); }
379 friend class Private::FrameworkStartup;
385 static void errorHandler(
const IntSignal& sig);
386 static bool enterLeaveErrorHandler(
bool enter);
435 #include <fw/impl/Authority.hpp> 436 #include <fw/impl/ConcreteChannel.hpp> Authority class that is used to access the functionality of the framework.
XMLDom mConfigDom
Definition: Framework.h:425
void reflect(Reflector &r)
Reflect method for serialization.
Definition: Framework.h:174
A STL conform wrapper for libxml2 to read XML files as DOM.
Definition: XMLDom.h:73
Typedefs for OS independent basic data types.
std::string mName
Definition: Framework.h:422
boost::shared_ptr< ErrorService > getErrorService()
Returns the pointer to the persistent error service.
Definition: Framework.h:337
Manager class for all framework channels.
std::string getGlobalID() const
Return the fully qualified global id of this framework (includes namespace)
Definition: Framework.h:355
Normally authorities must have a unique name.
Definition: Authority.h:104
Manager class for all authorities in a framework.
ConfigurationLoader & getConfigurationLoader()
Returns the reference to the configuration file loader.
Definition: Framework.h:328
bool mInExec
Definition: Framework.h:393
boost::shared_ptr< FrameworkTransformer > getTransformer()
Returns the pointer to the transform framework.
Definition: Framework.h:325
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Only for backward compatibility.
Stores aliases for namespaces and allows to resolve local names to global fully qualified names...
Definition: NameRegistry.h:66
Grants thread-safe access to an object (the Protectee) that should be protected from concurrent acces...
Definition: ScopedAccess.h:119
boost::shared_ptr< ErrorService > mErrorServiceModule
Definition: Framework.h:421
int mTerminationExitCode
Definition: Framework.h:391
ConfigurationLoader mConfigurationLoader
Definition: Framework.h:419
Structure used in signal handlers to pass the signal and callstack.
Definition: SignalHandler.h:67
uint8 VersionType
Definition: ReflectorInterface.h:72
std::string getID() const
Returns the ID of this framework.
Definition: Framework.h:349
bool mTerminationRequested
Definition: Framework.h:390
Wrapper class for boost::posix_time::ptime for adding more functionality to it.
Definition: Time.h:416
RootPropertyNode mPropertiesRoot
Definition: Framework.h:400
class MIRA_FRAMEWORK_EXPORT Authority
forward declaration
Definition: RemoteConnection.h:74
Configuration loader for loading XML application configuration files.
bool isInExec() const
Definition: Framework.h:375
Duration getUptime() const
Return duration since started.
Definition: Framework.h:266
std::map< std::string, LibraryInfo > Register
Definition: LibraryRegistry.h:119
Registry for shared libraries.
AuthorityManager mAuthorityManager
Definition: Framework.h:414
bool isStarted() const
Return true if framework is started.
Definition: Framework.h:258
bool mRemoteDisabled
Definition: Framework.h:394
ProtecteeMixin< MetaTypeDatabase > ProtecteeDatabase
Definition: Framework.h:365
ChannelManager mChannelManager
Definition: Framework.h:412
Resolving names of channels and authorities in namespaces.
boost::shared_ptr< RemoteModule > mRemoteModule
Definition: Framework.h:405
bool mIsStarted
Definition: Framework.h:392
#define MIRA_FRAMEWORK_EXPORT
Definition: FrameworkExports.h:61
A singleton class that can be freely configured using policies that control the creation, instantiation, lifetime and thread-safety.
Use this class to represent time durations.
Definition: Time.h:104
This class represents the core element of a modular application.
Definition: Framework.h:149
A special node that acts only as (empty) root node for a property tree.
Definition: PropertyNode.h:448
std::map< std::string, XMLVariableValue > XMLVariablesMap
Definition: XMLDomPreprocessor.h:91
ProtecteeDatabase mMetaDatabase
Definition: Framework.h:426
ScopedAccess< ProtecteeDatabase > getMetaDatabase()
Return the meta database that contains all known meta information in this framework.
Definition: Framework.h:370
RPCManager & getRPCManager()
Returns the reference to the manager singleton for registered RPC services.
Definition: Framework.h:334
virtual void requestTermination(int exitcode=0)
Requests the termination of the framework and hence the whole application.
boost::shared_ptr< UnitManager > mUnitManager
Definition: Framework.h:417
Provided for convenience.
Definition: Singleton.h:580
boost::shared_ptr< PropertyNode > getProperties()
Definition: Framework.h:221
boost::shared_ptr< FrameworkTransformer > mTransformer
Definition: Framework.h:415
boost::shared_ptr< Private::FrameworkAuthority > mAuthority
Definition: Framework.h:398
Framework channel classes.
NameRegistry & getNameRegistry()
Returns the reference to the name registry.
Definition: Framework.h:316
AuthorityManager & getAuthorityManager()
Returns the reference to the manager singleton for registered authorities.
Definition: Framework.h:319
ChannelManager & getChannelManager()
Returns the reference to the manager singleton for channels.
Definition: Framework.h:322
XMLDomPreprocessor & getXMLDomPreprocessor()
Definition: Framework.h:363
Central instance that stores all created Authorities.
Definition: AuthorityManager.h:130
Preprocesses XML documents and resolves all special tags like , <if>, <warning> and so on...
Definition: XMLDomPreprocessor.h:106
Time mStartTime
Definition: Framework.h:428
boost::shared_ptr< RemoteModule > getRemoteModule()
Returns the pointer to the remote module.
Definition: Framework.h:340
Class for accessing command line parameters.
Contains internal RPCManager class.
XMLVariablesMap & getVariables()
Returns the list of variables that are registered via command line or config file.
Definition: Framework.h:361
static Time now() static Time eternity()
Returns the current utc based time.
Definition: Time.h:479
NameRegistry mNames
Definition: Framework.h:404
boost::shared_ptr< UnitManager > getUnitManager()
Returns the reference to the unit manager.
Definition: Framework.h:331
An exception that occurred whenever a channel does not exist.
Definition: ChannelManager.h:75
Grants thread-safe access to an object that should be protected from concurrent access.
XMLDomPreprocessor mXMLPreprocessor
Definition: Framework.h:424
boost::shared_ptr< PropertyNode > mProperties
Definition: Framework.h:401
This class is for internal use only.
Definition: RPCManager.h:96
Class for loading, parsing, modifying and interpreting application configuration files.
Definition: Loader.h:181
static Register getRegister()
Get access to library register.
Definition: LibraryRegistry.h:145
RPCManager mRPCManager
Definition: Framework.h:411
Contains non-intrusive reflects for XMLDom documents.