Server
API Reference Guide
Product Documentation:

Visualization Server
Documentation Home
List of all members | Public Member Functions
IlsDynObject Class Reference

This class is the default implementation of dynamic objects. More...

#include <ilserver/dynobj.h>

Inheritance diagram for IlsDynObject:
IlsObject

Public Member Functions

 IlsDynObject ()
 Builds a new dynamic object. More...
 
Initialization
virtual void initObject (const IlsString &typeNm, const IlsString &id=IlsString::Null)
 Initializes a dynamic object whose type is typeNm. More...
 
virtual void initObject (const IlsObjectType &, const IlsString &id=IlsString::Null)
 Must be called just after an object of type IlsDynObject (or of a subclass) has been created. More...
 
IlsBoolean isInitialized () const
 Returns IlsTrue if the dynamic object has been initialized. More...
 
virtual void afterInit ()
 Called just after the dynamic object has been initialized. More...
 
Object Type
const IlsObjectTypegetObjectType () const
 Returns the type associated with the dynamic object.
 
const IlsStringgetObjectTypeName () const
 Returns the name of the type for the dynamic object.
 
Identifiers
virtual void setKeyIdentifier (const IlsString &id)
 Assigns the value of the identifier attribute that has been declared to the server model interpreter. More...
 
virtual IlsString getKeyIdentifier () const
 Returns the value of the identifier attribute, if this identifier has been declared for the corresponding attribute type. Otherwise, it returns the null string. More...
 
virtual IlsString getIdentifier () const
 Assigns the value of the identifier attribute that has been declared to the server model interpreter. More...
 
Relations
virtual IlsViewedRelgetRelation (const IlsRelationDef *) const
 
IlsBoolean setRelTarget (const IlsString &relNm, IlsViewed *obj)
 Assigns the target of the dynamic unary relation relNm. More...
 
IlsViewedgetRelTarget (const IlsString &relNm) const
 Returns the target of the dynamic unary relation relNm.
 
IlsBoolean insertIntoRel (const IlsString &relNm, IlsViewed *obj)
 Inserts a new target in the dynamic n-ary relation relNm. More...
 
IlsBoolean extractFromRel (const IlsString &relNm, IlsViewed *obj)
 Extracts (and removes) the target obj from the dynamic n-ary relation relNm. More...
 
virtual IlsViewedgetElementFromRel (const IlsRelationDef *rel, const IlsString &id) const
 Retrieves the first object identified by the argument id from the relation identified by the rel argument. More...
 
IlsViewedgetElementFromRel (const IlsString &relNm, int index) const
 Returns the element located at position index in relation relNm. More...
 
virtual IlsViewedgetElementFromRel (const IlsRelationDef *rel, int index) const
 Returns the element located at position index in the relation identified by rel. More...
 
virtual IlsBoolean isElementInRel (const IlsRelationDef *rel, IlsViewed &target) const
 Returns IlsTrue if the target is in the relation. More...
 
IlsDynRelationgetDynRelation (const IlsString &relNm) const
 Returns the dynamic relation relNm or 0 if this relation does not exist.
 
Others
virtual IlsMvValue callFunction (const IlsString &funcName, IlsMvValue *args, int nbParam, IlsBoolean chkErr=IlsTrue)
 Invokes the function funcName with its arguments. More...
 
virtual void cut (ILS_CUT_DIRECTIVE d=ILS_ALL)
 Calls the Rogue Wave Views Script callback onCut() if exist and calls the base-class method if onCut() returns IlsTrue.
 
Dynamic Views

These virtual member functions are overriden from the parent class IlsObject. They invoke the corresponding Rogue Wave Views Script methods if they exist.

virtual IlsBoolean beginEdition (IlsMvView &, IlsRpUpdateType)
 This virtual member function (or the overriding one) is called on each Server object that is directly involved in a transaction triggered by a component on a dynamic view server (see IlsMvComponent::commitC2SCTransaction()). More...
 
virtual IlsBoolean endEdition (IlsMvView &, IlsRpUpdateType, IlsBoolean isRollback)
 This virtual member function (or the overriding one) is called on each server object that is directly involved in a transaction triggered by a component on a dynamic view server (see IlsMvComponent::commitC2SCTransaction()). More...
 
