User-Defined Representation Attributes Types

By default, Server supports a limited number of representation attributes types. However, you can define your own representation attributes using user-defined types, providing that:

  • They derive directly or transitively from the class IlsMvUserType.

  • They declare the macro ILS_USERTYPE_DECL.

  • The source file implementing their functions includes the macro ILS_USERTYPE_DEF.

  • They implement the following member functions declared by the macro ILS_USERTYPE_DECL:

    • IlsMvMessage& ilsEncode(IlsMvMessage&) const;

      This pure virtual member function is used by Server to encode the user-defined type instance into a message of the server generic protocol.

    • IlsMvUserType* IlsDecode(IlsMvMessage&);

      This static member function is used to decode a message of the server generic protocol and create a new user-defined type instance from the decoded data.

    • constructor(const MyUserType&);

      This copy constructor is invoked when the user type is copied. This constructor must invoke the base class copy constructor to comply with IlsMvUserType life cycle management rules.

    • constructor(const IlsMvValue&);

      This constructor is called when the user-defined type is used as a parameter passed to a server runtime function called from the component (for details, see the function execCallback, described in the Server Reference Manual.)

In the example below, the name of an employee is replaced with an instance of the user-defined attribute type Identity. You want to represent this type of value directly in the DepartmentTable view type.