Loading...
Searching...
No Matches
LongCounter Class Reference
Inheritance diagram for LongCounter:
[legend]
Collaboration diagram for LongCounter:
[legend]

## Public Member Functions

void | IncrementCount (long long key)
void | DecrementCount (long long key)
int | GetCount (long long key)
Public Member Functions inherited from LongHash< int >
| LongHash (int startsize=32)
void | Grow ()
void | Shrink ()
void | SetSize (int newsize)
void | Clear ()
int | Capacity () const
int | Entries () const
int | Object (int i) const
int & | Object (int i)
void | SetObject (int i, int object)
unsigned int | Add (long long key, int object)
unsigned int | Find (long long key)
unsigned int | Rehash (long long key, unsigned int h)
LongHash & | operator= (const LongHash &rhs)
int | operator[] (int i) const
int | operator[] (unsigned int i) const
void | Delete (unsigned int index)
bool | SlotInUse (int index) const
bool | SlotInUse (unsigned int index) const
long long | GetKey (int index) const
long long | GetKey (const unsigned int index) const
void | SetAllowDuplicateKeys (bool toggle)

## Additional Inherited Members

Protected Attributes inherited from LongHash< int >
int * | objects
long long * | keys
bool * | occupancy
unsigned int | count
unsigned int | size
unsigned int | mask
bool | allowDuplicates

## Detailed Description

Definition at line 23 of file LongLongCounter.h.

## Constructor & Destructor Documentation

## LongCounter()

LongCounter::LongCounter | ( |  | ) |

Definition at line 20 of file LongLongCounter.cpp.

: LongHash<int>()
{
SetAllowDuplicateKeys(false);
}
LongHash
Definition LongHash.h:32

## Member Function Documentation

## DecrementCount()

void LongCounter::DecrementCount | ( | long long | key | ) |

Definition at line 37 of file LongLongCounter.cpp.

{
unsigned int slot = Find(key);
if (slot == LH_NOTFOUND)
Add(key, -1);
else if (Object(slot) == 1)
Delete(slot);
else
Object(slot)--;
}

## GetCount()

int LongCounter::GetCount | ( | long long | key | ) |

Definition at line 49 of file LongLongCounter.cpp.

{
unsigned int slot = Find(key);
if (slot == LH_NOTFOUND)
return 0;
else
return Object(slot)--;
}

## IncrementCount()

void LongCounter::IncrementCount | ( | long long | key | ) |

Definition at line 25 of file LongLongCounter.cpp.

{
unsigned int slot = Find(key);
if (slot == LH_NOTFOUND)
Add(key, 1);
else if (Object(slot) == -1)
Delete(slot);
else
Object(slot)++;
}

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

- general/LongLongCounter.h
- general/LongLongCounter.cpp