Class CRepository#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Types#

Class Documentation#

class CRepository : public sdv::IInterfaceAccess, public sdv::core::IObjectAccess, public sdv::core::IRepositoryUtilityCreate, public sdv::core::IRepositoryMarshallCreate, public sdv::core::IRepositoryControl, public sdv::core::IRegisterForeignObject, public sdv::core::IRepositoryInfo, public IObjectDestroyHandler, public sdv::core::ILinkCoreRepository#

repository service providing functionality to load modules, create objects and access exiting objects

Public Functions

CRepository() = default#

Default constructor.

void SetConfigMode()#

Switch all components in config mode.

void SetRunningMode()#

Switch all components in running mode.

virtual sdv::IInterfaceAccess *GetObject(const sdv::u8string &ssObjectName) override#

Get the object instance previously created through the repository service. Overload of IObjectAccess::GetObject.

Parameters:

ssObjectName[in] The name of the requested object.

Returns:

Returns the IInterfaceAccess interface of the object instance if found and nullptr otherwise.

virtual sdv::IInterfaceAccess *GetObjectByID(sdv::core::TObjectID tObjectID) override#

Get the object instance previously created through the repository service.

Attention

Utilities cannot be returned by this function.

Parameters:

tObjectID[in] The ID of the requested object.

Returns:

Returns the IInterfaceAccess interface of the object instance if found and nullptr otherwise.

virtual sdv::IInterfaceAccess *CreateUtility(const sdv::u8string &ssClassName, const sdv::u8string &ssObjectConfig) override#

Creates an utility object from a previously loaded module. Overload of IRepositoryUtilityCreate::CreateUtility.

Attention

Utilities are standalone objects. Use IObjectDestroy to destroy the utility.

Parameters:
  • ssClassName[in] The name of the object class to be created.

  • ssObjectConfig[in] Optional configuration handed over to the object upon creation via IObjectControl.

Returns:

Returns the IInterfaceAccess interface of newly created utility.

virtual sdv::IInterfaceAccess *CreateProxyObject(sdv::interface_id id) override#

Create a proxy object for the interface with the supplied ID. If successful, this object is initialized, but not linked to any other object within the system. Overload of sdv::core::IRepositoryMarshallCreate::CreateProxyObject.

Create a proxy object with the name “proxy_<ifc id>”. “ifc_id” is the decimal value of an interface ID.

Parameters:

id[in] The interface ID to create the object for.

Returns:

Returns the interface to the proxy object. Destruction of the object can be achieved through IObjectDestroy.

virtual sdv::IInterfaceAccess *CreateStubObject(sdv::interface_id id) override#

Create a stub object for the interface with the supplied ID. If successful, this object is initialized, but not linked to any other object within the system. Overload of sdv::core::IRepositoryMarshallCreate::CreateStubObject.

Create a stub object with the name “stub_<ifc id>”. “ifc_id” is the decimal value of an interface ID.

Parameters:

id[in] The interface ID to create the object for.

Returns:

Returns the interface to the stub object. Destruction of the object can be achieved through IObjectDestroy.

virtual sdv::core::TObjectID CreateObjectFromModule(sdv::core::TModuleID tModuleID, const sdv::u8string &ssClassName, const sdv::u8string &ssObjectName, const sdv::u8string &ssObjectConfig) override#

Creates an object from a previously loaded module. Provide the module ID to explicitly define what module to use during object creation. Overload of sdv::core::IRepositoryControl::CreateObjectFromModule.

Parameters:
  • tModuleID[in] Module ID that contains the object class to create the object with.

  • ssClassName[in] The name of the object class to be created.

  • ssObjectName[in] Optional name of the object - required to be unique. If not supplied, the object might either provide a name proposal or the name is the same as the class name. Use the returned object ID to request the name of the object.

  • ssObjectConfig[in] Optional configuration handed over to the object upon creation via IObjectControl.

Returns:

Returns the object ID when the object creation was successful or 0 when not. On success the object is available through the IObjectAccess interface. If the object already exists (class and object names are identical), the object ID of the existing object is returned.

sdv::core::TObjectID CreateObject2(const sdv::u8string &ssClassName, const sdv::u8string &ssObjectName, const sdv::u8string &ssObjectConfig)#

Create an object and all its objects it depends on. Internal function not accessible through the interface.

Parameters:
  • ssClassName[in] The name of the object class to be created. For the main application, the class string could be empty for the main application if the object was defined in the installation.

  • ssObjectName[in] Name of the object, required to be unique. For standalone and essential applications, the name string can be empty, in which case the object might either provide a name proposal or the name is the same as the class name. Use the returned object ID to request the name of the object.

  • ssObjectConfig[in] Optional configuration handed over to the object upon creation via IObjectControl. Only valid for standalone, essential and isolated applications.

Returns:

Returns the object ID when the object creation was successful or 0 when not. On success the object is available through the IObjectAccess interface. If the object already exists (class and object names are identical), the object ID of the existing object is returned.

bool DestroyObject2(const sdv::u8string &ssObjectName)#

Destroy a previously created object with the supplied name. Internal function not accessible through the interface.

For standalone and essential applications previously created system, device and service objects can be destroyed. For the main and isolated applications, only the complex service can be destroyed. For isolated applications a destruction of the object will end the application.

