Server
API Reference Guide
Product Documentation:

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

The class IlsEntity is a base class for classes declaring server data members: derived data members, entry data members, and relations. More...

#include <ilserver/model.h>

Inheritance diagram for IlsEntity:
IlsLockableEntity IlsMvUser IlsSafelyLockableEntity

Public Member Functions

 IlsEntity (IlsEntity &rhs)
 Copy constructor. The identifier is copied as well.
 
 IlsEntity (IlsIdentifier id, IlsActivity activity=IlsModel::GetDefaultActivity())
 
virtual ~IlsEntity ()
 Virtual destructor.
 
IlsActivity getActivity () const
 
Cutting Relations
virtual void cut (ILS_CUT_DIRECTIVE=ILS_ALL)
 
Identifiers
IlsIdentifier getIdentifier () const
 
virtual IlsString getKeyIdentifier () const
 
IlsEntitygetEntity ()
 
void rename (IlsIdentifier)
 
void setEntityContext (IlsEntityContext &)
 
void unsetEntityContext (IlsEntityContext &)
 
Notification
IlsBoolean isIdentifierModified ()
 During a notification phase, this member function returns IlsTrue if the entity identifier has been modified since the last notification phase.
 
IlsIdentifier getOldIdentifier ()
 During a notification phase, this member function returns the old identifier of the entity. It returns a null smart pointer if the entity has not been modified since the last notification phase.
 
IlsBoolean remove ()
 
IlsBoolean areUsersModified ()
 During a notification phase, this function returns IlsTrue if a use relation has been added or removed since the last notification phase. More...
 
void onRmFromDictionary ()
 During a notification phase, this member function returns IlsTrue if the entity identifier has been modified since the last notification phase.
 
void removeFromDictionaries ()
 During a notification phase, this member function returns IlsTrue if the entity identifier has been modified since the last notification phase.
 

Locking Entities

virtual IlsBoolean lock ()
 
virtual IlsBoolean unlock ()
 
virtual IlsBoolean trylock ()
 Tries to lock the entity. It returns IlsFalse if the operation fails.
 
virtual IlsBoolean isUpdateAllowed ()
 By default, this virtual member function returns IlsFalse when the entity is locked and IlsTrue if you have the right to modify the entity. It is called if the static member function IlsModel::SetUpdateChecked() returns IlsTrue.
 

Detailed Description

The class IlsEntity is a base class for classes declaring server data members: derived data members, entry data members, and relations.

Library: server

Instances of a class deriving from IlsEntity can be the target of a use relation, but cannot be the target of an ownership relation. This rule will be enforced at compile time.

See also
IlsException, IlsDerived, IlsEntry, IlsIdentifier, IlsModel, IlsObject, IlsOwns, IlsOwnsDynamicArray, IlsOwnsFixedArray, IlsOwnsList, IlsOwnsSet, IlsString, IlsUses, IlsUsesDynamicArray, IlsUsesFixedArray, IlsUsesList, IlsUsesSet, IlsViewed.

Constructor & Destructor Documentation

◆ IlsEntity()

IlsEntity::IlsEntity ( IlsIdentifier  id,
IlsActivity  activity = IlsModel::GetDefaultActivity() 
)

As its first argument, the constructor of an entity takes an identifier of type IlsIdentifier. This identifier behaves like an instance of IlsString and thus, like a character string. The identifier is stored in IlsEntity. Consequently, you just have to pass the identifier to the constructor of IlsEntity when deriving from this class.

The argument activity specifies whether the entity is active or not. An entry is active if its modification sets off the recomputation of derived data members. The default value is the one returned by the static member function IlsModel::GetDefaultActivity(), which is ILS_INACTIVE by default.

Member Function Documentation

◆ areUsersModified()

IlsBoolean IlsEntity::areUsersModified ( )

During a notification phase, this function returns IlsTrue if a use relation has been added or removed since the last notification phase.

These functions return IlsFalse by default. They are meant to be overridden.

◆ cut()

virtual void IlsEntity::cut ( ILS_CUT_DIRECTIVE  = ILS_ALL)
virtual
\short Cuts all the relations of which the entity is the target.

The argument supplied to this function is an enumerated type that provides the following three values:

  • ILS_ALL cuts all relations;
  • ILS_USE cuts use relations only. In the case of an entity, this value is equivalent to ILS_ALL;
  • ILS_OWNERSHIP cuts the ownership relation. This value does not apply to an entity.
Exceptions
IlsUpdateForbiddenIf the function isUpdateAllowed(), described below, returns IlsFalse.

◆ getActivity()

IlsActivity IlsEntity::getActivity ( ) const
\short Returns \c ILS_ACTIVE if the entity has been set

as active. Otherwise, it returns ILS_INACTIVE.

For details, see the constructor.

◆ getEntity()

IlsEntity* IlsEntity::getEntity ( )
\short Returns the identifier stored in the class

IlsEntity. Thus, you do not have to store this identifier in the derived type.

◆ getIdentifier()

IlsIdentifier IlsEntity::getIdentifier ( ) const
\short Returns the identifier stored in the class

IlsEntity. Thus, you do not have to store this identifier in the derived type.

◆ getKeyIdentifier()

virtual IlsString IlsEntity::getKeyIdentifier ( ) const
virtual
\short Returns the identifier stored in the class

IlsEntity. Thus, you do not have to store this identifier in the derived type.

Reimplemented from IlsViewed.

◆ lock()

virtual IlsBoolean IlsEntity::lock ( )
virtual
\short Locks the entity, and returns \c

IlsTrue once the entity is locked.

Reimplemented in IlsSafelyLockableEntity, and IlsLockableEntity.

◆ remove()

IlsBoolean IlsEntity::remove ( )
virtual
\short Overrides the function `IlsViewed::remove()`.

It removes the entity from each dictionary in which it is stored. Then, it calls the cut() function and notifies components that the entity is to be deleted. This function always returns IlsTrue.

Implements IlsViewed.

◆ rename()

void IlsEntity::rename ( IlsIdentifier  )
\short Renames the identifier stored in the class

IlsEntity. This function automatically maintains consistency in the dictionary containing the entity.

Exceptions
IlsUpdateForbiddenIf the function isUpdateAllowed returns IlsFalse.
IlsAlreadyInDictionaryIf the identifier passed as its argument is already contained in one of the dictionaries storing the entity.

◆ setEntityContext()

void IlsEntity::setEntityContext ( IlsEntityContext &  context)
\short Returns the identifier stored in the class

IlsEntity. Thus, you do not have to store this identifier in the derived type.

◆ unlock()

virtual IlsBoolean IlsEntity::unlock ( )
virtual
\short Unlocks the entity and returns \c

IlsTrue once the entity is unlocked.

Reimplemented in IlsSafelyLockableEntity, and IlsLockableEntity.

◆ unsetEntityContext()

void IlsEntity::unsetEntityContext ( IlsEntityContext &  context)
\short Returns the identifier stored in the class

IlsEntity. Thus, you do not have to store this identifier in the derived type.