User`s guide

Implementing Get and Set Support for Device-Specific Properties
6-15
Defining a Set Listener Class
Create a set listener class, deriving it from the abstract class IPropPostSetListener,
as shown in the following example. (The name of the class includes the word Post
because the toolbox notifies listeners after it updates the property value stored in the
container.)
In this example, the constructor accepts a handle to an IAdaptor object. Because the
toolbox establishes listeners on a per-instance basis, passing this handle can be helpful,
but it is not a requirement.
The IPropPostSetListener class defines one virtual function: the notify() member
function. In this function, you define how your adaptor responds when a user changes the
value of a property. For more information, see “Creating the notify() Function for Your
Class” on page 6-16.
#include "mwadaptorimaq.h"
#include "MyDeviceImaq.h" // For this example
class MyDevicePropSetListener : public IPropPostSetListener
{
public:
// Constructor/Destructor
MyDevicePropSetListener(MyDeviceAdaptor* parent):
_parent(parent) {}
virtual ~MyDevicePropSetListener() {};
virtual void notify(imaqkit::IEnginePropInfo* propertyInfo,
void* newValue);
private:
// Declare handle to parent as member data
MyDeviceAdaptor* _parent;
// Property Information object.
imaqkit::IPropInfo* _propInfo;
// The new value for integer properties.
int _lastIntValue;