databases::ArrayCollection Class Reference

A collection that allows access to its members through a VectorSP. More...

#include <collection.h>

Inheritance diagram for databases::ArrayCollection:

databases::Collection List of all members.

Public Types

typedef containers::VectorSP<
Record *, uint16_t > 
array_type
 Type of the array.
enum  { ceName = 64 }
 More error constants. More...

Public Member Functions

 ArrayCollection (bool named)
 Constructor.
virtual bool add (Record *record, int *err=0)
 Overrides Collection::add().
virtual size_t memory_usage () const
 Same as Collection::memory_usage().
array_typearray ()
 Returns the array.

Protected Member Functions

virtual bool add_list (Record *record)
 Same as Collection::add_list().
virtual void remove_list (Record *record)
 Same as Collection::remove_list().
virtual void clear_list ()
 Same as Collection::clear_list().

Protected Attributes

array_type m_array
 An array containing the records, with possible holes (i.e. NULL pointers).
bool m_named
 Whether the collection contains records derived from NameRecord.

Detailed Description

This collection will add its records to a VectorSP object, that can be used to iterate through the collection.


Member Enumeration Documentation

anonymous enum
 

Enumerator:
ceName  A record with the same name already exists in the collection.


Constructor & Destructor Documentation

databases::ArrayCollection::ArrayCollection bool  named  )  [inline, explicit]
 

Constructor.

Parameters:
[in] named Determines whether the records in the collection are derived from NameRecord.


Member Function Documentation

virtual bool databases::ArrayCollection::add Record record,
int *  err = 0
[virtual]
 

This function does the same thing as Collection::add(), but, if the collection contains records derived from NameRecord (as specified in the constructor), *err is set to ceName and the function fails.

Parameters:
[in] record The record to add.
[in] err If non-NULL and the function returns false, this variable will contain the error number (which can be ceUnknown, ceID, ceList, ceDatabase, ceName or other numbers defined by derived classes).
Returns:
true if the record has been added to the list, false otherwise.

Reimplemented from databases::Collection.

array_type& databases::ArrayCollection::array  )  [inline]
 

Returns the array filled with the records of the collection. Note that this array may contain "holes", i.e. NULL pointers, for efficiency reasons.

You should not add or remove records to/from the array, even though you may change records in the array, of course.

Returns:
The array.


The documentation for this class was generated from the following file:
Generated on Sun May 20 21:32:19 2007 for Epona API by  doxygen 1.4.6