Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

VXIMapHolder Class Reference
[Type library]

#include <VXIvalue.h>

List of all members.


Detailed Description

C++ wrapper class that makes it easier to work with VXIMaps.

Used correctly, this class can eliminate common memory leaks associated with VXIMap usage. For instance:

   VXIMap * GenerateMapFromParams(void)
   { 
     VXIMapHolder result;
     DoStuff();  // this code may throw an exception.
     return result.Release();
   }
If an exception is raised by the DoStuff function, the map will be cleaned up automatically when the stack is unwound. Likewise, the calling code may benefit:

   int Foo(void)
   {
     VXIMapHolder params(GenerateMapFromParams());
     ProcessParams(params);  // This code may throw an exception.
     return 0;
   }
If either an exception occurs or the function exits normally, the associated map will be freed.


Public Member Functions

 VXIMapHolder ()
 Creates an empty VXIMap.
 VXIMapHolder (VXIMap *m)
 Takes ownership of a VXIMap.
 ~VXIMapHolder ()
 Destorys owned VXIMap.
VXIMapHolderoperator= (const VXIMapHolder &x)
VXIMap * GetValue () const
 Returns the internal map.
VXIMap * Release ()
 Give up ownership of the contained VXIMap.
void Acquire (VXIMap *m)
 Acquires a new map, destroying the contained one first.
 VXIMapHolder (const VXIMapHolder &mh)
 Clones the contained map to a new VXIMapHolder.


Constructor & Destructor Documentation

VXIMapHolder::VXIMapHolder  )  [inline]
 

Creates an empty VXIMap.

VXIMapHolder::VXIMapHolder VXIMap *  m  )  [inline]
 

Takes ownership of a VXIMap.

Parameters:
m The VXIMap to own

VXIMapHolder::~VXIMapHolder  )  [inline]
 

Destorys owned VXIMap.

VXIMapHolder::VXIMapHolder const VXIMapHolder mh  )  [inline]
 

Clones the contained map to a new VXIMapHolder.


Member Function Documentation

void VXIMapHolder::Acquire VXIMap *  m  )  [inline]
 

Acquires a new map, destroying the contained one first.

VXIMap* VXIMapHolder::GetValue  )  const [inline]
 

Returns the internal map.

The standard map manipulation functions may then be used.

VXIMapHolder& VXIMapHolder::operator= const VXIMapHolder x  )  [inline]
 

VXIMap* VXIMapHolder::Release  )  [inline]
 

Give up ownership of the contained VXIMap.

This does not destroy the contained VXIMap. Rather, a a pointer is returned, and it is the callers responsibility to destroy the map.

Returns:
The contained VXIMap.


The documentation for this class was generated from the following file:
Generated on Wed Jun 1 12:50:19 2005 for OpenVXI by  doxygen 1.4.2