Contents

TYPE

Annotates a method declaration to indicate that it conforms to an existing method signature.

Declaration

#define TYPE(p)

Parameters

  • p:

    The class and method name to which the method conforms. Specify this value using the format <class>::<method>. Specify the class and method names directly, and do not use a string.

Mentioned in

Discussion

Typically, you use this macro to implement DriverKit callbacks using your own custom methods. The macro lets you ignore the original method’s name and choose any name you want. Your method must still declare the same parameters and return type as the original method. For example, the following code shows how to declare a custom version of the DataAvailable method of IODataQueueDispatchSource in your header file.

virtual void MyCustomDataAvailable (OSAction *action) TYPE(IODataQueueDispatchSource::DataAvailable);

This macro generates the following convenient symbols that you can use when configuring actions involving your custom method:

  • A message ID constant you can pass to the Create method of OSAction. The constant takes the form <ClassName>_<MethodName>_ID. For example, if you add the TYPE macro to the ReceiveData method of your custom MyDriver class, the corresponding message ID constant is MyDriver_ReceiveData_ID.

  • A CreateAction_<Method> function that creates an OSAction object targeting your custom method. For example, if the name of your custom method is HandleTimer, the name of the generated function is CreateActionHandleTimer.

See Also

Runtime support