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"
#define ADTF_CLASS_ID_NAME(_class, _strcid, _strclabel)
Definition class_id.h:33
Usage:
tResult nRes = _runtime->RegisterObject(pNewService, OID_ADTF_SERVICE, 0);
_runtime->GetObject(pRegisteredService, OID_ADTF_SERVICE);
assert(*pRegisteredService == *pNewService);
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
Definition object_ptr.h:384
constexpr const char * get_class_id()
Alias always bringing the latest version of ant::get_class_id into scope.
Definition class_id.h:110