Flip Reference

 

DocumentBase Class Reference

Namespace

ohm::flip

Declared in

ohm/flip/private/DocumentBase.h

Derived Classes

ohm::flip::DocumentClient

ohm::flip::DocumentServer

ohm::flip::DocumentLocal

Overview

The DocumentBase class implements a Flip document base class. The following sections will only document the public API.

Partial Class Diagram

Methods Overview

Casting

State

Constants Overview

The Controller enum constants are usually used in an observer document_changed call to know what was the source of the model control.

Methods

get_root

Returns the root object.

Object *       get_root ();
template <class T>
T &            get_root ();

The first version will return a pointer to an ohm::flip::Object .

The second version will return a reference to the root object, as seen as an T type, and will throw if dynamic casting fails.

get_object

Returns the object associated to the Flip reference number ref , or 0 if no object is associated to the Flip reference number ref .

Object *       get_object (Ref ref);
template <class T>
T *            get_object (Ref ref);

The first version will return a pointer to an ohm::flip::Object .

The second version will return a pointer object, as seen as an T type, and will return 0 if dynamic casting fails.

This function is usually used widely because it is a safe way to keep a reference to an object, as caching Flip object pointers is not safe.

WARNING:Caching a Flip object pointer is not safe. Any developer not following this rule shall be severly punished.

get_controller

Returns the current Controller of the document. The different meaning of those controllers are exposed below.

Controller     get_controller () const;

Constants

Controller

The Controller enum, which is in the scope of the DocumentBase class is exposed below.

Controller_SERVER

Indicates that the source of the model control is the server, that is the transaction was created and issued from the server.

Controller_SELF

Indicates that the source of the model control is the current Flip thread. In particular when only one Flip thread is used, this means that the source of the model control originated from the current client.

Controller_NETWORK_EXT

Indicates that the source of the model control is another client on the Flip network.

Controller_NETWORK_ACK

Indicates that the source of the model control is the server which validated succesfully the client transaction.

Note:this rarely occurs in practice

Controller_NETWORK_DENY

Indicates that the source of the model control is the server which rejected the client transaction, because either the structural validation or logical validation failed.

Controller_LOCAL

Indicates that the source of the model control is issued from the same Flip client, but from another Flip thread. In particular when only one Flip thread is used, this controller value is never set.

Controller_UNDO_REDO

Indicates that the source of the model control is issued from the Flip undo/redo system.

Controller_DOC_READ

Indicates that the source of the model control is the initial read of the document. This is the very first controller used and only one until the document is closed.

Controller_DOC_RELEASE

Indicates that the source of the model control is the final close of the document. This is the very last controller used and only one until some document is opened again.