Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

CIF declarations

To use a singleton in-process class or singleton service class, applications need to have the appropriate declarations in their CIF.

Singleton in-process class

For a singleton in-process class, the Class and Singleton declarations are included in the CIF. For example:

Class {
   classid = AEECLSID_Foo,
   newfunc = c_Foo_New,
}

Singleton{  
   classid = AEECLSID_FooSingle,  
   singled_id = AEECLSID_Foo,  
}

In the Class primitive:

  • classid specifies the ClassID of the in-process class.
  • newfunc specifies the function that implements the class.

In the Singleton primitive:

  • classid specifies the ClassID that is used to instantiate the singleton in-process class.
  • singled_id specifies the ClassID of the actual class that will be instantiated as a singleton. This is typically the ClassID of an in-process class.

Singleton service class

For a single service class, the Class, Singleton, and Service declarations are included in the CIF. For example:

Class {
   classid = AEECLSID_Foo,
   newfunc = c_Foo_New,
}

Singleton{  
   classid = AEECLSID_FooSingle,  
   singled_id = AEECLSID_Foo,  
}

Service {  
   serviceid = AEECLSID_FooServiceSingle,  
   iid = AEEIID_IFoo,  
   serverid = 0,
   servedclassid = AEECLSID_FooSingle,  
   required_privs = { 0 }  
};

In the Class primitive:

  • classid specifies the ClassID of the in-process class.
  • newfunc specifies the function that implements the class.

The Singleton primitive associates classid with the ClassID to be instantiated (singled_id). In the Singleton primitive:

  • classid specifies the ClassID of the actual class that is used to instantiate the singleton.
  • singled_id specifies the ClassID that will be instantiated as a singleton. This is typically the ClassID of an in-process class.

The Service primitive associates the serviceid with a class to be instantiated (specified in servedclassid). When serviceid is used, the class will be instantiated as a service in the specified process. In the Service primitive:

  • serviceid specifies the ClassID that is used to instantiate the service.
  • iid specifies the interface defined by the service.
  • serverid specifies the process in which the service is instantiated. Zero indicates the kernel process.
  • servedclassid specifies the ClassID that is instantiated. In this example, servedclassid specifies the ClassID of a singleton, which results in a singleton service being instantiated. If servedclassid is set to a non-singleton ClassID, the service will not be instantiated as a singleton.
  • required_privs specified any privileges required to instantiate the service. In the example above, no privileges are required.

The following figure illustrates the CIF declarations and the classes that will be instantiated: