File control/src/utils/ObserverFactory.hpp#
Go to the source code of this file
Factory to generate user-defined Observers
Defines
-
AUTO_REGISTER_OBSERVER(class_name, class_type)#
-
namespace ObserverFactory#
Namespace for Observer factory related objects.
Typedefs
-
typedef SP::Observer (*object_creator)(SP::ControlSensor, const SiconosVector&)#
A pointer to function, returning a SP::Observer, built with its type (ie class name) a ControlSensor and a SiconosVector, the initial estimate.
-
typedef std::map<unsigned int, object_creator> MapFactory#
The type of the factory map.
-
typedef MapFactory::iterator MapFactoryIt#
An iterator through the MapFactory.
Functions
-
template<class SubType>
SP::Observer factory(SP::ControlSensor sensor, const SiconosVector &xHat0)# Template function to return a new object of type SubType.
- Parameters:
sensor – ControlSensor used by this Observer
xHat0 – initial state estimate
- Returns:
an Observer
-
class Registry#
- #include <ObserverFactory.hpp>
Registry Class for Observers.
Observer factory. Use: ObserverFactory::Registry& regObserver(ObserverFactory::Registry::get()) ; SP::Observer yourObserver = regObserver.instantiate(observerType, timeD, myDS); With observerType a string, the name of the class of your Observer (expl: “ObserverPosition”), timeD a SP::TimeDiscretisation and myDS a SP::DynamicalSystem.
Public Functions
-
void add(unsigned int type, object_creator creator)#
Add an object_creator into the factory_map, factory_map[name] = object.
- Parameters:
type – the type of the added Observer
creator – object creator
-
SP::Observer instantiate(unsigned int type, SP::ControlSensor sensor, const SiconosVector &xHat0)#
Function to instantiate a new Observer.
- Parameters:
type – the type of the Observer we want to instantiate
sensor – the ControlSensor feeding this Observer
xHat0 – the original estimate
- Returns:
a SP::Observer to the created Observer
Public Static Functions
Private Members
-
MapFactory factory_map#
map that links a string, the type of the class, to a pointer to function, used to build the object.
-
void add(unsigned int type, object_creator creator)#
-
class Registration#
- #include <ObserverFactory.hpp>
Registration Class for Observers.
Class used for auto-registration of Observer-type objects.
Public Functions
-
Registration(unsigned int type, object_creator creator)#
To register some new object into the factory.
- Parameters:
type – the type of the added Observer
creator – object creator
-
Registration(unsigned int type, object_creator creator)#
-
typedef SP::Observer (*object_creator)(SP::ControlSensor, const SiconosVector&)#