Definition
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:
- Only lower case letters
- The first word describes the class.
- Words are separated by an underscore (e.g. my_class).
- The class name is followed by the category (e.g. filter, service, streaming_source), then the product (e.g. adtf, adtf_devtb).
- CIDs end with cid.
- The single elements are separated by a "." (dot).
The following naming structure should be used for OIDs:
- Only lower case letters
- The first word is the class or object name without preceding c or o (e.g. cName -> name).
- Words are separated by an underscore (e.g. oMyObject -> my_object).
- The object name is followed by the fully qualified namespace in which the object/class has been declared. Starting with the innermost namespace.
- OIDs with oid.
- The single elements are separated by a "." (dot).
Following these rules the name structure looks as follows:
CID
class_name.category.product.cid
OID
object_name[.namespace_inner1[.namespace_innerN[.namespace_outer]]].oid
Examples
Definitions
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.
Usage
assert(*pRegisteredService == *pNewService);
A common result class usable as return value throughout.
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.
adtf::ucom::IRuntime * _runtime
Global Runtime Pointer to reference to the current runtime.