Example 1: Linking an instance to another class.
Class declaration
++
class ClientOrServer
{
public:
virtual ClientOrServer(bool client);
private:
Variable _variable;
TVariableHandler<ClientOrServer> _eventHandler;
void eventHandler
(
Variable::EEvent event,
const Variable& caller,
Variable& link,
bool sameinst
);
};
Class implementation.
++
ClientOrServer::ClientOrServer()
:_eventHandler(this, &ClientOrServer::eventHandler)
{
Fvariable->setHandler(&_eventHandler);
if (client)
{
_variable.setup(0x98001);
}
else
{
_variable.setup
(
"0x98001,Calibrate|Blue Pos,%,ASP,"
"Blue position for calibrating the C-scan plot.,"
"FLOAT,,"
"0.1,50,0,100"
);
}
}
void ClientOrServer::eventHandler
(
Variable::EEvent event,
const Variable& caller,
Variable& link,
bool sameinst
)
{
switch (event)
{
case Variable::veFlagsChange:
break;
case Variable::veValueChange:
break;
case Variable::veConverted:
break;
case Tvariable::veIdChanged:
break;
}
}