- Public Member Functions inherited from IlsObject
virtual ~IlsObject ()
 Virtual destructor.
 
IlsBoolean isInserted ()
 Indicates whether the object is owned or not.
 
IlsBoolean remove ()
 
virtual IlsBoolean lock ()
 Locks the object.
 
virtual IlsBoolean trylock ()
 
virtual IlsBoolean unlock ()
 Unlocks the object.
 
virtual IlsBoolean isUpdateAllowed ()
 
virtual IlsBoolean isUsePossible ()
 Locks the object.
 
virtual IlsBoolean isAlreadyInHierarchy (void *)
 Locks the object.
 
virtual IlsEntitygetEntity ()
 
void setEntityContext (IlsEntityContext &)
 Locks the object.
 
void unsetEntityContext (IlsEntityContext &)
 Locks the object.
 
IlsBoolean isOwnerModified ()
 During a notification phase, this member function returns IlsTrue if the owner of the object has changed since the last notification phase.
 
IlsBoolean areUsersModified ()
 During a notification phase, this member function returns IlsTrue if a use relation has been added or removed since the last notification phase.
 

Protected Member Functions

Protected Member Functions
void beforeRename (const IlsString &oldId, const IlsString &newId)
 Must be called from a subtype before the object identifier is renamed. More...
 
void afterRename (const IlsString &oldId, const IlsString &newId)
 Must be called from a subtype after the object identifier has been renamed.
 
void removeFromDictionary ()
 Removes a dynamic object from its dynamic dictionary, if such a dictionary exists.
 

Instantiation

IlsBoolean isInDictionary () const
 Returns IlsTrue if the object is stored in a dictionary. More...
 
static IlsDynObjectNewInstance (const IlsString &typeNm, const IlsString &identifier=IlsString::Null)
 Instantiates a dynamic object of the dynamic type typeNm. More...
 
static IlsDynObjectNarrow (const IlsString &typeNm, IlsViewed &)
 Performs a safe cast from an IlsViewed object to an instance of IlsDynObject if the object is a dynamic object and its dynamic type is typeNm or a subtype.
 
static IlsDynObjectGetInstance (const IlsString &typeNm, const IlsString &id)
 Retrieves an instance of the dynamic object that has been registered with the name id into the dictionary associated with the dynamic type. More...
 
static IlsBoolean UseDictionary (const IlsString &typeNm)
 Returns IlsTrue if the corresponding dynamic type holds a dictionary.
 

Attributes

IlsBoolean setAttributeValue (const IlsString &attrNm, const IlsMvValue &v)
 Assigns the value v to the attribute identified by the attrNm parameter. More...
 
IlsMvValue getAttributeValue (const IlsString &attrNm) const
 Retrieves the value of the attribute attrNm for this dynamic object. More...
 
IlsDynAttributegetDynAttribute (const IlsString &attrNm) const
 Returns the dynamic attribute attrNm or 0 if this attribute does not exist.
 
static IlsBoolean SetStaticAttributeValue (const IlsString &typeNm, const IlsString &attrNm, const IlsMvValue &)
 Sets the value of the static attribute attrNm for the dynamic type typeNm. More...
 
static IlsMvValue GetStaticAttributeValue (const IlsString &typeNm, const IlsString &attrNm)
 retrieves the value of the static attribute attrNm for the dynamic type typeNm.
 

Detailed Description

This class is the default implementation of dynamic objects.

Library: dynmvsvr

Dynamic objects are instances of dynamic classes declared to the runtime model interpreter. The class IlsDynObject provides a structure for the dynamic relations and attributes that have been declared for the dynamic type. This class must be the base class of all static types for which a dynamic subtype has been declared. A dynamic object is not meant to be used before it has been initialized by the member function initObject().

See section Inheritance from IlsDynobject in Chapter Dynamic Modeling Services of the Rogue Wave Server User's Guide for more information on how to declare dynamic types that inherit from static types.

See also
IlsDynAttribute, IlsDynModelInterpreter, IlsDynObjectFactory, IlsDynRelation

Constructor & Destructor Documentation

◆ IlsDynObject()

IlsDynObject::IlsDynObject ( )

Builds a new dynamic object.

However, it does not initialized it. To initialize the new dynamic object, you must call the member function initObject() on it.

Member Function Documentation

◆ afterInit()

