sipxportlib  Version 3.3
Public Member Functions | Static Public Attributes | List of all members
UtlVoidPtr Class Reference

UtlVoidPtr is a UtlContainable wrapper for a void ptr. More...

#include <UtlVoidPtr.h>

Inheritance diagram for UtlVoidPtr:
Inheritance graph
[legend]
Collaboration diagram for UtlVoidPtr:
Collaboration graph
[legend]

Public Member Functions

 UtlVoidPtr (void *pPtr=NULL)
 
virtual ~UtlVoidPtr ()
 
void * setValue (void *)
 
void * getValue () const
 
virtual unsigned hash () const
 
virtual UtlContainableType getContainableType () const
 
virtual int compareTo (UtlContainable const *) const
 
- Public Member Functions inherited from UtlContainable
virtual ~UtlContainable ()
 
unsigned directHash () const
 Provides a hash function that uses the object pointer as the hash value. More...
 
virtual UtlBoolean isEqual (UtlContainable const *) const
 Test this object to another object for equality. More...
 
virtual UtlBoolean isInstanceOf (const UtlContainableType type) const
 Determine if this object is a derivative of the specified UtlContainableType. More...
 

Static Public Attributes

static const UtlContainableType TYPE = "UtlVoidPtr"
 
- Static Public Attributes inherited from UtlContainable
static const UtlContainableType TYPE = "UtlContainable"
 

Additional Inherited Members

- Static Public Member Functions inherited from UtlContainable
static unsigned stringHash (char const *value)
 Provides a hash function appropriate for null-terminated string values. More...
 
static UtlBoolean areSameTypes (const UtlContainableType type1, const UtlContainableType type2)
 Are UtlContainable types the same. More...
 

Detailed Description

UtlVoidPtr is a UtlContainable wrapper for a void ptr.

This class has serious potential to create memory leaks and type casting errors. Please consider just making the class you want to put into a container a UtlContainable - it just requires implementing a couple of methods, and can often be done by just inheriting from one of the existing UtlContainable classes. In the simplest case, you can use UtlContainableAtomic; it requires only that you define a new UtlContainableType constant and the method to read it.

Constructor & Destructor Documentation

UtlVoidPtr ( void *  pPtr = NULL)

< Class type used for runtime checking Constructor accepting an optional default value.

~UtlVoidPtr ( )
virtual

Destructor

Member Function Documentation

void * setValue ( void *  pValue)

Set a new void ptr value for this object.

Returns
the old value
void * getValue ( ) const

Get the void ptr wrapped by this object.

unsigned hash ( ) const
virtual

Calculate a unique hash code for this object. If the equals operator returns true for another object, then both of those objects must return the same hashcode.

Implements UtlContainable.

UtlContainableType getContainableType ( ) const
virtual

Get the ContainableType for a UtlContainable derived class.

Implements UtlContainable.

int compareTo ( UtlContainable const *  inVal) const
virtual

Compare the this object to another like-objects. Results for designating a non-like object are undefined.

Returns
0 if equal, < 0 if less then and >0 if greater.

Implements UtlContainable.

Member Data Documentation

const UtlContainableType TYPE = "UtlVoidPtr"
static