#include <PackObjectReference.h>
Inherits PackULong.
Inherited by InterfacePrefObject::PackObjectReferenceSpecial.
#include "myClass.h" #include "VirtualImage.h" myClass::myClass() : BaseObject() { REGISTER_MEMBER_REFERENCE( m_MyImagePointer,"the Reference",VirtualImage::m_Description ); }
void myClass::myMethodThatUsesImages(void) { // PackObjectReference ensures that the pointer can be casted to that class: VirtualImage *pImage = (VirtualImage *) m_MyImagePointer.GetObjectPointer(); if(pImage != NULL) { // you can use pImage here. } }
Definition at line 50 of file PackObjectReference.h.
Public Types | |
enum | enum_SetReferenceResult { eSetRef_SetOK = 0, eSetRef_BadReferenceInit_ShouldntHappen, eSetRef_ObjectFromOtherContext, eSetRef_ObjectClassDoesntMatch, eSetRef_CantReferObjectThatReferThisOne } |
enum | eVedaUpdate { eVedaUpdate_NoUpdate = 0, eVedaUpdate_MemberIsGoingToChange, eVedaUpdate_MemberChanged, eVedaUpdate_MemberChangedBecauseOfUndo, eVedaUpdate_MemberDestroyed, eVedaUpdate_ObjectNew, eVedaUpdate_ObjectDestroyed, eVedaUpdate_ObjectReCreated, eVedaUpdate_ObjectClosed, eVedaUpdate_NewRegisteredClass } |
enum used by BaseContext::NotifyObjectChange() to describe the notification meaning. Used by interfaces to monitor a context. More... | |
Public Member Functions | |
PackObjectReference () | |
Constructor. Each PackObjectReference refers to an object instancied from a given class, or from an inherited class. | |
virtual | ~PackObjectReference (void) |
Destructor. | |
BaseObject * | GetObjectPointer () const |
Get the object refered. If it exists and has a right class type, Get will return the object. Else, Get would return NULL. You should get your objects one time by method, and never stock what you get, because it could be destroyed or closed between two method calls. | |
virtual enum_SetReferenceResult | SetObjectPointer (BaseObject *_Object) |
Set the pointed object, from the same context. If it exists and has a right class type, It will be set as the refered object, and GetObjectPointer() will return the object. Else, it would return NULL. This Method is only compiled in editable mode. In non editable mode, a shorter version is compiled. | |
void | SetReferableBaseClass (const BaseObject::ClassDescription &_classDescription) |
Set the kind of class of object that we will be able to refer. Is only possible in editable mode. In read-only mode, the referable type is implicit. It can only be done once. | |
const BaseObject::ClassDescription & | GetReferableBaseClass () |
Get the kind of class of object that we will be able to refer. Is only possible in editable mode. In read-only mode, the referable type is implicit. | |
virtual unsigned int | GetSerializedDescriptionSize (void) |
get the size of the whole byte chunk that will be written by Serialize_Out(). | |
virtual unsigned char * | Serialize_Out (unsigned char *_pDescriptionChunkToFill) |
write the Current object definition to a Chunk using private packed types, recursively. | |
virtual const char * | GetClassID () const |
Each BaseType's inherited classes must explicit an ID for their class, or let use one of the super class at least through this virtual method. This is needed by GUIs to detect the types of each sub-members, and shape an interface for each Object according to their member list. | |
virtual const char * | ValueToString () |
convert the value of this object to an explicit string. The object manages the string privately, so just read it or copy it. the string would be destroyed with the objects, and changed when using Set() methods. Note: this is not virtual, but each class can manage m_pValueString or not. | |
PackObjectReference * | GetNextSelfReferenceNode () |
Used to scan the list of all reference to an object (which start is in BaseObject):. | |
PackObjectReference ** | GetPointerOnNextObjectReferenceInContextList () |
Set the kind of class of object that we will be able to refer. Is only possible in editable mode. In read-only mode, the referable type is implicit. It can only be done once. | |
virtual void | SetObjectThatManagesThis (BaseObject *_pManager) |
The Object this one belong to as a member. Should only be used at init. | |
void | UpdateSerializedID (void) |
Update Reference To Unique Index. It is used by context serialization. | |
virtual const unsigned char * | Serialize_In (const unsigned char *_pDescriptionChunk) |
Read the object description from a byte chunk. Could crash if chunk not valid. | |
virtual void | Set (unsigned int _value) |
change the value: | |
unsigned int | Get () const |
Get the value. | |
void | operator+= (unsigned int _value) |
change the value: | |
virtual unsigned int | WriteFile (const char *_pFileName) |
write a serialized form, using GetSerializedDescriptionSize() and Serialize_Out(). | |
virtual unsigned int | ReadFile (const char *_pFileName) |
Try to read a serialized form, using Serialize_In(). | |
void | SetMemberName (const char *_MemberName) |
Explicits the name of an object when used as a class member. It exists only in editable mode, and then can be used by any GUI. A member with an infoString not NULL, should be drawn in a GUI and receive updates. an object member with GetMemberName() returning NULL should not be edited by an interface or undo-managed. Use REGISTER_MEMBER macros family: it registers the members and use SetMemberName() automatically (or not, according to the compilation mode). | |
const char * | GetMemberName () const |
Explicits the name of an object when used as a class member. It exists only in editable mode, and then can be used by any GUI. A member with an infoString not NULL, should be drawn in a GUI and receive updates. an object member with GetMemberName() to NULL should not be edited by an interface or undo-managed. set with SetMemberName(). | |
void | SetMemberInfo (const char *_MemberInfo) |
Explicits the use of an object when used as a class member. It should explain what the member does for the object. It exists only in editable mode,and can be used by any GUI. Don't use html tags , only \n are allowed. Use REGISTER_MEMBER_INFO macro after the REGISTER_MEMBER macro in the constructors. It can be left NULL. | |
const char * | GetMemberInfo () const |
Explicits the use of an object when used as a class member. It exists only in editable mode and can be used by any GUI. It should explain what the member does for the object. | |
BaseObject * | GetObjectThatManagesThis () |
If there is any, get the object that manages this one as a member. | |
void | MakeCloneOf (BaseType &_ModelObject) |
Tool that makes an object take the values of another using serialization. Use with care: You got to clone a PackUlong with a PackULong, a PackString with a PackString: Clone Object of the same type or it will crash . A test is done at the beginning to check that for both types are the sames, if not it does nothing. however it may still crash with 2 objects from unherited classes. Also, some type like PackObjectReference, will not clone its value by copying a pointer.Reference member clonage is done with BaseObject::Clone(). | |
Protected Member Functions | |
void | CloseReference () |
protected. Declare that the previous reference state is closed. equivalent to Set(0L); | |
void | BeginChangeNotification () |
In edition mode, when a member of an object is changed (like in a Set()), you got to use BeginChangeNotification(), make your changes, and then EndChangeNotification(), so that the edition of this object and member is known by the context, and allows it to manage a GUI update and the undo stack. | |
void | EndChangeNotification () |
In edition mode, when a member of an object is changed (like in a Set()), you got to use BeginChangeNotification(), make your changes, and then EndChangeNotification(), so that the edition of this object and member is known by the context, and allows it to manage a GUI update and the undo stack. | |
Protected Attributes | |
BaseObject * | m_pReferedObject |
the objects refered. If destroyed in editablemode, become null. | |
const BaseObject::ClassDescription * | m_ReferableclassDescription |
copy of the object name referenced. It is not serialized. | |
PackObjectReference * | m_pNextSelfReferenceNode |
in editable mode, chain list which start is in BaseObject, and list all the reference to the object. | |
PackObjectReference * | m_pNextObjectReferenceInContextList |
chain list which start is in BaseContext, and list all the references to the object for the whole context. | |
unsigned int | m_value |
BaseObject * | m_pObjectThatManagesThis |
an object can belong (or not) to a BaseObject,( and to a BaseContext through it). | |
const char * | m_pMemberName |
If used as a member in an object, the member name, or NULL (not editable member). | |
const char * | m_pMemberInfo |
a short string explaining what's the object for in editable mode. OK if NULL (no info). | |
PackString * | m_pValueString |
a string standing for an expression of the value of the object: | |
unsigned char * | m_pPreviousValueShape |
used as a temp for object change notification in Begin/EndChangeNotification(): | |
unsigned int | m_PreviousValueShapeLength |
|
Result enum returned by SetObjectPointer()
Definition at line 78 of file PackObjectReference.h. |
|
enum used by BaseContext::NotifyObjectChange() to describe the notification meaning. Used by interfaces to monitor a context.
Definition at line 194 of file BaseType.h. |
|
Constructor. Each PackObjectReference refers to an object instancied from a given class, or from an inherited class.
|
|
Destructor.
|
|
In edition mode, when a member of an object is changed (like in a Set()), you got to use BeginChangeNotification(), make your changes, and then EndChangeNotification(), so that the edition of this object and member is known by the context, and allows it to manage a GUI update and the undo stack.
|
|
protected. Declare that the previous reference state is closed. equivalent to Set(0L);
|
|
In edition mode, when a member of an object is changed (like in a Set()), you got to use BeginChangeNotification(), make your changes, and then EndChangeNotification(), so that the edition of this object and member is known by the context, and allows it to manage a GUI update and the undo stack.
|
|
Get the value.
Definition at line 89 of file PackULong.h. References PackULong::m_value. Referenced by PackULong_Flags::AddFlags(), NamedObject::GetChunkLength(), BaseObject::GetUniqueReference(), InterfacePrefObject::IsActive(), and PackULong_Flags::RemoveFlags(). |
|
Each BaseType's inherited classes must explicit an ID for their class, or let use one of the super class at least through this virtual method. This is needed by GUIs to detect the types of each sub-members, and shape an interface for each Object according to their member list.
Reimplemented from PackULong. Definition at line 145 of file PackObjectReference.h. |
|
Explicits the use of an object when used as a class member. It exists only in editable mode and can be used by any GUI. It should explain what the member does for the object.
Definition at line 144 of file BaseType.h. References BaseType::m_pMemberInfo. |
|
Explicits the name of an object when used as a class member. It exists only in editable mode, and then can be used by any GUI. A member with an infoString not NULL, should be drawn in a GUI and receive updates. an object member with GetMemberName() to NULL should not be edited by an interface or undo-managed. set with SetMemberName().
Definition at line 123 of file BaseType.h. References BaseType::m_pMemberName. |
|
Used to scan the list of all reference to an object (which start is in BaseObject):.
Definition at line 161 of file PackObjectReference.h. |
|
Get the object refered. If it exists and has a right class type, Get will return the object. Else, Get would return NULL. You should get your objects one time by method, and never stock what you get, because it could be destroyed or closed between two method calls.
Definition at line 74 of file PackObjectReference.h. References m_pReferedObject. |
|
If there is any, get the object that manages this one as a member.
Definition at line 170 of file BaseType.h. References BaseType::m_pObjectThatManagesThis. |
|
Set the kind of class of object that we will be able to refer. Is only possible in editable mode. In read-only mode, the referable type is implicit. It can only be done once.
Definition at line 169 of file PackObjectReference.h. |
|
Get the kind of class of object that we will be able to refer. Is only possible in editable mode. In read-only mode, the referable type is implicit.
|
|
get the size of the whole byte chunk that will be written by Serialize_Out().
Reimplemented from PackULong. |
|
Tool that makes an object take the values of another using serialization. Use with care: You got to clone a PackUlong with a PackULong, a PackString with a PackString: Clone Object of the same type or it will crash . A test is done at the beginning to check that for both types are the sames, if not it does nothing. however it may still crash with 2 objects from unherited classes. Also, some type like PackObjectReference, will not clone its value by copying a pointer.Reference member clonage is done with BaseObject::Clone().
|
|
change the value:
Definition at line 94 of file PackULong.h. References PackULong::m_value. |
|
Try to read a serialized form, using Serialize_In().
|
|
Read the object description from a byte chunk. Could crash if chunk not valid.
Implements BaseType. |
|
write the Current object definition to a Chunk using private packed types, recursively.
Reimplemented from PackULong. |
|
change the value:
Reimplemented in InterfacePrefObject::PackULong_Flags_Activate. Referenced by PackULong_Flags::AddFlags(), PackULong_Flags::RemoveFlags(), and BaseObject::SetUniqueReference(). |
|
Explicits the use of an object when used as a class member. It should explain what the member does for the object. It exists only in editable mode,and can be used by any GUI. Don't use html tags , only \n are allowed. Use REGISTER_MEMBER_INFO macro after the REGISTER_MEMBER macro in the constructors. It can be left NULL.
|
|
Explicits the name of an object when used as a class member. It exists only in editable mode, and then can be used by any GUI. A member with an infoString not NULL, should be drawn in a GUI and receive updates. an object member with GetMemberName() returning NULL should not be edited by an interface or undo-managed. Use REGISTER_MEMBER macros family: it registers the members and use SetMemberName() automatically (or not, according to the compilation mode).
|
|
Set the pointed object, from the same context. If it exists and has a right class type, It will be set as the refered object, and GetObjectPointer() will return the object. Else, it would return NULL. This Method is only compiled in editable mode. In non editable mode, a shorter version is compiled.
Reimplemented in InterfacePrefObject::PackObjectReferenceSpecial. Referenced by MediaAccess::SetBootMedia(), and MediaAccess::SetMainMedia(). |
|
The Object this one belong to as a member. Should only be used at init.
Reimplemented from BaseType. |
|
Set the kind of class of object that we will be able to refer. Is only possible in editable mode. In read-only mode, the referable type is implicit. It can only be done once.
|
|
Update Reference To Unique Index. It is used by context serialization.
Definition at line 181 of file PackObjectReference.h. |
|
convert the value of this object to an explicit string. The object manages the string privately, so just read it or copy it. the string would be destroyed with the objects, and changed when using Set() methods. Note: this is not virtual, but each class can manage m_pValueString or not.
Reimplemented from PackULong. |
|
write a serialized form, using GetSerializedDescriptionSize() and Serialize_Out().
|
|
a short string explaining what's the object for in editable mode. OK if NULL (no info).
Definition at line 259 of file BaseType.h. Referenced by BaseType::GetMemberInfo(). |
|
If used as a member in an object, the member name, or NULL (not editable member).
Definition at line 255 of file BaseType.h. Referenced by BaseType::GetMemberName(). |
|
chain list which start is in BaseContext, and list all the references to the object for the whole context.
Definition at line 209 of file PackObjectReference.h. |
|
in editable mode, chain list which start is in BaseObject, and list all the reference to the object.
Definition at line 205 of file PackObjectReference.h. |
|
an object can belong (or not) to a BaseObject,( and to a BaseContext through it).
Definition at line 251 of file BaseType.h. Referenced by BaseType::GetObjectThatManagesThis(). |
|
used as a temp for object change notification in Begin/EndChangeNotification():
Definition at line 269 of file BaseType.h. |
|
the objects refered. If destroyed in editablemode, become null.
Definition at line 185 of file PackObjectReference.h. Referenced by GetObjectPointer(). |
|
a string standing for an expression of the value of the object:
Definition at line 264 of file BaseType.h. |
|
copy of the object name referenced. It is not serialized. The name of the class of an object this reference can refer. Should never be null. Note: it is took and pointed to an BaseObject static member, not copied in any way. It shoud be OK. Definition at line 202 of file PackObjectReference.h. |
|
the value of this class: Note that it will be trunked to 256Mb-1 maximum at serialization! Definition at line 94 of file PackULong.h. Referenced by PackULong::Get(), PackULong::operator+=(), PackULong_RandomSeed::Reset(), and PackULong_Flags::TestFlags(). |
/\/\ 4 N k ! N D _______ _ __ ___ _____ ___ _ _ ____ ___________ __//___ /________ |/ / ___________\_______/ \ / _ _ \/ _ / _ / _/_/____/ _ __ / / / / / / / \ \/ / / \ \ / \\___/___/___/ ¯ _____/_____/ ______\___/_____/\________\\ \________/_ ___ __ l____\ /elD! http://www.m4nkind.com \____/