virtual void IlsDynObject::afterInit ( )
virtual

Called just after the dynamic object has been initialized.

By default, this function calls the Rogue Wave Script callback afterInit() if it exists.

◆ beforeRename()

void IlsDynObject::beforeRename ( const IlsString oldId,
const IlsString newId 
)
protected

Must be called from a subtype before the object identifier is renamed.

See section Identified Objects in chapter Dynamic Modeling Services, in the Rogue Wave Server User's Guide.

◆ beginEdition()

virtual IlsBoolean IlsDynObject::beginEdition ( IlsMvView ,
IlsRpUpdateType   
)
virtual

This virtual member function (or the overriding one) is called on each Server object that is directly involved in a transaction triggered by a component on a dynamic view server (see IlsMvComponent::commitC2SCTransaction()).

It is called before these objects are modified. If the function returns IlsFalse, the transaction is rolled back both to the server and to the component.

This function takes two arguments:

  • The first one is a reference to the dynamic view through which the object is modified.
  • The second one indicates the type of modification that is carried out. This function returns IlsTrue but it can be overridden on the derived object types.

Reimplemented from IlsViewed.

◆ callFunction()

virtual IlsMvValue IlsDynObject::callFunction ( const IlsString funcName,
IlsMvValue args,
int  nbParam,
IlsBoolean  chkErr = IlsTrue 
)
virtual

Invokes the function funcName with its arguments.

When the chkErr argument is set to IlsTrue, an error message is generated if the Script implementation of this function is not found. Rogue Wave Server will search for a Script function named <object type name>_<funcName>().

◆ endEdition()

virtual IlsBoolean IlsDynObject::endEdition ( IlsMvView ,
IlsRpUpdateType  ,
IlsBoolean  isRollback 
)
virtual

This virtual member function (or the overriding one) is called on each server object that is directly involved in a transaction triggered by a component on a dynamic view server (see IlsMvComponent::commitC2SCTransaction()).

It is called once all the modifications are performed on these objects. If such a call returns IlsFalse, the transaction is rolled back on both the server and the component.

  • The first argument is a reference to the dynamic view through which the object is modified.
  • The second argument indicates the type of modification that is carried out, using the enumerated type IlsRpUpdateEnum. This function returns IlsTrue but it can be overridden on the derived object types.
  • When the value of the parameter isRollback is IlsTrue, this indicates that the current transaction is being rolled back.

Reimplemented from IlsViewed.

◆ extractFromRel()

IlsBoolean IlsDynObject::extractFromRel ( const IlsString relNm,
IlsViewed obj 
)

Extracts (and removes) the target obj from the dynamic n-ary relation relNm.

Returns
IlsFalse if the target cannot be extracted.

◆ getAttributeValue()

IlsMvValue IlsDynObject::getAttributeValue ( const IlsString attrNm) const

Retrieves the value of the attribute attrNm for this dynamic object.

Returns
void if the value cannot be retrieved.

◆ getElementFromRel() [1/3]

virtual IlsViewed* IlsDynObject::getElementFromRel ( const IlsRelationDef rel,
const IlsString id 
) const
virtual

Retrieves the first object identified by the argument id from the relation identified by the rel argument.

You can override this method to retrieve relation elements in your own subclass of IlsDynObject.

◆ getElementFromRel() [2/3]

virtual IlsViewed* IlsDynObject::getElementFromRel ( const IlsRelationDef rel,
int  index 
) const
virtual

Returns the element located at position index in the relation identified by rel.

Returns
null if index is greater than the length of the relation.

◆ getElementFromRel() [3/3]

IlsViewed* IlsDynObject::getElementFromRel ( const IlsString relNm,
int  index 
) const

Returns the element located at position index in relation relNm.

Returns
null if index is greater than the length of the relation.

◆ getIdentifier()

virtual IlsString IlsDynObject::getIdentifier ( ) const
virtual

Assigns the value of the identifier attribute that has been declared to the server model interpreter.

This function registers the object to the dynamic dictionary, if any, and calls the beforeRename() and afterRename() functions.

◆ GetInstance()

static IlsDynObject* IlsDynObject::GetInstance ( const IlsString typeNm,
const IlsString id 
)
static

Retrieves an instance of the dynamic object that has been registered with the name id into the dictionary associated with the dynamic type.