Parameters:

ssObjectName[in] The name of the object to destroy.

Returns:

Returns whether the object destruction was successful.

virtual sdv::core::TObjectID RegisterObject(sdv::IInterfaceAccess *pObjectIfc, const sdv::u8string &ssObjectName) override#

Register as foreign object and make it public to the system with the given name. Overload of sdv::core::IRegisterForeignObject::RegisterObject.

Parameters:
  • pObjectIfc[in] Interface of the object to be registered.

  • ssObjectName[in] The name under which the object - required to be unique.

Returns:

Returns the object ID when the object creation was successful or 0 when not. On success the object is available through the IObjectAccess interface. If the object already exists (class and object names are identical), the object ID of the existing object is returned.

virtual void LinkCoreRepository(sdv::IInterfaceAccess *pCoreRepository) override#

Register the core repository.

Parameters:

pCoreRepository[in] Pointer to the proxy interface of the core repository.

virtual void UnlinkCoreRepository() override#

Unlink a previously linked core repository.

virtual sdv::SClassInfo FindClass(const sdv::u8string &ssClassName) const override#

Find the class information of an object with the supplied name. Overload of sdv::core::IRepositoryControl::IRepositoryInfo::FindClass.

Parameters:

ssClassName[in] Object class name.

Returns:

The object class information.

virtual sdv::sequence<sdv::core::SObjectInfo> GetObjectList() const override#

Get a list of all the instantiated objects. Overload of sdv::core::IRepositoryControl::IRepositoryInfo::GetObjectList.

Returns:

Sequence containing the object information structures.

virtual sdv::core::SObjectInfo GetObjectInfo(sdv::core::TObjectID tObjectID) const override#

Get the object info for the requested object. Overload of sdv::core::IRepositoryInfo::GetObjectInfo.

Parameters:

tObjectID[in] The object ID to return the object information for.

Returns:

The object information structure if the object is available or an empty structure if not.

virtual sdv::core::SObjectInfo FindObject(const sdv::u8string &ssObjectName) const override#

Find an object with the supplied name. Only object instances that are in the service list can be found with this function (devices, basic and complex services, and system objects). Overload of sdv::core::IRepositoryInfo::FindObject.

Parameters:

ssObjectName[in] Object name to search for.

Returns:

The object information structure if the object is available or an empty structure if not.

virtual void OnDestroyObject(sdv::IInterfaceAccess *pObject) override#

Remove an object instance from the local object map. Overload of IObjectDestroyHandler::OnDestroyObject.

Parameters:

pObject[in] Interface pointer to the object instance.

void DestroyModuleObjects(sdv::core::TModuleID tModuleID)#

Destroy all objects from the service map created for a specific module.

Parameters:

tModuleID[in] Module ID that contains the object class to destroy.

void DestroyAllObjects(const std::vector<std::string> &rvecIgnoreObjects, bool bForce = false)#

Destroy all objects from the service map.

Remark

In Emergency, the objects should be removed without unloading to prevent any more calls to take place. The reason is, that the system could do an emergency shutdown and part of the system might have been cleaned up already and part not.

Parameters:
  • rvecIgnoreObjects[in] Reference to the vector of objects to not destroy.

  • bForce[in] Force destruction (remove without calling any more function).

void ResetConfigBaseline()#

Reset the current config baseline.

std::string SaveConfig()#

Save the configuration of all components.

Returns:

The string containing all the components.

Protected Functions

virtual sdv::core::TObjectID CreateObject(const sdv::u8string &ssClassName, const sdv::u8string &ssObjectName, const sdv::u8string &ssObjectConfig) override#

Create an object and all its objects it depends on. Overload of Overload of sdv::core::IRepositoryControl::CreateObject.

For standalone and essential applications, this function allows the creation of system, device and service objects if the module was loaded previously. For the main and isolated application, this function allows the creation of complex services only and only those that are in the installation. For the isolated application only one complex service can be created. External apps, utilities, and proxy and stub objects cannot be created at all using this function. Objects that the to be create object is depending on will be created as well. For the main application this is limited to complex services. Isolated applications cannot load other services; this is taken over by the main application.

Parameters:
  • ssClassName[in] The name of the object class to be created. For the main application, the class string could be empty for the main application if the object was defined in the installation.

  • ssObjectName[in] Name of the object, required to be unique. For standalone and essential applications, the name string can be empty, in which case the object might either provide a name proposal or the name is the same as the class name. Use the returned object ID to request the name of the object.

  • ssObjectConfig[in] Optional configuration handed over to the object upon creation via IObjectControl. Only valid for standalone, essential and isolated applications.

Returns:

Returns the object ID when the object creation was successful or 0 when not. On success the object is available through the IObjectAccess interface. If the object already exists (class and object names are identical), the object ID of the existing object is returned.

virtual bool DestroyObject(const sdv::u8string &ssObjectName) override#

Destroy a previously created object with the supplied name. Overload of sdv::core::IRepositoryControl::DestroyObject.

For standalone and essential applications previously created system, device and service objects can be destroyed. For the main and isolated applications, only the complex service can be destroyed. For isolated applications a destruction of the object will end the application.

Parameters:

ssObjectName[in] The name of the object to destroy.

Returns:

Returns whether the object destruction was successful.