User`s guide
6 Defining Device-Specific Properties
6-14
The following example iterates through all properties in the adaptor property
container, associating a get listener object with each one.
void MyDeviceAdaptor::MyDeviceAdaptor()
{
 // get a handle to the property container
 IPropContainer* propContainer = 
 getEngine()->getAdaptorPropContainer();
 // Determine the number of properties in the container.
 int numDeviceProps = propContainer->getNumberProps();
 // Retrieve the names of all the properties in the container
 const char **devicePropNames = new const
 char*[numDeviceProps];
 propContainer->getPropNames(devicePropNames);
 // Create a variable to point to a property get listener object.
 MyDevicePropGetListener* getListener;
 // For each property in the container...
 for (int i = 0; i < numDeviceProps; i++){
 // Create a get listener object...
 getListener = new MyDevicePropGetListener(this);
 // and associate it with a specific property.
 propContainer->setCustomGetFcn(devicePropNames[i], getListener);
 }
 // clean up the array of property names.
 delete [] devicePropNames;
}
Setting Up Set Listeners in Your Adaptor
To receive notification from the engine when a user changes the value of a property using
the set command:
1
Define a set listener class, deriving it from the IPropPostSetListener abstract
class—see “Defining a Set Listener Class” on page 6-15.
2
Implement the notify() virtual function in your set listener class—see “Creating
the notify() Function for Your Class” on page 6-16.
3
Associate an instance of your set listener class with the property—see “Associating
Set Listeners with Properties” on page 6-17.










