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

virtual ~CDPEngine()
virtual void ActivateWaitingForActivateComponents()
virtual void AddActivateWait(CDPObject *object)
void AddSafeCall(CDPSafeCall *pSafeCall)
virtual int ClearSuspendAlarm(CDPComponent *component)
void Connect(CDPBaseObject *object)
void ConnectProcess(CDPSchedulable *item)
unsigned int GetBufferSize()
double GetCDPmsgTimeLimitProcMsg()
CDPObject *GetComponent(unsigned int handle)
std::string GetComponentName(unsigned int handle)
std::string GetComponentType(unsigned int handle)
CDPBaseObject *GetObject(unsigned int handle)
std::string GetObjectName(unsigned int handle)
std::string GetObjectName(CDPObject *pObj)
std::string GetObjectType(unsigned int handle)
std::string GetObjectType(CDPObject *pObj)
unsigned int LastComponent()
unsigned int LastObject()
virtual void RemoveActivateWait(CDPObject *object)
void RemoveObject(unsigned int handle, CDPObject *object)
void SendNotify(MessageRequestHandle *message)
virtual int SetSuspendAlarm(CDPComponent *component, std::string &descr)
void StopThreads()
void UpdateProcessFrequency(CDPSchedulable *item)

Reimplemented Public Functions

virtual void Activate() override
virtual void Create(const char *name) override
virtual std::string GetNodeTypeName() const override
virtual void ProcessNull() override

Static Public Members

CDPEngine *GetInstance()

Additional Inherited Members

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).


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


Attribute nameDescription
NameName of CDPEngine, should be 'CDPEngine'.
TypeType of component == 'CDPEngine'.


ActivateSet to '1' to activate the engine.

Member Function Documentation

[virtual] 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::AddSafeCall(CDPSafeCall *pSafeCall)

The AddSafeCall method is used to have a component/object call (back) a function in another class to make it run inbetween the components/objects normal schedule.

This function adds a CDPSafeCall callback. Note that CDPEngine uses the dEstimatedTimeConsumptionS member to determine how many such callbacks can be run without interfering with the component scheduling, so set it to a reasonably correct value.

[virtual] int CDPEngine::ClearSuspendAlarm(CDPComponent *component)

Clears a suspend alarm.

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

[override virtual] void CDPEngine::Create(const char *name)

Reimplemented from CDPComponent::Create().

Creates objects owned by CDPEngine.

unsigned int CDPEngine::GetBufferSize()

Returns the size of the MessageTransportPacket message queue

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

[override virtual] std::string CDPEngine::GetNodeTypeName() const

Reimplemented from ICDPNode::GetNodeTypeName().

Returns CDPNode class name.

CDPBaseObject *CDPEngine::GetObject(unsigned int handle)

Returns pointer to CDPBaseObject at index 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(CDPObject *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(CDPObject *pObj)

Returns the object type from a pointer , or empty string if nullptr

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::RemoveObject(unsigned int handle, CDPObject *object)

Removes component object from engine, verifies that handle matches object pointer.

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

void CDPEngine::UpdateProcessFrequency(CDPSchedulable *item)

Update process frequency if necessary.

© CDP Technologies AS - All rights reserved