SNMP++  3.3.11
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 67 of file collect.h.

Constructor & Destructor Documentation

◆ SnmpCollection() [1/3]

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

Create an empty collection.

Definition at line 83 of file collect.h.

◆ SnmpCollection() [2/3]

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

Create a collection using a single template object.

Definition at line 89 of file collect.h.

◆ SnmpCollection() [3/3]

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

Create a collection with another collection (copy constructor).

Definition at line 98 of file collect.h.

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

◆ ~SnmpCollection()

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

Destroy the collection.

Definition at line 128 of file collect.h.

Member Function Documentation

◆ apply()

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

Apply an function to the entire collection, iterator.

Definition at line 283 of file collect.h.

◆ clear()

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

Delete all elements within the collection.

Definition at line 344 of file collect.h.

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

◆ find()

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 298 of file collect.h.

◆ get_element() [1/2]

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 249 of file collect.h.

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

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

◆ get_element() [2/2]

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 267 of file collect.h.

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

◆ operator+=()

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

Append an item to the collection.

Definition at line 144 of file collect.h.

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

◆ operator=()

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

◆ operator[]()

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 206 of file collect.h.

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

◆ remove()

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

Delete an element in the collection.

Definition at line 315 of file collect.h.

◆ set_element()

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 230 of file collect.h.

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

◆ size()

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

Get the size of the collection.

Definition at line 136 of file collect.h.

Member Data Documentation

◆ count

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

◆ data

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

Definition at line 379 of file collect.h.


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