Guiliani  Version 2.5 revision 7293 (documentation build 13)
CGUIDeleteNotification Class Reference

Class that sets a local variable to True if the object has been deleted. More...

#include <GUIDeleteNotification.h>

Inheritance diagram for CGUIDeleteNotification:

Public Member Functions

 CGUIDeleteNotification ()
 CGUIDeleteNotification constructor.
 
virtual ~CGUIDeleteNotification ()
 

Protected Member Functions

void InitDeletedFlag (eC_Bool &bDeleted)
 
void ResetDeletedFlag ()
 Resets the internal flag pointer to NULL.
 

Detailed Description

Class that sets a local variable to True if the object has been deleted.

When using this helper class, create a local eC_Bool variable bDeleted and call InitDeletedFlag() with this variable as the parameter. If the instance of this class gets deleted (the dtor is called), the local variable will be set to true; if the local variable has been set to true the method should return immediately, especially without accessing any variables that are not allocated on its local stack.

Only if the object has not been deleted, call ResetDeletedFlag().

Example:

class MyClass : protected CGUIDeleteNotification
{
void DoSomething()
{
eC_Bool bDeleted;
InitDeletedFlag(bDeleted);
foo(); // this call may delete "this" object
if (!bDeleted) // the flag has been set to true only if the object was deleted
{
DoSomethingElse();
}
}
void DoSomethingElse();
}
Class that sets a local variable to True if the object has been deleted.
Definition: GUIDeleteNotification.h:51
void InitDeletedFlag(eC_Bool &bDeleted)
Definition: GUIDeleteNotification.h:74
void ResetDeletedFlag()
Resets the internal flag pointer to NULL.
Definition: GUIDeleteNotification.h:81

Constructor & Destructor Documentation

◆ ~CGUIDeleteNotification()

virtual CGUIDeleteNotification::~CGUIDeleteNotification ( )
inlinevirtual

Destructor. If a flag has been set via InitDeletedFlag(), its value is set to true at this moment.

Member Function Documentation

◆ InitDeletedFlag()

void CGUIDeleteNotification::InitDeletedFlag ( eC_Bool &  bDeleted)
inlineprotected

Initializes the given flag to false and stores a pointer to it.

Parameters
bDeletedFlag indicating deletion.

The documentation for this class was generated from the following file: