Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Container Class Reference

#include <IceContainer.h>

Inheritance diagram for Container:
Inheritance graph
[legend]

Public Member Functions

inline_ ContainerAdd (udword entry)
 
inline_ ContainerAdd (const udword *entries, udword nb)
 
inline_ ContainerAdd (float entry)
 
inline_ ContainerAdd (const float *entries, udword nb)
 
inline_ ContainerAddUnique (udword entry)
 Add unique [slow]. More...
 
 Container ()
 
 Container (const Container &object)
 
 Container (udword size, float growth_factor)
 
bool Contains (udword entry, udword *location=null) const
 
bool Delete (udword entry)
 
inline_ void DeleteIndex (udword index)
 Deletes the entry whose index is given. More...
 
bool DeleteKeepingOrder (udword entry)
 
inline_ void DeleteLastEntry ()
 Deletes the very last entry. More...
 
ContainerEmpty ()
 
ContainerFindNext (udword &entry, FindMode find_mode=FIND_CLAMP)
 
ContainerFindPrev (udword &entry, FindMode find_mode=FIND_CLAMP)
 
inline_ void ForceSize (udword size)
 
inline_ udwordGetEntries () const
 Returns the list of entries. More...
 
inline_ udword GetEntry (udword i) const
 Returns ith entry. More...
 
inline_ udword GetFirst () const
 
inline_ float GetGrowthFactor () const
 Returns the growth factor. More...
 
inline_ udword GetLast () const
 
inline_ udword GetNbContainers () const
 Operator for "Container A = Container B". More...
 
inline_ udword GetNbEntries () const
 Returns the current number of entries. More...
 
inline_ udword GetTotalBytes () const
 
udword GetUsedRam () const
 
inline_ bool IsFull () const
 Checks the container is full. More...
 
inline_ BOOL IsNotEmpty () const
 Checks the container is empty. More...
 
inline_ udword operator[] (udword i) const
 Read-access as an array. More...
 
inline_ udwordoperator[] (udword i)
 Write-access as an array. More...
 
bool Refit ()
 
inline_ void Reset ()
 
inline_ void SetGrowthFactor (float growth)
 Sets the growth factor. More...
 
bool SetSize (udword nb)
 
 ~Container ()
 

Private Member Functions

bool Resize (udword needed=1)
 

Private Attributes

udword mCurNbEntries
 Current number of entries. More...
 
udwordmEntries
 List of entries. More...
 
float mGrowthFactor
 Resize: new number of entries = old number * mGrowthFactor. More...
 
udword mMaxNbEntries
 Maximum possible number of entries. More...
 

Static Private Attributes

static udword mNbContainers
 Number of containers around. More...
 
static udword mUsedRam
 Amount of bytes used by containers in the system. More...
 

Detailed Description

Contains a list of 32-bits values. Use this class when you need to store an unknown number of values. The list is automatically resized and can contains 32-bits entities (dwords or floats)

Author
Pierre Terdiman
Version
1.0
Date
08.15.98

Definition at line 25 of file IceContainer.h.

Constructor & Destructor Documentation

Container::Container ( )
Container::Container ( const Container object)
Container::Container ( udword  size,
float  growth_factor 
)
Container::~Container ( )

Member Function Documentation

inline_ Container& Container::Add ( udword  entry)
inline

A O(1) method to add a value in the container. The container is automatically resized if needed. The method is inline, not the resize. The call overhead happens on resizes only, which is not a problem since the resizing operation costs a lot more than the call overhead...

Parameters
entry[in] a udword to store in the container
See also
Add(float entry)
Empty()
Contains(udword entry)
Returns
Self-Reference

Definition at line 47 of file IceContainer.h.

inline_ Container& Container::Add ( const udword entries,
udword  nb 
)
inline

Definition at line 57 of file IceContainer.h.

inline_ Container& Container::Add ( float  entry)
inline

A O(1) method to add a value in the container. The container is automatically resized if needed. The method is inline, not the resize. The call overhead happens on resizes only, which is not a problem since the resizing operation costs a lot more than the call overhead...

Parameters
entry[in] a float to store in the container
See also
Add(udword entry)
Empty()
Contains(udword entry)
Returns
Self-Reference

Definition at line 81 of file IceContainer.h.

