BaseContext Event Management Methods
[BaseContext Related Documentations]


Detailed Description

You can be notified of any change in the context with these Methods. This makes possible to build a complete user interface to edit the context.


Functions

void BaseContext::NotifyObjectChange (eVedaUpdate _UpDateType, BaseObject *_pObjectEdited, BaseType *_ObjectMember, const unsigned char *_PreviousShapeChunk=0L, unsigned int _PreviousShapeChunkLength=0L, const unsigned char *_NewShapeChunk=0L, unsigned int _NewShapeChunkLength=0L)
 Used by BaseObjects "%Set()" member methods to notify what happened when one of the member was edited, to change its value. It is used to manage the Undo/Redo capability. You should not use this method unless you create a PackSerializable base type and code it's Set() accessor.
void BaseContext::AddGUIUpdateFunction (void(*_func)(void *_GUIObjectToUpdateReturned, eVedaUpdate _updateType, BaseContext *_ContextUpdated, BaseObject *_ObjectUpdated, BaseType *_MemberUpdated), void *_GUIObjectToUpdate)
 You can specify one or more abstract GUI Views to update, by registering a function or a static method, that will be executed after each set() done on a member of a managed object, when editing, and even for a undo/redoes. This function will receive a const description of what was changed: the context concerned, the object concerned, and the object member concerned.
bool BaseContext::RemoveGUIUpdateFunction (void(*_func)(void *_GUIObjectToUpdateReturned, eVedaUpdate _updateType, BaseContext *_ContextUpdated, BaseObject *_ObjectUpdated, BaseType *_MemberUpdated))
 Remove an update function set by AddGUIUpdateFunction().
void BaseContext::UpdateAllGUI (eVedaUpdate _updateType, BaseObject *_ObjectUpdated, BaseType *_MemberUpdated)
 send an update function to all registered GUIs.
virtual bool BaseContext::AddOneLockForThreadUse ()
 Even in editable mode, only one thread owns a context and can edit, modify, use and destroy it. Other threads can just use its objects and methods through a AddOneLockForThreadUse() RemoveOneLockForThreadUse() pair. If false is returned, it means the lock can't be done, and you should wait a bit and retry. This way, it avoids cases where an object is modified by the owner thread and used by another.(For Example, the sound management thread of the Machines use it.) Add/RemoveOneLockForThreadUse() must only be used by other threads. Don't use RemoveOneLockForThreadUse() if false is returned.
virtual void BaseContext::RemoveOneLockForThreadUse ()
 Even in editable mode, only one thread owns a context and can edit, modify, use and destroy it. Other threads can just use its objects and methods through a AddOneLockForThreadUse() RemoveOneLockForThreadUse() pair. This is to avoid using an object which could be modified or destroyed by the owner thread. (it was made for sound management.).


Function Documentation

void AddGUIUpdateFunction void(*)(void *_GUIObjectToUpdateReturned, eVedaUpdate _updateType, BaseContext *_ContextUpdated, BaseObject *_ObjectUpdated, BaseType *_MemberUpdated)  _func,
void *  _GUIObjectToUpdate
[inherited]
 

You can specify one or more abstract GUI Views to update, by registering a function or a static method, that will be executed after each set() done on a member of a managed object, when editing, and even for a undo/redoes. This function will receive a const description of what was changed: the context concerned, the object concerned, and the object member concerned.

Parameters:
_func You must pass a function pointer on a static method pointer.
_GUIObjectToUpdate a user object of your choice that will be returned for this function, or NULL.

virtual bool AddOneLockForThreadUse  )  [virtual, inherited]
 

Even in editable mode, only one thread owns a context and can edit, modify, use and destroy it. Other threads can just use its objects and methods through a AddOneLockForThreadUse() RemoveOneLockForThreadUse() pair. If false is returned, it means the lock can't be done, and you should wait a bit and retry. This way, it avoids cases where an object is modified by the owner thread and used by another.(For Example, the sound management thread of the Machines use it.) Add/RemoveOneLockForThreadUse() must only be used by other threads. Don't use RemoveOneLockForThreadUse() if false is returned.

Note: you can't use BaseObject::Create() on an object from another thread. But you have to test isCreated() before using object's method, like in the main thread: isCreated() ensures the object is coherently inited.

void NotifyObjectChange eVedaUpdate  _UpDateType,
BaseObject _pObjectEdited,
BaseType _ObjectMember,
const unsigned char *  _PreviousShapeChunk = 0L,
unsigned int  _PreviousShapeChunkLength = 0L,
const unsigned char *  _NewShapeChunk = 0L,
unsigned int  _NewShapeChunkLength = 0L
[inherited]
 

Used by BaseObjects "%Set()" member methods to notify what happened when one of the member was edited, to change its value. It is used to manage the Undo/Redo capability. You should not use this method unless you create a PackSerializable base type and code it's Set() accessor.

Parameters:
_UpDateType eVedaUpdate enum that identify the update info type.
_pObjectEdited BaseObject if _UpDateType is about an object or member.
_ObjectMember BaseType if _UpDateType is about a member.
_PreviousShapeChunk optionnal serialization of the previous state or 0L.
_PreviousShapeChunkLength optionnal serialization of the previous state or 0L.
_NewShapeChunk optionnal serialization of the new state or 0L.
_NewShapeChunkLength optionnal serialization of the new state or 0L.

bool RemoveGUIUpdateFunction void(*)(void *_GUIObjectToUpdateReturned, eVedaUpdate _updateType, BaseContext *_ContextUpdated, BaseObject *_ObjectUpdated, BaseType *_MemberUpdated)  _func  )  [inherited]
 

Remove an update function set by AddGUIUpdateFunction().

Parameters:
_func the func pointer to remove.
Returns:
true if removed, false if unknown.

virtual void RemoveOneLockForThreadUse  )  [virtual, inherited]
 

Even in editable mode, only one thread owns a context and can edit, modify, use and destroy it. Other threads can just use its objects and methods through a AddOneLockForThreadUse() RemoveOneLockForThreadUse() pair. This is to avoid using an object which could be modified or destroyed by the owner thread. (it was made for sound management.).

void UpdateAllGUI eVedaUpdate  _updateType,
BaseObject _ObjectUpdated,
BaseType _MemberUpdated
[inherited]
 

send an update function to all registered GUIs.

Parameters:
the update case.
_ObjectUpdated the object updated in this context.
_MemberUpdated the member of the object updated.


      /\/\        4         N         k         !         N         D
                      _______  _ __ ___  _____            ___ _ _  ____
     ___________  __//___   /________  |/    / ___________\_______/    \
    /   _   _   \/   _     /    _   /      _/_/____/    _       __     /
   /    /   /       /     /    /    \      \/     /    /    \   \     /
  \\___/___/___/    ¯    _____/_____/       ______\___/_____/\________\\
               \________/_ ___ __ l____\      /elD!  
                 http://www.m4nkind.com \____/