Object Class Reference
Namespace | ohm::flip |
Declared in | ohm/flip/Object.h |
Derived Classes | |
Overview
The Object class implements the base class of all Flip managed classes. The following sections will only document the public API.
Partial Class Diagram

Methods Overview
State
- was_inited
- was_restored
- is_invalid
- has_conflict
- did_order_change
- did_parent_change
- get_order
- get_old_order
Navigating
Referencing Objects
Informations
Signaling
Methods
was_inited
In an document_changed observer call, returns true if the object was just inserted in the model, false otherwise.
bool was_inited () const; |
was_restored
In an document_changed observer call, returns true if the object was just erased from the model, false otherwise.
bool was_restored () const; |
Note:while being erased, the object is still valid in the model, and will be effectively erased after document_changed has returned
is_invalid
In an document_changed observer call, returns true if the object contains a modification, false otherwise.
bool is_invalid () const; |
The modification may be one of the members of the object, but may also be one of the elements of a container, if the class contains a container. Invalidation is recursive. As a matter of fact, the root class is always invalid when document_changed is called.
has_conflict
In an document_changed observer call, returns true if the object contains a conflict, false otherwise.
bool has_conflict () const; |
A conflict is triggered when a transaction is refused from the server, because it failed either the structural or logical validation.
The conflict may be one of the members of the object, but may also be one of the elements of a container, if the class contains a container. Conflicts are recursive. As a matter of fact, the root class is always conflict when document_changed is called with a refused transaction.
did_order_change
In an document_changed observer call, returns true if the object parent is a container, and the object order changed in its parent container, false otherwise.
bool did_order_change () const; |
did_parent_change
In an document_changed observer call, returns true if the object parent is a container, and the object parent container changed, false otherwise.
bool did_order_change () const; |
This function will only returns true when an object is moved from a container to another.
get_order
Returns the order of the object in its container.
If the object is being restored, or if the object parent is not a container, this function will return size_t (-1) .
size_t get_order () const; |
WARNING:it is invalid to call this function when the object is being restored
get_old_order
Returns the old order of the object in its container.
If the object is being restored, or if the object parent is not a container, this function will return size_t (-1) .
size_t get_old_order () const; |
WARNING:it is invalid to call this function when the object is being inited
use_document
Returns the document to which this object is attached.
DocumentBase & use_document () const; |
This function is usually used as a short hand to fetch the object associated to a flip::Ref reference.
get_ancestor
Searches recursively for the first parent of this of type T .
template <class T> |
T & get_ancestor (); |
This function will throw if no ancestor of type T can be found in the object ancestors.
This function is used very often to navigate the document. In particular if Root is the root class, get_ancestor <Root> () is a valid expression.
WARNING:it is invalid to call this function when the object is being restored
get_old_ancestor
Searches recursively for the first old parent of this of type T .
template <class T> |
T & get_old_ancestor (); |
This function will throw if no old ancestor of type T can be found in the old object ancestors.
WARNING:it is invalid to call this function when the object is being inited
reset_data
Reset the data associated to an object.
template <class T> |
void reset_data (T * ptr = 0); |
This function is used to link an unlimited number of referenced object of unique type to the flip Object.
It is used in two ways :
MyReferencedObject * ptr = new MyReferencedObject; |
reset_data (ptr); // bind referenced object of type MyReferencedObject |
reset_data <MyReferencedObject> (); // unbind referenced object of type MyReferencedObject |
Note:the client is responsible for releasing the object.
get_data
Retrieve the data associated to an object, or 0 if no data of the type is available.
template <class T> |
T * get_data () const; |
get_user_id
Convenient function that returns the user id number of an object (this value is actually contained in the reference of the object).
archi::Int32 get_user_id () const; |
is_self_created
Convenient function that returns true if this object was created by the user running this function, false otherwise.
bool is_self_created () const; |
send_signal
Send a signal to all the Flip threads of the running client. Returns true if the operation was successful, false otherwise.
bool send_signal (archi::UInt32 type, DataSPtr data_sptr = DataSPtr ()) const; |
- type is an arbitraty denoting the type of signal
- data_sptr is an arbitrary piece of data bundled in a shared pointer
Important:signals are not transactions and are therefore sent immediatly. This means that if a client ends a transaction and then send a signal, the signal is very likely to be received before the transaction. If ordering is important, use a Cue
send_signal_server
Send a signal to the server. Returns true if the operation was successful, false otherwise.
bool send_signal (archi::UInt32 type, DataSPtr data_sptr = DataSPtr ()) const; |
- type is an arbitraty denoting the type of signal
- data_sptr is an arbitrary piece of data bundled in a shared pointer