• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Product
    • Design UI
    • Develop
    • Analyze and test
    • Deploy
    • Framework and toolbox
    • Compatibility
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - CDP Core
  • CDPEngine
  • 5.0.0

CDPEngine Class

CDPEngine runs CDPComponents and CDPOperators and delivers messages to all objects with registered object Handle in this application. More...

Header: #include <CDPEngine>
Inherits: CDPComponent
  • List of all members, including inherited members

Public Functions

~CDPEngine() override
virtual void ActivateWaitingForActivateObjects()
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 bool IsReadyToActivate() override
virtual void ProcessNull() override
  • 92 public functions inherited from CDPComponent
  • 39 public functions inherited from CDPObject
  • 49 public functions inherited from CDPBaseObject
  • 27 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
  • 15 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
  • 8 protected variables inherited from CDPBaseObject
  • 1 static protected member inherited from CDPObject

Detailed Description

CDPEngine runs CDPComponents and CDPOperators and delivers messages to all objects with registered object Handle 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) and CDPOperators in the component.

Usage

Only one global instance exists in the application. One global instance of CDPEngine is created in each application. Access methods by calling the CDPEngine::GetInstance()->.

Attributes

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

Properties

ActivateSet 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::ActivateWaitingForActivateObjects()

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

[override virtual] bool CDPEngine::IsReadyToActivate()

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

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2024 CDP Technologies. Privacy and cookie policy.

Return to top