Dynamic view class. More...
#include <ilserver/mvview.h>
Public Types | |
typedef signed char | Priority |
View notification priority. More... | |
Public Member Functions | |
IlsBoolean | isOpened () const |
Returns true if the view is opened, which means that a first notification cycle has been performed for this view. | |
virtual void | onSetInteractingView () |
Called by Rogue Wave Server when the view begins to process incoming requests from its associated component. | |
virtual void | onUnsetInteractingView () |
Called by Rogue Wave Server when the view finishes to process incoming requests from its associated component. | |
virtual void | setAckContext (const IlsMvValue *ackArgv, IlsCbArgNb ackArgc, IlsBoolean delOld=IlsTrue) |
Called after the view has been instantiated. More... | |
void | setTrace (IlsBoolean status=IlsTrue) |
Puts the view in trace mode if the status argument is true , otherwise, its cancels the trace mode. More... | |
View Parameters | |
The following functions handle the parameters of a dynamic view type. Note that these parameters are indexed starting from 0. | |
int | getParamIndex (IlsString label) |
Return the view parameter's index. More... | |
IlsBoolean | isParamModified (int id) |
Check parameter's modification since last notification phase. More... | |
IlsMvValue | getParamValue (int id) |
Get a parameter's value. More... | |
virtual IlsBoolean | setParamValue (int id, IlsMvValue &v) |
Sets a parameter's value. More... | |
Accessors | |
IlsMvComponentItf * | getComponent () const |
Returns the interface of the component that owns the representation associated with the view. | |
IlsRepresentationId | getRpId () const |
Returns the identifier of the representation * associated with the view. | |
IlsRpModel * | getRpModel () |
Returns a pointer to the dynamic representation model associated with the view. More... | |
virtual IlsMvUser * | getUser () |
Returns a pointer to the user object associated with the application component that opened the view. | |
Mapping | |
const IlsMvRef & | getCurrentRef () |
Returns a reference to the reference of the representation object that provoked the current editing operation. More... | |
IlsRpObjectId | getRpObjectId (IlsViewed &obj, IlsRpObjModelId modelId) const |
Gets representation object id associated with a server object. More... | |
IlsMvRef | getReference (IlsViewed &svrObj, IlsRpObjModelId modelId) const |
Gets a reference to a representation object of a server object. More... | |
IlsRpObjModelId | getObjModelId (IlsTypeId objTypeId, IlsString roModelNm) const |
Gets the identifier of the representationi object of a server object. More... | |
IlsSmartViewed | getSvObject (IlsRpObjectId rpId, IlsRpObjModelId modelId) |
IlsSmartViewed | getSvObject (IlsRpObjectId objId, IlsRpObjModelId modelId, IlsRpAttributeId attrId) |
Retrieves the Server object associated with an attribute of type reference or hyper-reference attached to a representation object. More... | |
IlsBoolean | isSubscribedObj (IlsViewed &o) |
Returns IlsTrue if the view subscribes to the object either directly or through relations. | |
IlsBoolean | isSubscribedRel (IlsViewedRel &r) |
Returns IlsTrue if the view subscribes to the relation. | |
IlsBoolean | unsubscribeObj (IlsViewed &o) |
Cancels the subscription of the view to the object. | |
IlsBoolean | unsubscribeRel (IlsViewedRel &r) |
Cancels the subscription of the view to the relation and to its target objects, if these objects are not subscribed to directly or through another relation. | |
View Origin | |
IlsViewed * | getMainOrigin () |
Returns the main origin of the view. More... | |
virtual IlsBoolean | setMainOrigin (IlsViewed *obj, IlsBoolean keepOldOrig=IlsFalse) |
Sets the main origin of the view. More... | |
IlsBoolean | isMainOrigin (IlsViewed &o) |
Checks if an object is the view main origin. More... | |
virtual IlsBoolean | addOrigin (IlsViewed &o) |
Adds the viewed o to the set of origins defined for the view. More... | |
virtual IlsBoolean | removeOrigin (IlsViewed &o) |
Removes the viewed object from the set of origins defined for the view. More... | |
IlsBoolean | isOrigin (IlsViewed &o) const |
Checks if an object is an origin of the view. More... | |
IlsViewed ** | getOrigins (int &nb) |
Gets all the origins of the view. More... | |
Notification | |
void | notifyBegin () |
Called before notification. More... | |
void | notifyEnd () |
Called after notification. More... | |
virtual void | notifyBeginSubCycle () |
Called before a notification subcycle. More... | |
virtual void | notifyEndSubCycle () |
Called after a notification subcycle. More... | |
IlsBoolean | enableNotification () |
Enables notification. More... | |
IlsBoolean | disableNotification () |
Disables notification. More... | |
IlsBoolean | isNotificationEnabled () |
Checks if notification is enabled. More... | |
Priority | |
IlsBoolean | setPriority (Priority pri) |
Sets the priority level of a view for notification. More... | |
Priority | getPriority () |
Returns the current priority level of a view. More... | |
Representation Status | |
The representation status is used to modify the representation of a Server object in a view. It can be referenced in a dynamic view type specification via the | |
IlsRpStatus | getRpStatus (IlsViewed &obj) |
Returns the representation status of a Server object in a view. More... | |
void | setRpStatus (IlsViewed &, IlsRpStatus status) |
Changes the representation status of a server object. More... | |
IlsBoolean | isRpStatusModified (IlsViewed &) |
Checks the modification of the representation status of a server object. More... | |
Buffer Mode | |
IlsBoolean | getBufferMode () const |
Returns IlsTrue if the view is in buffer mode. | |
IlsBoolean | setBufferMode (IlsBoolean incremental=IlsTrue) |
Puts the dynamic view in buffer mode. More... | |
IlsBoolean | resetBufferMode (IlsBoolean notify=IlsFalse) |
Cancels buffer mode when it has been previously set for the view. More... | |
IlsBoolean | synchronize () |
Cancels the buffer mode until the end of the next notification cycle for this view. More... | |
IlsRepresentationUpdate * | getBufferedUpdates () |
Returns the number of buffered updates for this view. | |
Closing a View | |
void | close (IlsBoolean notify=IlsTrue) |
Requests that the view be closed. More... | |
virtual IlsBoolean | closeIfNoOrigin () |
Called when the last origin of a view has been removed. More... | |
Public Member Functions inherited from IlsObject | |
virtual | ~IlsObject () |
Virtual destructor. | |
virtual void | cut (ILS_CUT_DIRECTIVE=ILS_ALL) |
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 IlsEntity * | getEntity () |
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 | |
IlsMvView (IlsMvComponentItf &compItf, IlsViewed *obj, const IlsMvViewType &vt, IlsMvValue *params, int nbParams) | |
Constructor. More... | |
virtual | ~IlsMvView () |
Destructor. More... | |
virtual void | onClose () |
Called after the view has been closed. More... | |
Friends | |
class | IlsMvServer |
class | IlsMvTimeManager |
Buffer Size | |
The following member functions enable a component to be notified in several messages instead of a single message at the end of the cycle. This is especially interesting to prevent the size of the server process from increasing significantly when notifying a view with a huge number of objects (especially during creation notification). | |
void | setUpdateBufferSize (unsigned int value) |
Sets the maximum number of object updates and attribute updates that can be buffered in the view during a notification cycle. More... | |
unsigned int | getUpdateBufferSize () |
Returns the maximum number of object updates and attribute updates that can be buffered in the view during a notification cycle. | |
static void | SetUpdateBufferSize (unsigned int value) |
Sets the default number of object updates and attribute updates that can be buffered in views during a notification cycle. More... | |
static unsigned int | GetUpdateBufferSize () |
Returns the default maximum number of object updates and attribute updates that can be buffered in a view during a notification cycle. | |
Dynamic view class.
Library: mvserver
Instances of the class IlsMvView
or of a derived class are called dynamic views. Each instance of IlsMvView
is configured by a dynamic view type specification and has an associated representation on the component side (see IlsRepresentation
). The class IlsMvView
is generally transparent to the user. It serves as an internal interface between the object system managed by the server and a representation managed by a component. It is documented to make it possible for you to subtype it (see the macros ILS_MVVIEW_DECL()
and ILS_MVVIEW_BEGIN()
/ILS_MVVIEW_END()
).
The class IlsMvView
implements notification functions whose purpose is to update the associated representation according to the contents of the dynamic view type specification. Notification functions use internal tables that map server objects to representation objects. IlsMvView
also handles the runtime parameters attached to the view, as well as the representation status of each Server object the view subscribes to.
IlsMvView
, IlsMvValue
, IlsRepresentation
, IlsRpModel
, IlsRpObject
, IlsViewed
.
|
protected |
Constructor.
Usually, the IlsMvView
constructor is not called directly by the user. It is called by Rogue Wave Server when a new dynamic view is opened either explicitly or implicitly when a hyper-reference is selected.
(See the functions IlsMvComponent::openView()
, IlsMvServer::OpenView()
, IlsRpObject::openView()
, and IlsRpObject::onDereference()
for details).
However, Rogue Wave Server allows you to associate an IlsMvView
subtype with a dynamic view type specification (see Dynamic View Types and C++ View Types in Chapter 2, Semantics of Dynamic View Type Specifications). In this case, the constructor of the IlsMvView
subtype must include the same parameters as above and pass their values to the IlsMvView
constructor.
IlsMvView::addOrigin()
and IlsMvView::removeOrigin()
.compItf | references the interface of the component that will create the representation of the view. |
obj | a pointer to the Server objects to which the view will subscribe as its main origin. If this pointer is null, the view will be created with no origin, and thus no representation will be associated with it until it subscribes to one origin object at least. |
vt | references the dynamic view type. This view type is an object created by Rogue Wave Server from a dynamic view type specification. The type IlsMvViewType is not documented because it is only used internally by Rogue Wave Server. |
params | an IlsMvValue value array. It can be null. The values contained in this array, if any, are sequentially assigned to the dynamic view parameters. If a value is void, it is discarded. |
nbParams | the number of parameters in the params value array. |
|
protectedvirtual |
Destructor.
The destructor of this class or of a derived class should never be called explicitly.
|
virtual |
Adds the viewed o to the set of origins defined for the view.
The view will notify its associated application component about the creation of a new origin during the next notification phase. This function always returns IlsTrue
unless it is called at exit. This member function has no effect if it is called within a transaction that is rolled back.
o | the object to add as origin |
IlsTrue
unless it is called at exit. void IlsMvView::close | ( | IlsBoolean | notify = IlsTrue | ) |
Requests that the view be closed.
notify
is set to IlsTrue
, the view is closed by the Rogue Wave Server notification engine during the next notification phase. Notification is carried out for each origin of the view. All objects to which the view subscribes is assigned the notification state ILS_NOTIFY_DELETION
. Once this notification phase is complete, mappings between Server objects and representation objects are removed and the virtual function IlsView::onClose
is called.notify
is set to IlsFalse
, the view is immediately closed and the mappings are removed.If the close()
member function is called during a transaction that has its notify
argument set to IlsTrue
and the transaction is rolled back, the member function has no effect. A view that is closed is automatically stopped.
notify | - If set to IlsTrue , the view is closed by the Rogue Wave Server notification engine during the next notification phase. Notification is carried out for each origin of the view. All objects to which the view subscribes is assigned the notification state ILS_NOTIFY_DELETION . Once this notification phase is complete, mappings between Server objects and representation objects are removed and the virtual function IlsView::onClose() is called.
|
|
virtual |
Called when the last origin of a view has been removed.
If it returns IlsTrue
– its default value – the view is closed.
IlsBoolean IlsMvView::disableNotification | ( | ) |
Disables notification.
This member function prevents the notification engine from calling the specific notification functions defined for the view. However, subscription to objects is updated as if the notification functions had been executed and had returned IlsTrue
.
IlsBoolean IlsMvView::enableNotification | ( | ) |
Enables notification.
This member function enables the notification engine to call the specific notification functions defined for the view. By default, notification is enabled.
const IlsMvRef& IlsMvView::getCurrentRef | ( | ) |
Returns a reference to the reference of the representation object that provoked the current editing operation.
This reference can be used as a parameter for a callback to a function previously declared on representation objects. See Callbacks to Member Functions and Callbacks to Global Functions in the class IlsMvEndPoint
, as well as the macro ILS_RP_MEMBER_FUNCTION()
for details.
IlsMvRef::isNull()
). IlsViewed * IlsMvView::getMainOrigin | ( | ) |
Returns the main origin of the view.
It is used to return the value of the runtime attribute origin
, which is defined for any dynamic views. See View Specification in Chapter 2, Semantics of Dynamic View Type Specifications.
IlsRpObjModelId IlsMvView::getObjModelId | ( | IlsTypeId | objTypeId, |
IlsString | roModelNm | ||
) | const |
Gets the identifier of the representationi object of a server object.
This function browses through the view specification abstract structure. Since this may noticeably affect the runtime cost, it is recommended to store the returned value rather that re-execute this function again and again with the same arguments.
objTypeId | server object type identifier |
roModelNm | name in the specification of the view type |
IlsViewed** IlsMvView::getOrigins | ( | int & | nb | ) |
Gets all the origins of the view.
nb | receive the size of the returned array |
delete []
. int IlsMvView::getParamIndex | ( | IlsString | label | ) |
Return the view parameter's index.
This member function takes a view parameter's label as its argument and returns the view parameter's index (the label of a view parameter is the one that appears in the dynamic view type specification). It returns -1 if no parameter was specified.
label | parameter's label |
IlsMvValue IlsMvView::getParamValue | ( | int | id | ) |
Get a parameter's value.
id | parameter's index |
idx
corresponds to no parameter. Priority IlsMvView::getPriority | ( | ) |
Returns the current priority level of a view.
Gets a reference to a representation object of a server object.
svrObj | server object the representation object is mapped to |
modelId | representation object model identifier |
IlsRpModel* IlsMvView::getRpModel | ( | ) |
Returns a pointer to the dynamic representation model associated with the view.
This pointer is never null, unless the view is being deleted.
IlsRpObjectId IlsMvView::getRpObjectId | ( | IlsViewed & | obj, |
IlsRpObjModelId | modelId | ||
) | const |
Gets representation object id associated with a server object.
obj | server object |
modelId | representation object model identifier |
IlsRpStatus IlsMvView::getRpStatus | ( | IlsViewed & | obj | ) |
Returns the representation status of a Server object in a view.
obj | the server object |
IlsSmartViewed IlsMvView::getSvObject | ( | IlsRpObjectId | objId, |
IlsRpObjModelId | modelId, | ||
IlsRpAttributeId | attrId | ||
) |
Retrieves the Server object associated with an attribute of type reference or hyper-reference attached to a representation object.
objId | specifies the identifier of the representation object |
modelId | the identifier of the representation object model |
attrId | the identifier of the attribute. |
IlsSmartViewed IlsMvView::getSvObject | ( | IlsRpObjectId | rpId, |
IlsRpObjModelId | modelId | ||
) |
/short Gets server object associated with a representation object.
rpId | representation object identifier |
modelId | object model identifier |
IlsBoolean IlsMvView::isMainOrigin | ( | IlsViewed & | o | ) |
Checks if an object is the view main origin.
o | the object |
IlsTrue
if the argument o is the view main origin. Otherwise, it returns IlsFalse
. IlsBoolean IlsMvView::isNotificationEnabled | ( | ) |
Checks if notification is enabled.
IlsTrue
if notification is enabled. IlsBoolean IlsMvView::isOrigin | ( | IlsViewed & | o | ) | const |
Checks if an object is an origin of the view.
o | the object to check |
IlsTrue
if the viewed object currently belongs to the set of origins defined for the view. Otherwise, it returns IlsFalse
. IlsBoolean IlsMvView::isParamModified | ( | int | id | ) |
Check parameter's modification since last notification phase.
id | parameter's index |
IlsTrue
if the parameter's id has been modified since the last notification phase. Otherwise, it returns IlsFalse
. IlsBoolean IlsMvView::isRpStatusModified | ( | IlsViewed & | ) |
Checks the modification of the representation status of a server object.
This member function returns IlsTrue
if the representation status of object
has been modified since the last notification phase.
void IlsMvView::notifyBegin | ( | ) |
Called before notification.
During an interaction cycle, Rogue Wave Server calls this virtual member function before the first notification is executed by the view. This function must be called by the notifyBegin()
overloaded function of any class derived from IlsMvView
before its own processing. If this function is not called at the beginning of the derived class overloaded function, the behavior is undefined.
|
virtual |
Called before a notification subcycle.
A notification cycle performs a set of steps and loops until all object updates are notified to the components (see IlsMvServer::Notify()
). Rogue Wave Server calls this virtual member function before the first notification operation is executed by the view in a notification subcycle.
This function is empty but it can be overridden.
void IlsMvView::notifyEnd | ( | ) |
Called after notification.
During an interaction cycle, Rogue Wave Server calls this virtual member function after the last notification operation has been executed by the view. This function must be called by the notifyEnd()
overloaded function of any class derived from IlsMvView
after its own processing. If this function is not called at the end of the derived class overloaded function, the behavior is undefined.
|
virtual |
Called after a notification subcycle.
This virtual member function is called by Rogue Wave Server after the last notification operation is executed by the view in a notification subcycle.
This function is empty but it can be overridden. It is useful if you have set view priorities (see IlsMvView::setPriority()
). It lets you complete a logical set of feedbacks on a representation without waiting for the end of the notification phase.
|
protectedvirtual |
Called after the view has been closed.
By default, it does nothing. For example, you can redefine this function to destroy a view after it has been closed, unless the view is running in its own thread. In this case, you can delete the view by overriding the virtual function onStop()
.
If you wish to override the function IlsMvView::onClose()
, you must call it from the overriding function.
|
virtual |
Removes the viewed object from the set of origins defined for the view.
The view will notify its associated application component about the deletion of this origin during the next notification phase. This member function always returns IlsTrue
unless it is called at exit. This function has no effect if it is called within a transaction that is rolled back.
o | the object to remove from origins |
IlsTrue
unless it is called at exit. IlsBoolean IlsMvView::resetBufferMode | ( | IlsBoolean | notify = IlsFalse | ) |
Cancels buffer mode when it has been previously set for the view.
Buffered updates will be sent to the component at the end of the next notification cycle concerning this view.
notify | if set to IlsTrue , the view is marked as modified so that a notification cycle for this view will be triggered during the next interaction cycle |
IlsTrue
|
virtual |
Called after the view has been instantiated.
It receives the contextual arguments ackArgv and ackArgc passed to the member function IlsMvComponent::openView()
on the component side. Rogue Wave Server resets these parameters after the method has been called. You should therefore override the method and copy the parameters if you want to keep them.
IlsBoolean IlsMvView::setBufferMode | ( | IlsBoolean | incremental = IlsTrue | ) |
Puts the dynamic view in buffer mode.
It means that all subsequent updates will be stored by the view until buffer mode is canceled by a call to the function resetBufferMode()
or synchronize()
.
incremental | if set to IlsTrue , only the latest update is kept. Otherwise, all updates are stored. |
IlsTrue
|
virtual |
Sets the main origin of the view.
obj | If not null, the function assigns the view main origin to the object pointed to by obj. Also, this object is added to the set of origins of the view (see IlsMvView::addOrigin() ). If this pointer is null, it only unsets the main origin. |
keepOldOrig | If set to IlsTrue , the old origin is kept as an origin of the view. If it is set to IlsFalse , the old origin is removed from the set of origins of the view (see IlsMvView::removeOrigin() ). |
IlsTrue
on success.
|
virtual |
Sets a parameter's value.
This member function sets the value of parameter idx
to a copy of v
.
id | parameter's index |
v | value copied into the parameter |
IlsTrue
on success. IlsBoolean IlsMvView::setPriority | ( | Priority | pri | ) |
Sets the priority level of a view for notification.
This priority level must range from PriorityMin
to PriorityMax
. The default value for a view is PriorityDefault
. The priority is used by the notification engine to determine the notification precedence order among views.
Let us assume we have three views V1, V2, V3 with respective priorities P1, P2, P3 such as P1 > P2 > P3. Notification takes place as follows:
IlsMvView::notifyBeginSubCycle()
and IlsViewServer::notifyEndSubCycle()
are called respectively at the beginning and at the end of each subcycle on the views involved, except on those that do not execute any notification operation.Since assigning priority levels increases the number of notification subcycles, it is recommended that this be done only when necessary.
pri | priority |
IlsFalse
if called during notification. In that case, the priority is not changed. void IlsMvView::setRpStatus | ( | IlsViewed & | , |
IlsRpStatus | status | ||
) |
Changes the representation status of a server object.
This member function assigns value
to the representation status of a Server object. If value
equals 0, subscription to the Server object is canceled automatically and the representations associated with this object is destroyed.
void IlsMvView::setTrace | ( | IlsBoolean | status = IlsTrue | ) |
Puts the view in trace mode if the status
argument is true
, otherwise, its cancels the trace mode.
status | trace mode |
void IlsMvView::setUpdateBufferSize | ( | unsigned int | value | ) |
Sets the maximum number of object updates and attribute updates that can be buffered in the view during a notification cycle.
When that limit is reached, the updates are automatically sent, triggering a notification transaction on the component side. The default value of 0 means no limit.
value | maximum number of possible buffered updates |
|
static |
Sets the default number of object updates and attribute updates that can be buffered in views during a notification cycle.
This number is used at view creation.
value | default number of maximum buffered updates. |
IlsBoolean IlsMvView::synchronize | ( | ) |
Cancels the buffer mode until the end of the next notification cycle for this view.
The view is marked as modified so that a notification cycle for this view will be triggered during the next interaction cycle.
IlsTrue