CDPEngine Class
CDPEngine runs the state-machines of the CDPComponents, and delivers messages to all objects in this application. More...
Header: | #include <CDPSystem/Engine/CDPEngine.h> |
Inherits: | CDPComponent |
Public Functions
~CDPEngine() override | |
virtual void | ActivateWaitingForActivateComponents() |
virtual void | AddActivateWait(CDPObject *object) |
void | AddAlias(unsigned int handle, const std::string &alias) |
void | AddSafeCallRequest(uintptr_t requester, ICDPNode *target, const std::function<void() > &callback) |
virtual int | ClearSuspendAlarm(CDPComponent *component) |
void | Connect(CDPBaseObject *object) |
void | ConnectProcess(CDPSchedulable *item) |
double | GetCDPmsgTimeLimitProcMsg() |
CDPObject * | GetComponent(unsigned int handle) |
std::string | GetComponentName(unsigned int handle) |
std::string | GetComponentType(unsigned int handle) |
CDPBaseObject * | GetObject(unsigned int handle) |
CDPBaseObject * | GetObject(const std::string &longName) |
std::string | GetObjectName(unsigned int handle) |
std::string | GetObjectName(CDPBaseObject *pObj) |
std::string | GetObjectType(unsigned int handle) |
std::string | GetObjectType(CDPBaseObject *pObj) |
CDPProcess * | GetProcess(CDPSchedulable *item) |
CDPThreadPool * | GetWorkerPool() |
unsigned int | LastComponent() |
unsigned int | LastObject() |
virtual void | RemoveActivateWait(CDPObject *object) |
void | RemoveAlias(const std::string &alias) |
void | RemoveObject(unsigned int handle, CDPBaseObject *object) |
void | SafeCallRequesterExpired(uintptr_t requester, bool discardWork = false) |
void | SendNotify(MessageRequestHandle *message) |
virtual int | SetSuspendAlarm(CDPComponent *component, std::string &descr) |
void | StopThreads() |
Reimplemented Public Functions
virtual void | Activate() override |
virtual void | Configure(const char *xml) override |
virtual void | Create(const char *name) override |
virtual void | ProcessNull() override |
- 90 public functions inherited from CDPComponent
- 37 public functions inherited from CDPObject
- 46 public functions inherited from CDPBaseObject
- 26 public functions inherited from CDP::StudioAPI::CDPNode
- 22 public functions inherited from CDP::StudioAPI::ICDPNode
Static Public Members
CDPEngine * | GetInstance() |
- 2 static public members inherited from CDPComponent
- 6 static public members inherited from CDPObject
- 1 static public member inherited from CDPBaseObject
Additional Inherited Members
- 12 protected functions inherited from CDPComponent
- 13 protected functions inherited from CDPObject
- 1 protected function inherited from CDP::StudioAPI::CDPNode
- 31 protected variables inherited from CDPComponent
- 7 protected variables inherited from CDPObject
- 9 protected variables inherited from CDPBaseObject
- 1 static protected member inherited from CDPObject
Detailed Description
CDPEngine runs the state-machines of the CDPComponents, and delivers messages to all objects in this application.
The CDPEngine maintains a list of all objects in the Application, and is responsible for scheduling all CDPComponents at their configured frequencies, priorities and SchedulingGroups (see CDPComponent#priority-levels-and-scheduling-groups for more information about the scheduling).
Usage
Only one global instance can exist in the application space. One global instance of CDPEngine is created in each application. Access methods by calling the 'CDPEngine::GetInstance()->'.
Component execution order: See CDPComponent#execution-order
Attributes
Attribute name | Description |
---|---|
Name | Name of CDPEngine, should be 'CDPEngine'. |
Type | Type of component == 'CDPEngine'. |
Properties
Activate | Set to '1' to activate the engine. |
Member Function Documentation
CDPEngine::~CDPEngine()
CDPEngine destructor, deallocates memory and cleans up.
[override virtual]
void CDPEngine::Activate()
Reimplemented from CDPBaseObject::Activate().
Activates CDPEngine
[virtual]
void CDPEngine::ActivateWaitingForActivateComponents()
Activates all objects that should be activated at t=nowTime.
[virtual]
void CDPEngine::AddActivateWait(CDPObject *object)
Adds an object for delayed activation
void CDPEngine::AddAlias(unsigned int handle, const std::string &alias)
Adds or override global short alias name to point to the handle.
void CDPEngine::AddSafeCallRequest(uintptr_t requester, ICDPNode *target, const std::function<void() > &callback)
[virtual]
int CDPEngine::ClearSuspendAlarm(CDPComponent *component)
Clears a suspend alarm.
[override virtual]
void CDPEngine::Configure(const char *xml)
void CDPEngine::Connect(CDPBaseObject *object)
Adds a CDPBaseObject to the CDPEngine
void CDPEngine::ConnectProcess(CDPSchedulable *item)
Adds a component to the scheduler priority specified in processMode
Must be called in the item's context.
[override virtual]
void CDPEngine::Create(const char *name)
Reimplemented from CDPComponent::Create().
Creates objects owned by CDPEngine.
double CDPEngine::GetCDPmsgTimeLimitProcMsg()
Returns the timeLimit for message processing.
CDPObject *CDPEngine::GetComponent(unsigned int handle)
Obsolete: changed name to GetObject(), use that one instead.
std::string CDPEngine::GetComponentName(unsigned int handle)
Returns the component name from a valid handle, or empty string if not found.
std::string CDPEngine::GetComponentType(unsigned int handle)
Returns the component type (model) from a valid handle, or empty string if not found.
[static]
CDPEngine *CDPEngine::GetInstance()
Returns the only CDPEngine instance
CDPBaseObject *CDPEngine::GetObject(unsigned int handle)
Returns pointer to CDPBaseObject or CDPObject at index handle
CDPBaseObject *CDPEngine::GetObject(const std::string &longName)
Returns pointer to CDPBaseObject or CDPObject with registered Handle
std::string CDPEngine::GetObjectName(unsigned int handle)
Returns the object name from a valid handle, or empty string if not found.
std::string CDPEngine::GetObjectName(CDPBaseObject *pObj)
Returns the object name from a pointer, or empty string if nullptr
std::string CDPEngine::GetObjectType(unsigned int handle)
Returns the object type (model) from a valid handle, or empty string if not found
std::string CDPEngine::GetObjectType(CDPBaseObject *pObj)
Returns the object type from a pointer , or empty string if nullptr
CDPProcess *CDPEngine::GetProcess(CDPSchedulable *item)
CDPThreadPool *CDPEngine::GetWorkerPool()
Returns CDPThreadPool that contains CDPEngine configured number of workers with set stack size and priority Returns nullptr before CDPEngine::Configure().
unsigned int CDPEngine::LastComponent()
Returns the index of the last component
See also LastObject.
unsigned int CDPEngine::LastObject()
Returns the index of the last object
[override virtual]
void CDPEngine::ProcessNull()
Reimplemented from CDPComponent::ProcessNull().
Sets overload alarms and component suspended alarms
[virtual]
void CDPEngine::RemoveActivateWait(CDPObject *object)
Removes an object from delayed activation
void CDPEngine::RemoveAlias(const std::string &alias)
Removea global alias name form engine.
void CDPEngine::RemoveObject(unsigned int handle, CDPBaseObject *object)
Removes component object from engine, verifies that handle matches object pointer.
void CDPEngine::SafeCallRequesterExpired(uintptr_t requester, bool discardWork = false)
The SafeCallRequesterExpired method must be called after requester is no longer interested in adding more safe calls.
discardWork can optionally be passed to discard all work in the queues for the given requester. When work is not discarded it is the responsibility of the requester to make sure the provided callback is safe to use after SafeCallRequesterExpired has been called.
This function is thread-safe.
void CDPEngine::SendNotify(MessageRequestHandle *message)
Invokes SendNotify function in the object that the message is for.
[virtual]
int CDPEngine::SetSuspendAlarm(CDPComponent *component, std::string &descr)
Sets a suspend alarm
void CDPEngine::StopThreads()
Stops the low, normal and high priority schedulers
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.