If the useDictionary property has been specified for the dynamic type, this type holds a dictionary and stores each instance in it. If the type does not hold any dictionary, the function looks up in a superclass for the instance.

◆ getKeyIdentifier()

virtual IlsString IlsDynObject::getKeyIdentifier ( ) const
virtual

Returns the value of the identifier attribute, if this identifier has been declared for the corresponding attribute type. Otherwise, it returns the null string.

This function is invoked when an object is stored in a dynamic set relation.

Note
Set relations can store only identified objects.

Reimplemented from IlsViewed.

◆ getRelation()

virtual IlsViewedRel* IlsDynObject::getRelation ( const IlsRelationDef ) const
virtual

Returns the implementation of the dynamic relation rel.

◆ initObject() [1/2]

virtual void IlsDynObject::initObject ( const IlsObjectType ,
const IlsString id = IlsString::Null 
)
virtual

Must be called just after an object of type IlsDynObject (or of a subclass) has been created.

This function has the following effects:

  1. It initializes the internal state of the dynamic object.
  2. It initializes the identifier attribute if such an attribute has been declared and if the argument id is not null.
  3. Finally, it calls the virtual member function afterInit(), documented below.

◆ initObject() [2/2]

virtual void IlsDynObject::initObject ( const IlsString typeNm,
const IlsString id = IlsString::Null 
)
virtual

Initializes a dynamic object whose type is typeNm.

See also
initObject(const IlsObjectType&, const IlsString&)

◆ insertIntoRel()

IlsBoolean IlsDynObject::insertIntoRel ( const IlsString relNm,
IlsViewed obj 
)

Inserts a new target in the dynamic n-ary relation relNm.

Returns
IlsFalse if the target cannot be added.

◆ isElementInRel()

virtual IlsBoolean IlsDynObject::isElementInRel ( const IlsRelationDef rel,
IlsViewed target 
) const
virtual

Returns IlsTrue if the target is in the relation.

Its behavior depends on whether the relation is dynamic or static.

◆ isInDictionary()

IlsBoolean IlsDynObject::isInDictionary ( ) const

Returns IlsTrue if the object is stored in a dictionary.

See also
removeFromDictionary().

◆ isInitialized()

IlsBoolean IlsDynObject::isInitialized ( ) const

Returns IlsTrue if the dynamic object has been initialized.

A dynamic object must be initialized by a call to the function initObject() before it can be manipulated.

◆ NewInstance()

static IlsDynObject* IlsDynObject::NewInstance ( const IlsString typeNm,
const IlsString identifier = IlsString::Null 
)
static

Instantiates a dynamic object of the dynamic type typeNm.

If the dynamic object is an identified object (in other words, if an identifier attribute has been declared for this type), the identifier is assigned by the identifier argument.

If the dynamic type inherits from a static type, the type of the instantiated object will be the first static type found in the inheritance path. If there is no static type in the inheritance path, the member function IlsDynObjectFactory::newInstance() is called to create a new dynamic object.

This function initializes the dynamic object by calling the function initObject() after instantiation.

◆ setAttributeValue()

IlsBoolean IlsDynObject::setAttributeValue ( const IlsString attrNm,
const IlsMvValue v 
)

Assigns the value v to the attribute identified by the attrNm parameter.

Returns
IlsFalse if the attribute does not belong to the associated type or if the value cannot be assigned.

◆ setKeyIdentifier()

virtual void IlsDynObject::setKeyIdentifier ( const IlsString id)
virtual

Assigns the value of the identifier attribute that has been declared to the server model interpreter.

This function registers the object to the dynamic dictionary, if any, and calls the beforeRename() and afterRename() functions.

◆ setRelTarget()

IlsBoolean IlsDynObject::setRelTarget ( const IlsString relNm,
IlsViewed obj 
)

Assigns the target of the dynamic unary relation relNm.

Returns
IlsFalse if the target cannot be set.

◆ SetStaticAttributeValue()

static IlsBoolean IlsDynObject::SetStaticAttributeValue ( const IlsString typeNm,
const IlsString attrNm,
const IlsMvValue  
)
static

Sets the value of the static attribute attrNm for the dynamic type typeNm.

Note that changing a static attribute does not trigger any notification. This function returns IlsTrue if the attribute value has been assigned.