Commit 161b882a authored by Jan Möbius's avatar Jan Möbius
Browse files

Added per object data documentation

git-svn-id: 383ad7c9-94d9-4d36-a494-682f7c89f535
parent a952f015
......@@ -33,7 +33,7 @@ can be used to identify which is the actual DataType, as the class BaseObject is
directly but only via derived classes.
Additionally the BaseObject class implements the PerObjectData system. You can append additional
data to each object in the scene via BaseObject::setObjectData() ( see \ref perObjectData ). This
data to each object in the scene via BaseObject::setObjectData() ( see \ref perObjectDataPage ). This
data will be handled by the core. You always have a container for the specific object, which also
gets destroyed, when the object itself gets destroyed.
/** \page perObjectData Per Object Data
/** \page perObjectDataPage Per Object Data
* TODO! Document per Object Data management.
* \section perObjectDataPage_Overview Overview
* To help developers organizing their data which belongs to specific objects, OpenFlipper provides the PerObjectData class.
* When you derive your classes from the PerObjectData base class, you can attach it to every object in the scene. This way
* OpenFlipper takes care of destructing the object, when the corresponding object gets removed and the developer has a permanent
* storage associated with the object.
* \section perObjectDataPage_CreatingPerObjectDatas Creating your own class
* To use the system, just derive your class from the PerObjectData base class:
* \code
* #include <OpenFlipper/common/perObjectData.hh>
* class DataClass : public PerObjectData
* {
* public :
* // Constructor
* DataClass();
* // Destructor
* ~DataClass();
* // Copy function (Implement this copy function to create a hard copy of your class)
* PerObjectData* copyPerObjectData();
* // Your data/functions
* };
* \endcode
* One important virtual function is the virtual PerObjectData::copyPerObjectData() function. In this function you have
* to create a hard copy of your class. This hard copy is used by OpenFlippers backup system to take a full snapshot
* of all Objects and their associated data. This way you can easily store your plugin state for a specific object in
* an PerObjectData. If the used than performs undo or redo operations, the attached data will also be switched and
* your states will be kept persistent with the current state of the object.
* \section perObjectDataPage_AttachingPerObjectDatas Attaching the per object data to objects in the scene.
* The corresponding functions are implemented in the BaseObject (\ref baseObjectPerObjectDataFunctions "here").
* The function to attach it is called BaseObject::setObjectData(). It gets a name(QString) which should start with the plugin
* name that generated the data and a reasonable description of the data. To get a pointer to a specific PerObjectDAta attached
* to the object, call BaseObject::objectData().
......@@ -147,5 +147,6 @@
* - \subpage objectDataStructure
* - \subpage OpenFlipperSceneGraph
* - \subpage OpenFlipperIterators
* - \subpage perObjectDataPage
* - \subpage adding_empty_objects
......@@ -441,6 +441,7 @@ class DLLEXPORTONLY BaseObject : public QObject {
/** @name Object Payload
* \anchor baseObjectPerObjectDataFunctions
* @{ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment