Invoking Member Functions from a Script
All member functions that have been declared to the server model interpreter are available to a server type manipulated in a script. These functions may have been declared either through the
When used exclusively on the server side, an exported member function can declare arguments of server types. A script can then pass server objects to this exported function.
Example
Let us assume that the class Network declares the exported function addDomain, which receives a Domain object:
ILS_MEMBER_FUNCTION1(IlsBoolean, Network, addDomain, Domain)
The corresponding C++ method has the following prototype:
class Network : ...
{
public:
IlsBoolean addDomain(IlsMvValue arg)
};
If this function is called from Script with a Domain object, the instance of IlsMvValue received will contain an
Example
IlsBoolean
Network::addDomain(IlsMvValue arg)
{
Domain* d = 0;
if (arg.isSvRef()) {
IlsSvRef r = arg.asSvObjectRef();
const IlsObjectType* argType =
IlsModelInterpreter::GetType(r.getTypeName());
if (argType && argType->isSubtypeOf("Domain")) {
d = (Domain*)r.getObject();
}
}
}
Note that you shall not call this kind of member functions from a component by using an exec<>Callback function.