gpucalc::Object::Any Class Reference

List of all members.

Public Member Functions

 Any (const Any &any)
 Any (void *from, size_t size)
 Any (size_t size)
 Any ()
void copyValue (void *To)
Anyoperator= (const Any &any)
 ~Any ()

Private Member Functions

void destroy ()
void release ()
void swap (Any &other)

Private Attributes

void * mPointer
size_t mSize
size_t * mUseCount


Detailed Description

Definition at line 147 of file object.h.


Constructor & Destructor Documentation

gpucalc::Object::Any::Any (  )  [inline]

Definition at line 150 of file object.h.

00150           : mPointer(0), mSize(0), mUseCount(0)
00151      {
00152      }

gpucalc::Object::Any::Any ( size_t  size  )  [inline]

Definition at line 155 of file object.h.

00155                      : mPointer(0), mSize(size),mUseCount(0)
00156      {
00157       mPointer = malloc(size);
00158       mUseCount = new size_t(1);
00159      }

gpucalc::Object::Any::Any ( void *  from,
size_t  size 
) [inline]

Definition at line 162 of file object.h.

00162                                   : mSize(size)
00163      {
00164       mPointer = malloc(size);
00165       memcpy(mPointer, from, size);
00166       mUseCount = new size_t(1);
00167      }

gpucalc::Object::Any::Any ( const Any any  )  [inline]

Definition at line 170 of file object.h.

00170                          : mPointer(any.mPointer), mSize(any.mSize), mUseCount(any.mUseCount)
00171      {
00172       if (mUseCount)
00173       {
00174        ++(*mUseCount);
00175       }
00176      }

gpucalc::Object::Any::~Any (  )  [inline]

Definition at line 194 of file object.h.

00195      {
00196       release();
00197      }


Member Function Documentation

void gpucalc::Object::Any::copyValue ( void *  To  )  [inline]

Definition at line 200 of file object.h.

00201      {
00202       memcpy(To, mPointer, mSize);
00203      }

void gpucalc::Object::Any::destroy (  )  [inline, private]

Definition at line 225 of file object.h.

00226      {
00227       free(mPointer);
00228       mSize = 0;
00229       delete mUseCount;
00230      }

Any& gpucalc::Object::Any::operator= ( const Any any  )  [inline]

Definition at line 179 of file object.h.

00180      {
00181       if (mPointer == any.mPointer)
00182       {
00183        return *this;
00184       }
00185       else
00186       {
00187        Any tmp(any);
00188        swap(tmp);
00189        return *this;
00190       }
00191      }

void gpucalc::Object::Any::release (  )  [inline, private]

Definition at line 212 of file object.h.

00213      {
00214       if (mUseCount)
00215       {
00216        if (--(*mUseCount) == 0)
00217        {
00218         destroy();
00219        }
00220       }
00221 
00222      }

void gpucalc::Object::Any::swap ( Any other  )  [inline, private]

Definition at line 233 of file object.h.

00234      {
00235       std::swap(mPointer, other.mPointer);
00236       std::swap(mSize, other.mSize);
00237       std::swap(mUseCount, other.mUseCount);
00238      }


Member Data Documentation

Definition at line 207 of file object.h.

size_t gpucalc::Object::Any::mSize [private]

Definition at line 208 of file object.h.

Definition at line 209 of file object.h.


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

Generated on Thu Mar 5 22:36:45 2009 for gpucalc by  doxygen 1.5.6