ILS_USERTYPE_DECL/ILS_USERTYPE_DEF
 
ILS_USERTYPE_DECL/ILS_USERTYPE_DEF
Category 
Dynamic view-related macros (component and server)
Description 
These macros are used to implement a user-defined type deriving from IlsMvUserType. The macro ILS_USERTYPE_DECL must be added to any classes deriving from IlsMvUserType. As its first argument, this macro takes the name of the class where it is declared. The second argument, classNm, is either the type IlsMvUserType or the base class of classNm, which should itself derive from IlsMvUserType.
Header File 
#include <ilserver/mvvalue.h>
Synopsis 
ILS_USERTYPE_DECL(classNm,baseNm)
ILS_USERTYPE_DEF(classNm,baseNm))
Member Functions 
The macro ILS_USERTYPE_DECL declares the following functions:
ClassNm::ClassNm(IlsMvValue&);
This constructor is called when a component executes a callback on a server runtime function that taking a user-defined type as a parameter, such as the virtual callbacks to member functions in the IlsRpObject class and the function IlsMvComponent::execUserAsyncCallback).
This constructor must be implemented by the user and should be written as follows:
ClassNm::ClassNm(IlsMvValue& v){
IlsMvUserType* uv=v; // IlsMvValue conversion operator
if (ut){
ClassNm* cv=ClassNm::Narrow(*ut);
if (cv) {
// assignment of the data members ...
}
else {
// Type mismatch ....
}
}
else {
// Type mismatch ....
}
}
[static] classNm* classNm::Narrow(IlsMvUserType& v);
This static function returns 0 if the real type of v is neither of the type classNm nor of a derived type. Otherwise, it returns a pointer to v after it has been converted to classNm.
[virtual] IlsMvMessage& ilsEncode(IlsMvMessage&)const;
This virtual function is used by Rogue Wave Server to insert an object of the type classNm into an IlsMvMessage.
[static] IlsMvUserType* IlsDecode(IlsMvMessage&);
This static function is used to extract an object of the type classNm from an IlsMvMessage.
The macro ILS_USERTYPE_DEF must be added to the classNm definition file. It implements the static function classNm::Narrow and declares the function classNm::IlsDecode in an Rogue Wave Server library table.
Note: The implicitly-declared constructor and the functions ilsEncode and IlsDecode must be implemented by the user.
See Also 
IlsMvMessage, IlsMvUserType

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.