Class CSdvObject#

Inheritance Relationships#

Base Types#

Derived Types#

Class Documentation#

class CSdvObject : public sdv::CSdvParamMap, public sdv::CSdvObjectAccess, public sdv::IObjectControl#

SDV object base class.

The SDV object class implements all base functionality for is instantiating and controlling the SDV object. A SDV object implementation can derive from this class and overload the following events to control object behavior:

  • OnPreInitialize - prepare for initialization, no object configuration loaded yet.

  • OnInitialize - initialize; object configuration is loaded and stored in the parameters.

  • OnChangeToConfigMode - change to configuration mode; shutdown running instances.

  • OnChangeToRunningMode - change to running mode, interpret configuration parameters and start running instances.

  • OnShutdown - shutdown the object

  • OnParamChanged - parameter has changed

  • OnParamFlagChanged - parameter flag has changed

Subclassed by CAppConfigService, CAppControlService, CAppSettingsService, CCANSilKit, CCANSimulation, CCANSockets, CClientConnect, CCommunicationControl, CDispatchService, CHardwareIdent, CListener, CLoggerService, CManifestUtil, CModuleControlService, CPermissionControlService, CProcessControl, CRepositoryService, CSharedMemChannelMgnt, CSimulationTaskTimerService, CTaskTimerService, CTOMLParserUtility, sdv::ps::CProxyHandler< TInterface >, sdv::ps::CStubHandler< TInterface >

Public Types

template<class TSdvObject>
using TSdvObjectCreator = CSdvObjectClass<TSdvObject>#

Use the default object creator class.

Public Functions

CSdvObject() = default#

Constructor.

CSdvObject(CSdvObject&) = delete#
CSdvObject &operator=(CSdvObject&) = delete#
CSdvObject(CSdvObject&&) = delete#
CSdvObject &operator=(CSdvObject&&) = delete#
inline ~CSdvObject() override#

Destructor.

inline virtual void Initialize(const SObjectInfo &sObjectInfo) override#

Initialize the object. Overload of IObjectControl::Initialize.

Parameters:

sObjectInfo[in] The registration information of this object.

inline virtual EObjectState GetObjectState() const override#

Get the current state of the object. Overload of IObjectControl::GetObjectState.

Returns:

Return the current state of the object.

inline const SObjectInfo &Self() const#

Get information about ourself.

Returns:

The object information about ourself.

inline virtual void SetOperationMode(EOperationMode eMode) override#

Set the component operation mode. Overload of IObjectControl::SetOperationMode.

Parameters:

eMode[in] The operation mode, the component should run in.

inline virtual u8string BuildObjectConfig() const#

Build the object configuration from the parameter map and the stored initial configuration.

Returns:

The object configuration as TOML string.

inline virtual u8string GetObjectConfig() const override#

Get the object configuration for persistence. Overload of IObjectControl::GetObjectConfig.

Returns:

The object configuration as TOML string.

inline virtual void Shutdown() override#

Shutdown called before the object is destroyed. Overload of IObjectControl::Shutdown.

Attention

Implement calls to other SDV objects here as this is no longer considered safe during the destructor of the object! After a call to shutdown any threads/callbacks/etc that could call other SDV objects need to have been stopped. The SDV object itself is to remain in a state where it can respond to calls to its interfaces as other objects may still call it during the shutdown sequence! Any subsequent call to GetObjectState should return EObjectState::destruction_pending

inline void SetObjectIntoConfigErrorState()#

Set the object into configuration error state.

Pre:

Works only when in configuration or initialized mode.

Post:

Reset by switching to configuration mode again or by trying to switch to running mode.

inline void SetObjectIntoRuntimeErrorState()#

Set the onbject into runtime error state.

Pre:

Works only when in running mode.

Post:

Reset by switching to configuration mode.

inline virtual void OnPreInitialize()#

Pre-initialization event, called before loading the object configuration. Overload this function to implement pre-initialization functionality.

inline virtual bool OnInitialize()#

Initialization event, called after object configuration was loaded. Overload this function to implement object initialization.

Returns:

Returns ‘true’ when the initialization was successful, ‘false’ when not.

inline virtual void OnChangeToConfigMode()#

Change to configuration mode event. After this a call to this function locked parameters can be changed again. Overload this function to shutdown any running instances and prepare for configuration.

inline virtual bool OnChangeToRunningMode()#

Change to running mode event. Parameters were locked before the call to this event. Overload this function to interpret the configuration parameters and start the running instances.

Returns:

Returns ‘true’ when the configuration is valid and the running instances could be started. Otherwise returns ‘false’.

inline virtual void OnShutdown()#

Shutdown the object. Overload this function to terminate any running instances and prepare the object for termination or restarting.

inline virtual void OnDestroy()#

Last function called before destruction. The object integrity is still in tact. It can be assumed that all dependencies to the object have been released.

Public Static Functions

static inline sequence<u8string> GetClassAliasesStatic()#

Class aliases sequence if not provided.

Returns:

An empty sequence of class aliases.

static inline u8string GetDefaultObjectNameStatic()#

Default object name is not set.

Returns:

The empty default object name

static inline bool IsSingletonStatic()#

Return whether the object is a singleton object (only one instance will be created of the object).

Returns:

Returns whether the object is a singleton.

static inline sequence<u8string> GetObjectDependenciesStatic()#

Get object dependencies.

Returns:

Returns a vector containing the class names of the objects this component is dependent on.