MATLAB IMAGE ACQUISITION TOOLBOX - RELEASE NOTES Uživatelská příručka Strana 127

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 172
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 126
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;
Zobrazit stránku 126
1 2 ... 122 123 124 125 126 127 128 129 130 131 132 ... 171 172

Komentáře k této Příručce

Žádné komentáře