stk::CSet Class Reference
[Util_module]

#include <CSet.hpp>

List of all members.


Detailed Description

Set of entities of arbitrary types.

Todo:
REFACTOR Use smart pointers to avoid destruction issue.
Example usage of the three methods:

  class A { ... };
  class B { ... };

  CSet cset ;

  // Insert pointers to objects:

  cset.insert<A>( new A ); // Do not delete on destruction
  cset.insert<B>( new B , true ); // Delete on destruction

  // Query the collection of objects of a given type:

  const A * sa = cset.get<A>();
  const B * sb = cset.get<B>();

  // Remove a member:

  {
    B * b = ... ;
    cset.remove<B>( b ); // Remove never deletes
    delete b ;
  }
 

Definition at line 51 of file CSet.hpp.

Public Member Functions

template<class T>
const T * get () const
 Get member conforming to the given type.
template<class T>
const T * insert_with_delete (const T *)
 Insert a new member.
template<class T>
const T * insert_no_delete (const T *)
 Insert a new member.
template<class T>
bool remove (const T *)
 Erase a member without deleting.
 ~CSet ()
 CSet ()


Member Function Documentation

template<class T>
const T* stk::CSet::insert_with_delete ( const T *   ) 

Insert a new member.

Invoke 'delete' upon destruction. If already exists then return existing member, insert fails.

template<class T>
const T* stk::CSet::insert_no_delete ( const T *   ) 

Insert a new member.

Do nothing to it upon destruction. If already exists then return existing member, insert fails.

template<class T>
bool stk::CSet::remove ( const T *   ) 

Erase a member without deleting.

Return if the remove operation was successful.


The documentation for this class was generated from the following files:
Generated on Tue Jul 13 09:27:33 2010 for Sierra Toolkit by  doxygen 1.4.7