cgma
HasherVector< Y, S > Class Template Reference

#include <IdHasher.hpp>

List of all members.

Public Types

enum  { NumberOfBits = S }
typedef unsigned int Key
typedef std::vector< Y >
::value_type 
value_type

Public Member Functions

 HasherVector ()
bool add (Key idx, value_type &ptr)
bool remove (Key idx)
Key count () const

Private Attributes

Key mCount

Detailed Description

template<class Y, unsigned int S>
class HasherVector< Y, S >

Definition at line 249 of file IdHasher.hpp.


Member Typedef Documentation

template<class Y , unsigned int S>
typedef unsigned int HasherVector< Y, S >::Key

Definition at line 252 of file IdHasher.hpp.

template<class Y , unsigned int S>
typedef std::vector<Y>::value_type HasherVector< Y, S >::value_type

Definition at line 253 of file IdHasher.hpp.


Member Enumeration Documentation

template<class Y , unsigned int S>
anonymous enum
Enumerator:
NumberOfBits 

Definition at line 254 of file IdHasher.hpp.

{ NumberOfBits = S };

Constructor & Destructor Documentation

template<class Y , unsigned int S>
HasherVector< Y, S >::HasherVector ( ) [inline]

Definition at line 256 of file IdHasher.hpp.

        : std::vector<Y>(1<<S, (Y)0), mCount(0) 
      {
      }

Member Function Documentation

template<class Y , unsigned int S>
bool HasherVector< Y, S >::add ( Key  idx,
value_type ptr 
) [inline]

Definition at line 261 of file IdHasher.hpp.

    {
      Y& p = (*this)[idx];
      if(!p)
      {
        p = ptr;
        ++this->mCount;
        return true;
      }
      return false;
    }
template<class Y , unsigned int S>
Key HasherVector< Y, S >::count ( ) const [inline]

Definition at line 285 of file IdHasher.hpp.

    {
      return mCount;
    }
template<class Y , unsigned int S>
bool HasherVector< Y, S >::remove ( Key  idx) [inline]

Definition at line 273 of file IdHasher.hpp.

    {
      Y& p = (*this)[idx];
      if(p)
      {
        p = 0;
        --this->mCount;
        return true;
      }
      return false;
    }

Member Data Documentation

template<class Y , unsigned int S>
Key HasherVector< Y, S >::mCount [private]

Definition at line 291 of file IdHasher.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines