IlsDynModelInterpreter
Category
Dynamic view-related class (server side)
Inheritance Path
IlsDynModelInterpreter
Description
This class allows you to declare a dynamic model in an Rogue Wave® Server application. Its role is similar to that of the class
IlsModelInterpreter, although dynamic types do not have a C++ implementation. Instances of such types are dynamic objects whose structure is built at runtime. Note that dynamic types, as well as their attributes, relations and member functions, are declared to the server model interpreter via the standard classes
IlsObjectType,
IlsAttributeDef,
IlsRelationDef and
IlsFunctionDef.
All the declaration functions described below return IlsFalse if the dynamic element cannot be declared or has already been declared to the server model interpreter, or IlsTrue otherwise.
Usually, the member functions of this class are called transparently from the XMI parser which loads the dynamic model to the server. You can call any of them before your dynamic server is initialized but not after the dynamic views and script files have been loaded.
Library
Synopsis
class IlsDynModelInterpreter
{
public:
static IlsBoolean
DeclType(const IlsString& typeNm);
const IlsString& rtParentType);
const IlsString& attributeNm);
(const IlsString& typeNm,
const IlsString& attrNm,
const IlsString& attrType,
const IlsString& defValue = IlsString::Null);
const IlsString& attrNm,
const IlsString& attrType);
(const IlsString& typeNm,
const IlsString& attrNm,
const IlsString& attrType,
const IlsString& defValue = IlsString::Null,
IlsBoolean staticScope = IlsFalse);
const IlsString& relationNm,
const IlsString& targetNm,
IlsRTTypes::RelationKind k,
IlsBoolean mandatory=IlsFalse);
const IlsString& invRelNm,
const IlsString& originNm,
const IlsString& relNm,
IlsRTTypes::RelationKind k);
static IlsBoolean
DeclFun(const IlsString& typeNm,
const IlsString& cbNm,
const IlsString& resType,
IlsString* params = 0,
int nbParam = 0,
IlsRTFunctionPtr cb=0);
(const IlsString& typeNm,
const IlsString& cbNm,
const IlsString& resType,
IlsString* params = 0,
int nbParam = 0,
const IlsString& scriptCode = IlsString::Null);
static IlsDynObject* IlsDynObject::
Narrow(IlsViewed& v);
const IlsString& relNm,
const IlsString& impl);
Member Functions
[static] IlsBoolean DeclType(const IlsString& typeNm);
Use this static member function to declare a dynamic class named typeNm to the runtime interpreter. If a static type exists with this name, the dynamic type is not declared.
[static] void DeclParentType(const IlsString& typeNm,
const IlsString& rtParentType);
This static member function can be used to declare an inheritance relationship between two types. The typeNm parameter must be the name of a dynamic type and the rtParentType parameter can be the name of either a dynamic or a static type. The parent type must have been declared to the runtime interpreter.
[static] IlsBoolean DeclIdentifier(const IlsString& typeNm,
const IlsString& attributeNm);
This static member function can be used to declare the
attributeNm attribute of the dynamic type
typeNm as the identifier attribute. The attribute type must be a string. When an identifier is declared for a type, instances of this type must comply with the rules set out for
IlsEntity object (see the macro
ILS_ENTITY_DECL). The virtual member function
IlsDynObject::setKeyIdentifier will be called just after dynamic objects have been created. If you choose to create such objects from an IBM ILOG Script script, you must provide an identifier as the argument.
[static] IlsBoolean DeclEntry(const IlsString& typeNm,
const IlsString& attrNm,
const IlsString& attrType,
const IlsString& defValue = IlsString::Null);
Use this static member function to declare a dynamic entry attribute for the dynamic class typeNm. The attrType parameter is the type name of the attribute. It can be a standard type or a user-defined type. The defValue argument is the default value of the dynamic attribute. It gets converted from the string to the actual type.
[static] IlsBoolean DeclDerived(const IlsString& typeNm,
const IlsString& attrNm,
const Ilsstring& attrType);
Use this static member function to declare a dynamic derived attribute for the dynamic class typeNm. To reevaluate this attribute, Rogue Wave Server will look up for a method in this class, or in a base class whose name is: <attrNm>_evaluate. See section Dynamic Member Functions in Chapter Dynamic Modeling Services of the Rogue Wave Server User’s Manual.
[static] IlsBoolean DeclAttribute(const IlsString& typeNm,
const IlsString& attrNm,
const IlsString& attrType,
const IlsString& defValue = IlsString::Null,
IlsBoolean staticScope = IlsFalse);
Use this static member function to declare a dynamic attribute for the dynamic class typeNm. This attribute is implemented as a standard IlsMvValue object. It is not reactive, which means that when the attribute value is changed, the subscribed views will not be notified.
The defValue argument is the default value of the dynamic attribute. It gets converted from the string to the actual type.
If the staticScope argument is set to IlsTrue, the attribute will be considered a static attribute of the dynamic type.
[static] IlsBoolean DeclRelation(const IlsString& typeNm,
const IlsString& relationNm,
const IlsString& targetNm,
IlsRTTypes::RelationKind k,
IlsBoolean mandatory=IlsFalse);
Use this static member function to declare a dynamic relation for the dynamic class
typeNm. The
targetTypeNm parameter is the target of this relation. It can be either a dynamic or a static type. The
k parameter is the type of the relation. Possible values for k are
ILS_OWNS_1/ILS_OWNS_N or
ILS_USES_1/ILS_USES_N. The
mandatory parameter indicates whether this unary relation is mandatory or not. (The parameter is not relevant for n-ary relations).
[static] IlsBoolean DeclInvRelation(const IlsString& typeNm,
const IlsString& invRelNm,
const IlsString& originNm,
const IlsString& relNm,
IlsRTTypes::RelationKind k);
Use this static member function to declare an inverse dynamic relation to the direct relation
relNm registered for the type
originNm,in the dynamic class
typeNm. The
k paremeter is the type of the relation. Possible values for
k are
ILS_INVERTED_1/
ILS_INVERTED_N. The type
originNm and the direct relation
relNm must also be declared to the runtime interpreter.
[static] IlsBoolean DeclFun(const IlsString& typeNm,
const IlsString& cbNm,
const IlsString& resType,
IlsString* params = 0,
int nbParam = 0,
IlsRTFunction cb=0);
Use this static member function to declare a dynamic member function for the dynamic class
typeNm. You can supply a C++ implementation of type
IlsRTFunction as the last argument to this method. If you do not, Rogue Wave Server will look for a corresponding IBM ILOG Script function.
[static] IlsBoolean DeclScriptFun(const IlsString& typeNm,
const IlsString& cbNm,
const IlsString& resType,
IlsString* params = 0,
int nbParam = 0,
const IlsString& scriptCode = IlsString::Null);
Use this static member function to declare a dynamic method for the dynamic class typeNm. You can supply an Rogue Wave Views Script implementation using the scriptCode argument. The Script implementation will be interpreted by the Rogue Wave Server Script Manager.
[static] IlsDynObject* IlsDynObject::Narrow(IlsViewed& v);
This static member function downcasts the viewed object to a dynamic object if its type has been registered as a dynamic type.
[static] void UseDictionary(const IlsString& typeNm, IlsBoolean);
This static member function declares a dynamic dictionary for the dynamic type typeNm. A dictionary must be declared on any type that has defined an identifier attribute.
[static] void SetRelationImpl(const IlsString& typeNm,
const IlsString& relNm,
const IlsString& impl);
This static member function declares an implementation for the dynamic relation relNm declared on the type typeNm. Correct values for the impl argument are pointer for unary relations, and set or list for n-ary relations.
See Also
Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.