ADTF
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Class IDs and Object IDs

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:

  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:

CID

class_name.category.product.cid

OID

object_name[.namespace_inner1[.namespace_innerN[.namespace_outer]]].oid

Examples

Definitions

//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

Usage

//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);
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
constexpr const char * get_class_id()
Alias always bringing the latest version of ant::get_class_id into scope.
Definition class_id.h:110