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

Developer

resources

Class

The Class primitive declares a class, which is uniquely identified by a 32-bit ID known as a ClassID that is specified by the classid field.

The C function that implements this class can also be specified by the newfunc element. However, the CIFC compiler will issue an error if the constructor function is not specified in any of the included headers. For more information about using the CIFC compiler, check the Tools Reference on the Brew MP website.

Prototype

Class { 
  classid = AEECLSID_Foo, 
  newfunc = Foo_New,
  privileged = TRUE,
}
  • classid: A 32-bit unique ID.
  • newfunc: (Optional): The name of the C function that creates an instance of this class.

    Note: A newfunc is required for code that is written for MOD1. Code written for MOD does not require a newfunc because the AEEModGen.c file that the Brew MP application wizard provides creates a newfunc automatically. Additional information about MOD vs MOD1 is available on the Brew MP website.

  • privileged (Optional): If set to TRUE the class will be treated as a privileged class, i.e. calling applications must list this classid as a privilege in order to use it. Otherwise, CreateInstance() will fail with AEE_EPRIVLEVEL.

Example

For example, where there is a file named myClass.bid that contains the following definition of a friendly ClassID:

#define AEECLSID_myClass 0x8F7D418B

The CIF file that contains the Class primitive can include AEECLSID_myClass.bid, which provides a definition of the friendly ClassID. You can use either friendly ClassIDs or raw ClassIDs.

include "myClass.bid" -- Need to include to use AEECLSID_myClass for classid.
include "myClass.h"   -- Need to include the header file that defines the C constructor
                      -- function called myClass_New.

Class { 
   classid = AEECLSID_myClass, 
   newfunc = myClass_New,
   privileged = true, 
}