ADTF  3.18.2
Class IDs and Object IDs


CID and OID should not be confused. They do have different meanings.

A Class Identifier (CID) is a unique class name. With the use of a class factory and the CID of the class an instance of this class can be created. A unique Object Identifier (OID) is used to register this instance of the class with the runtime. Several objects/instances of one class can be created, but each object needs to have its own unique OID.

Naming Conventions

CIDs and OIDs are clearly discriminated by their names.

The following naming structure should be used for CIDs:

  1. Only lower case letters
  2. The first word describes the class.
  3. Words are separated by an underscore (e.g. my_class).
  4. The class name is followed by the category (e.g. filter, service, streaming_source), then the product (e.g. adtf, adtf_devtb).
  5. CIDs end with cid.
  6. The single elements are separated by a "." (dot).

The following naming structure should be used for OIDs:

  1. Only lower case letters
  2. The first word is the class or object name without preceding c or o (e.g. cName -> name).
  3. Words are separated by an underscore (e.g. oMyObject -> my_object).
  4. The object name is followed by the fully qualified namespace in which the object/class has been declared. Starting with the innermost namespace.
  5. OIDs with oid.
  6. The single elements are separated by a "." (dot).

Following these rules the name structure looks as follows:







//part of the class declaration 'cService'
ADTF_CLASS_ID_NAME(cService, "my_service.service.adtf.cid", "ADTF Default Service");
static const tChar* const OID_ADTF_SERVICE = "my_service.service.adtf.oid"
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
#define ADTF_CLASS_ID_NAME(_class, _strcid, _strclabel)
Common macro to enable correct treatment of class identifier AND Class Name by IClassInfo.
Definition: class_id.h:33


//create instance of the service (CID is used)
tResult nRes = _runtime->CreateInstance(adtf::ucom::get_class_id<adtf::ucom::ant::cService>(), pNewService);
//register object at the runtime (OID is used)
tResult nRes = _runtime->RegisterObject(pNewService, OID_ADTF_SERVICE, 0);
//retrieving the registered object (OID is used)
_runtime->GetObject(pRegisteredService, OID_ADTF_SERVICE);
assert(*pRegisteredService == *pNewService);
virtual tResult CreateInstance(const char *strCID, iobject_ptr< IObject > &pObject, const tChar *strNameOfObject="") const =0
Creates a new instance of an object.
virtual tResult RegisterObject(const iobject_ptr< IObject > &pObject, const char *strNameOID, int8_t nRunLevel, uint32_t ui32Flags=0)=0
Register object at object registry.
virtual tResult GetObject(iobject_ptr< IObject > &pObject, const char *strNameOID) const =0
Get registered object from object registry.
Object pointer implementation used for reference counting on objects of type IObject.
Definition: object_ptr.h:163
adtf::ucom::IRuntime * _runtime
Global Runtime Pointer to reference to the current runtime.