SNMP++  3.3.4
SnmpCollection< T > Class Template Reference

#include <collect.h>

Collaboration diagram for SnmpCollection< T >:

Classes

class  cBlock
 

Public Member Functions

 SnmpCollection ()
 Create an empty collection. More...
 
 SnmpCollection (const T &t)
 Create a collection using a single template object. More...
 
 SnmpCollection (const SnmpCollection< T > &c)
 Create a collection with another collection (copy constructor). More...
 
 ~SnmpCollection ()
 Destroy the collection. More...
 
int size () const
 Get the size of the collection. More...
 
SnmpCollectionoperator+= (const T &i)
 Append an item to the collection. More...
 
SnmpCollectionoperator= (const SnmpCollection< T > &c)
 Assign one collection to another. More...
 
operator[] (const int p) const
 Access an element in the collection. More...
 
int set_element (const T &i, const int p)
 Set an element in the collection. More...
 
int get_element (T &t, const int p) const
 Get an element in the collection. More...
 
int get_element (T *&t, const int p) const
 Get a pointer to an element in the collection. More...
 
void apply (void f(T &))
 Apply an function to the entire collection, iterator. More...
 
int find (const T &i, int &pos) const
 Looks for an element in the collection. More...
 
int remove (const T &i)
 Delete an element in the collection. More...
 
void clear ()
 Delete all elements within the collection. More...
 

Private Attributes

int count
 
cBlock data
 

Detailed Description

template<class T>
class SnmpCollection< T >

Definition at line 66 of file collect.h.

Constructor & Destructor Documentation

template<class T>
SnmpCollection< T >::SnmpCollection ( )
inline

Create an empty collection.

Definition at line 82 of file collect.h.

template<class T>
SnmpCollection< T >::SnmpCollection ( const T &  t)
inline

Create a collection using a single template object.

Definition at line 88 of file collect.h.

template<class T>
SnmpCollection< T >::SnmpCollection ( const SnmpCollection< T > &  c)
inline

Create a collection with another collection (copy constructor).

Definition at line 97 of file collect.h.

References SnmpCollection< T >::count, SnmpCollection< T >::get_element(), SnmpCollection< T >::cBlock::item, MAXT, and SnmpCollection< T >::cBlock::next.

template<class T>
SnmpCollection< T >::~SnmpCollection ( )
inline

Destroy the collection.

Definition at line 127 of file collect.h.

Member Function Documentation

template<class T>
void SnmpCollection< T >::apply ( void   fT &)
inline

Apply an function to the entire collection, iterator.

Definition at line 282 of file collect.h.

template<class T>
void SnmpCollection< T >::clear ( )
inline

Delete all elements within the collection.

Definition at line 343 of file collect.h.

References SnmpCollection< T >::cBlock::item, MAXT, SnmpCollection< T >::cBlock::next, and SnmpCollection< T >::cBlock::prev.

template<class T>
int SnmpCollection< T >::find ( const T &  i,
int &  pos 
) const
inline

Looks for an element in the collection.

Returns
TRUE if found.

Definition at line 297 of file collect.h.

template<class T>
int SnmpCollection< T >::get_element ( T &  t,
const int  p 
) const
inline

Get an element in the collection.

Returns
0 on success and -1 on failure.

Definition at line 248 of file collect.h.

References SnmpCollection< T >::cBlock::item, MAXT, and SnmpCollection< T >::cBlock::next.

Referenced by SnmpCollection< T >::operator=(), and SnmpCollection< T >::SnmpCollection().

template<class T>
int SnmpCollection< T >::get_element ( T *&  t,
const int  p 
) const
inline

Get a pointer to an element in the collection.

Returns
0 on success and -1 on failure.

Definition at line 266 of file collect.h.

References SnmpCollection< T >::cBlock::item, MAXT, and SnmpCollection< T >::cBlock::next.

template<class T>
SnmpCollection& SnmpCollection< T >::operator+= ( const T &  i)
inline

Append an item to the collection.

Definition at line 143 of file collect.h.

References SnmpCollection< T >::cBlock::item, MAXT, and SnmpCollection< T >::cBlock::next.

template<class T>
SnmpCollection& SnmpCollection< T >::operator= ( const SnmpCollection< T > &  c)
inline
template<class T>
T SnmpCollection< T >::operator[] ( const int  p) const
inline

Access an element in the collection.

Returns
The requestet element or an empty element if out of bounds.

Definition at line 205 of file collect.h.

References SnmpCollection< T >::cBlock::item, MAXT, and SnmpCollection< T >::cBlock::next.

template<class T>
int SnmpCollection< T >::remove ( const T &  i)
inline

Delete an element in the collection.

Definition at line 314 of file collect.h.

template<class T>
int SnmpCollection< T >::set_element ( const T &  i,
const int  p 
)
inline

Set an element in the collection.

Returns
0 on success and -1 on failure.

Definition at line 229 of file collect.h.

References SnmpCollection< T >::cBlock::item, MAXT, and SnmpCollection< T >::cBlock::next.

template<class T>
int SnmpCollection< T >::size ( ) const
inline

Get the size of the collection.

Definition at line 135 of file collect.h.

Member Data Documentation

template<class T>
int SnmpCollection< T >::count
private
template<class T>
cBlock SnmpCollection< T >::data
private

Definition at line 378 of file collect.h.


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