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> 74 #define MIRA_FW mira::Framework::instance() 84 class FrameworkTransformer;
103 FrameworkStartup(
int argc,
char** argv);
104 FrameworkStartup(
const std::vector<std::string>& args);
109 ProgramOptions mOptions;
110 typedef std::vector<std::string> CommandLineStrings;
111 CommandLineStrings mCommandLineVariables;
112 CommandLineStrings mCommandLineKnownFrameworks;
117 class FrameworkAuthority :
public Authority 120 FrameworkAuthority(Framework* framework,
const ResourceName& ns,
122 :
Authority(ns, name, flags), mFramework(framework)
126 boost::shared_ptr<PropertyNode> getProperties();
129 Framework* mFramework;
162 Framework(
int argc,
char** argv,
bool startImmediately =
false);
169 Framework(
const std::vector<std::string>& args,
bool startImmediately =
false);
174 template<
typename Reflector>
180 r.property(
"RemoteModule", mRemoteModule,
"The remote module", boost::shared_ptr<RemoteModule>());
182 r.method(
"getUptime", &
Framework::getUptime,
this,
"Get the time since the framework was started");
185 "Terminate framework (and thus, the process). Use with care!",
186 "exitcode",
"the exitcode returned by the process", 0u);
188 r.interface(
"IVariableRegistry");
192 r.interface(
"ILibraryRegistry");
193 r.method(
"getLibraries",
196 r.method(
"getLoadedLibraries",
199 for (
auto it = reg.begin(); it != reg.end(); ) {
200 if (it->second.mIsLoaded)
203 auto succ = it; ++succ;
210 "Query only loaded libraries");
212 r.interface(
"IConfigurationLoader");
213 r.method(
"loadConfig",
214 boost::function<
void(
const XMLDom&)>(
215 [&](
const XMLDom& xml) { this->load(const_cast<XMLDom&>(xml)); } ),
216 "Load a configuration",
217 "xml",
"XML document",
XMLDom());
219 r.interface(
"IThreadMonitor");
220 r.method(
"getThreadInformation",
223 "Query thread information");
248 void load(
const std::string& configFile);
293 virtual void requestTermination(
int exitcode=0);
298 virtual bool isTerminationRequested()
const;
305 int getTerminationExitCode()
const;
332 boost::shared_ptr<FrameworkTransformer>
getTransformer() {
return mTransformer; }
356 std::string
getID()
const {
return mAuthority->getID(); }
362 std::string
getGlobalID()
const {
return mAuthority->getGlobalID(); }
386 friend class Private::FrameworkStartup;
392 static void errorHandler(
const IntSignal& sig);
393 static bool enterLeaveErrorHandler(
bool enter);
442 #include <fw/impl/Authority.hpp> 443 #include <fw/impl/ConcreteChannel.hpp> Authority class that is used to access the functionality of the framework.
XMLDom mConfigDom
Definition: Framework.h:432
void reflect(Reflector &r)
Reflect method for serialization.
Definition: Framework.h:175
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:429
boost::shared_ptr< ErrorService > getErrorService()
Returns the pointer to the persistent error service.
Definition: Framework.h:344
Manager class for all framework channels.
std::string getGlobalID() const
Return the fully qualified global id of this framework (includes namespace)
Definition: Framework.h:362
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:335
static Type & instance()
Returns a reference to the singleton instance.
Definition: Singleton.h:544
bool mInExec
Definition: Framework.h:400
boost::shared_ptr< FrameworkTransformer > getTransformer()
Returns the pointer to the transform framework.
Definition: Framework.h:332
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
A thread monitor, which collects information about the resources of all running threads of the curren...
std::vector< BasicThreadInfo > BasicThreadInfoVector
Vector of serializable thread info.
Definition: ThreadMonitor.h:236
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:428
int mTerminationExitCode
Definition: Framework.h:398
ConfigurationLoader mConfigurationLoader
Definition: Framework.h:426
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:356
bool mTerminationRequested
Definition: Framework.h:397
Wrapper class for boost::posix_time::ptime for adding more functionality to it.
Definition: Time.h:418
RootPropertyNode mPropertiesRoot
Definition: Framework.h:407
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:382
Duration getUptime() const
Return duration since started.
Definition: Framework.h:273
std::map< std::string, LibraryInfo > Register
Definition: LibraryRegistry.h:119
Registry for shared libraries.
AuthorityManager mAuthorityManager
Definition: Framework.h:421
bool isStarted() const
Return true if framework is started.
Definition: Framework.h:265
bool mRemoteDisabled
Definition: Framework.h:401
ProtecteeMixin< MetaTypeDatabase > ProtecteeDatabase
Definition: Framework.h:372
ChannelManager mChannelManager
Definition: Framework.h:419
Resolving names of channels and authorities in namespaces.
boost::shared_ptr< RemoteModule > mRemoteModule
Definition: Framework.h:412
bool mIsStarted
Definition: Framework.h:399
#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:106
This class represents the core element of a modular application.
Definition: Framework.h:150
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:433
ScopedAccess< ProtecteeDatabase > getMetaDatabase()
Return the meta database that contains all known meta information in this framework.
Definition: Framework.h:377
RPCManager & getRPCManager()
Returns the reference to the manager singleton for registered RPC services.
Definition: Framework.h:341
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:424
Provided for convenience.
Definition: Singleton.h:580
boost::shared_ptr< PropertyNode > getProperties()
Definition: Framework.h:228
boost::shared_ptr< FrameworkTransformer > mTransformer
Definition: Framework.h:422
boost::shared_ptr< Private::FrameworkAuthority > mAuthority
Definition: Framework.h:405
Framework channel classes.
NameRegistry & getNameRegistry()
Returns the reference to the name registry.
Definition: Framework.h:323
AuthorityManager & getAuthorityManager()
Returns the reference to the manager singleton for registered authorities.
Definition: Framework.h:326
ChannelManager & getChannelManager()
Returns the reference to the manager singleton for channels.
Definition: Framework.h:329
XMLDomPreprocessor & getXMLDomPreprocessor()
Definition: Framework.h:370
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:435
boost::shared_ptr< RemoteModule > getRemoteModule()
Returns the pointer to the remote module.
Definition: Framework.h:347
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:368
static Time now() static Time eternity()
Returns the current utc based time.
Definition: Time.h:481
NameRegistry mNames
Definition: Framework.h:411
boost::shared_ptr< UnitManager > getUnitManager()
Returns the reference to the unit manager.
Definition: Framework.h:338
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:431
boost::shared_ptr< PropertyNode > mProperties
Definition: Framework.h:408
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:418
Contains non-intrusive reflects for XMLDom documents.