IdLocker Class Reference
[Public API]

Helper class to lock id of object when using assigment operator. More...

#include <idlocker.h>

List of all members.


Public Types

enum  mode { UNLOCKED, LOCKED, LOCKED_PRESERVE_STATE }
 Lock mode. More...

Public Member Functions

 IdLocker (mode pMode=LOCKED)
 Constructor.
 ~IdLocker ()
 Destructor.

Static Public Member Functions

static bool isLocked ()
 Check if locker is not in UNLOCKED state.
static bool isUnlocked ()
 Check if locker is in UNLOCKED state.

Detailed Description

Helper class to lock id of object when using assigment operator.

Id of all objects are locked until at least one locker exists, so this object should be created only on stack.

Example of use:

Storable a; //new object
Storeable b = loadFromDatabase(); //object with id

IdLocker locker;
b = a; // b still has its id


Member Enumeration Documentation

enum mode
 

Lock mode.

Enumerator:
LOCKED  Storeable object states are copied.
LOCKED_PRESERVE_STATE  Storeable object states are not copied.

Constructor & Destructor Documentation

IdLocker mode  pMode = LOCKED  ) 
 

Constructor.

Parameters:
pMode modify behaviour of Storeable copy constructor and assigment operator

Member Function Documentation

static bool isLocked  )  [static]
 

Check if locker is not in UNLOCKED state.

Returns:
true if locker is not in UNLOCKED state, false otherwise

static bool isUnlocked  )  [static]
 

Check if locker is in UNLOCKED state.

Returns:
true if locker is in UNLOCKED state, false otherwise

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

Documentation
Quick start
Examples
Search

API Documentation
Class hierarchy
Member index
API Reference
Store filters
Store table macros
Back

Generated by doxygen at Sun Nov 9 02:08:21 2008