inline_ Container& Container::Add ( const float *  entries,
udword  nb 
)
inline

Definition at line 91 of file IceContainer.h.

inline_ Container& Container::AddUnique ( udword  entry)
inline

Add unique [slow].

Definition at line 103 of file IceContainer.h.

bool Container::Contains ( udword  entry,
udword location = null 
) const
bool Container::Delete ( udword  entry)
inline_ void Container::DeleteIndex ( udword  index)
inline

Deletes the entry whose index is given.

Definition at line 164 of file IceContainer.h.

bool Container::DeleteKeepingOrder ( udword  entry)
inline_ void Container::DeleteLastEntry ( )
inline

Deletes the very last entry.

Definition at line 162 of file IceContainer.h.

Container& Container::Empty ( )

Clears the container. All stored values are deleted, and it frees used ram.

See also
Reset()
Returns
Self-Reference
Container& Container::FindNext ( udword entry,
FindMode  find_mode = FIND_CLAMP 
)
Container& Container::FindPrev ( udword entry,
FindMode  find_mode = FIND_CLAMP 
)
inline_ void Container::ForceSize ( udword  size)
inline

Definition at line 133 of file IceContainer.h.

inline_ udword* Container::GetEntries ( ) const
inline

Returns the list of entries.

Definition at line 172 of file IceContainer.h.

inline_ udword Container::GetEntry ( udword  i) const
inline

Returns ith entry.

Definition at line 171 of file IceContainer.h.

inline_ udword Container::GetFirst ( ) const
inline

Definition at line 174 of file IceContainer.h.

inline_ float Container::GetGrowthFactor ( ) const
inline

Returns the growth factor.

Definition at line 178 of file IceContainer.h.

inline_ udword Container::GetLast ( ) const
inline

Definition at line 175 of file IceContainer.h.

inline_ udword Container::GetNbContainers ( ) const
inline

Operator for "Container A = Container B".

Definition at line 195 of file IceContainer.h.

inline_ udword Container::GetNbEntries ( ) const
inline

Returns the current number of entries.

Definition at line 170 of file IceContainer.h.

inline_ udword Container::GetTotalBytes ( ) const
inline

Definition at line 196 of file IceContainer.h.

udword Container::GetUsedRam ( ) const
inline_ bool Container::IsFull ( ) const
inline

Checks the container is full.

Definition at line 180 of file IceContainer.h.

inline_ BOOL Container::IsNotEmpty ( ) const
inline

Checks the container is empty.

Definition at line 181 of file IceContainer.h.

inline_ udword Container::operator[] ( udword  i) const
inline

Read-access as an array.

Definition at line 184 of file IceContainer.h.

inline_ udword& Container::operator[] ( udword  i)
inline

Write-access as an array.

Definition at line 186 of file IceContainer.h.

bool Container::Refit ( )

Refits the container and get rid of unused bytes.

Returns
true if success
inline_ void Container::Reset ( )
inline

Resets the container. Stored values are discarded but the buffer is kept so that further calls don't need resizing again. That's a kind of temporal coherence.

See also
Empty()

Definition at line 125 of file IceContainer.h.

bool Container::Resize ( udword  needed = 1)
private
inline_ void Container::SetGrowthFactor ( float  growth)
inline

Sets the growth factor.

Definition at line 179 of file IceContainer.h.

bool Container::SetSize ( udword  nb)

Sets the initial size of the container. If it already contains something, it's discarded.

Parameters
nb[in] Number of entries
Returns
true if success

Member Data Documentation

udword Container::mCurNbEntries
private

Current number of entries.

Definition at line 207 of file IceContainer.h.

udword* Container::mEntries
private

List of entries.

Definition at line 208 of file IceContainer.h.

float Container::mGrowthFactor
private

Resize: new number of entries = old number * mGrowthFactor.

Definition at line 209 of file IceContainer.h.

udword Container::mMaxNbEntries
private

Maximum possible number of entries.

Definition at line 206 of file IceContainer.h.

udword Container::mNbContainers
staticprivate

Number of containers around.

Definition at line 199 of file IceContainer.h.

udword Container::mUsedRam
staticprivate

Amount of bytes used by containers in the system.

Definition at line 200 of file IceContainer.h.


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


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:42