#include <collection.h>
Public Types | |
enum | { ceName = 64 } |
More error constants. More... | |
typedef containers::VectorSP < Record *, uint16_t > | array_type |
Type of the array. | |
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_type & | array () |
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 |
Returns whether the collection contains records derived from NameRecord. | |
bool | m_named |
Whether the collection contains records derived from NameRecord. |
databases::ArrayCollection::ArrayCollection | ( | bool | named | ) | [inline, explicit] |
Constructor.
[in] | named | Determines whether the records in the collection are derived from NameRecord. |
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.
[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). |
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.
array_type databases::ArrayCollection::m_array [protected] |
An array containing the records, with possible holes (i.e. NULL pointers).