Yate
|
Template for generic object vector. More...
#include <yateclass.h>
Public Member Functions | |
GenericVector (unsigned int overAlloc=0, const char *name=0) | |
GenericVector (const Obj *items, unsigned int count, unsigned int overAlloc=0, const char *name=0) | |
GenericVector (const ObjList &items, unsigned int overAlloc=0, const char *name=0) | |
GenericVector (const GenericVector &other) | |
virtual | ~GenericVector () |
unsigned int | length () const |
unsigned int | size () const |
unsigned int | overAlloc () const |
void | overAlloc (unsigned int count) |
const String & | name () const |
Obj * | data (unsigned int offs=0, unsigned int count=0) |
const Obj * | data (unsigned int offs=0, unsigned int count=0) const |
Obj * | first () |
const Obj * | first () const |
Obj * | last () |
const Obj * | last () const |
int | indexOf (const String &name, unsigned int offs=0, Obj **found=0) const |
Obj * | find (const String &name, unsigned int offs=0) const |
int | indexOfValue (const Obj &val, unsigned int offs=0, Obj **found=0) const |
Obj * | findValue (const Obj &val, unsigned int offs=0) const |
void | clear () |
bool | assign (unsigned int len, const Obj *items=0, unsigned int count=0) |
bool | resize (unsigned int len) |
bool | removeLast (unsigned int count=1) |
unsigned int | fill (unsigned int offs=0, int count=-1, const Obj *value=0) |
unsigned int | fillObj (const Obj &value, unsigned int offs=0, int count=-1) |
unsigned int | fillObj (const Obj *items, unsigned int count, unsigned int offs=0) |
Obj * | append (const Obj &item) |
unsigned int | append (const Obj *items, unsigned int count) |
unsigned int | append (const ObjList &list) |
unsigned int | assign (const ObjList &list) |
Obj * | set (const Obj &item) |
GenericVector & | operator= (const GenericVector &other) |
GenericVector & | operator= (const Obj &item) |
GenericVector & | operator+= (const Obj &item) |
GenericVector & | operator+= (const GenericVector &other) |
virtual const String & | toString () const |
![]() | |
GenObject () | |
virtual | ~GenObject () |
virtual bool | alive () const |
virtual void | destruct () |
virtual const String & | traceId () const |
virtual void * | getObject (const String &name) const |
NamedCounter * | getObjCounter () const |
NamedCounter * | setObjCounter (NamedCounter *counter) |
Protected Member Functions | |
Obj * | dataAvail (unsigned int offs, unsigned int count) const |
unsigned int | numItems (unsigned int offs, unsigned int count) const |
Static Protected Member Functions | |
static void | fillArray (const Obj &value, Obj *dest, unsigned int n) |
static void | copy (Obj *dest, const ObjList &src) |
static void | copy (Obj *dest, const Obj *src, unsigned int n) |
Protected Attributes | |
Obj * | m_data |
unsigned int | m_length |
unsigned int | m_size |
unsigned int | m_overAlloc |
Additional Inherited Members | |
![]() | |
static void * | getObject (const String &name, const GenObject *obj) |
static bool | getObjCounting () |
static void | setObjCounting (bool enable) |
static NamedCounter * | getObjCounter (const String &name, bool create=true) |
static ObjList & | getObjCounters () |
Template for generic object vector.
Template for generic object vector The vector can be resized (up/down) Objects MUST implement a default contructor and an assignment operator When name based find or set are used objects should implement toString() This template should be used for simple objects
|
inline |
Constructor
overAlloc | How many items to overallocate |
name | Optional vector name |
|
inline |
Constructor
items | Pointer to initial values |
count | Initial length |
overAlloc | How many items to overallocate |
name | Optional vector name |
|
inline |
Constructor
items | List to copy |
overAlloc | How items to overallocate |
name | Optional vector name |
|
inline |
Copy constructor
other | Vector to copy |
References GenericVector< Obj >::data(), and GenericVector< Obj >::length().
|
inlinevirtual |
Destructor
|
inline |
Append an item to vector
item | Item to append |
|
inline |
Append an array of items to vector
items | Pointer to items to append |
count | The number of items to append |
|
inline |
Append a list of items
list | Items to append |
References ObjList::count().
|
inline |
Append a list of items
list | Items to append |
References ObjList::count().
|
inline |
Assign new data or just allocate new space
len | New vector length. No changes will be applied if 0 |
items | Pointer to items to set. Pointer may be inside held buffer |
count | Number of items to copy, 0 to use 'len', At most 'len' items will be copied |
|
inline |
Clear data
|
inline |
Retrieve a pointer to data
offs | Index to start |
count | Optional number of elements to retrieve |
Referenced by GenericVector< Obj >::GenericVector(), GenericVector< Obj >::operator+=(), and GenericVector< Obj >::operator=().
|
inline |
Retrieve a pointer to data
offs | Index to start |
count | Optional number of elements to retrieve |
|
inline |
Fill vector with data
offs | Start offset |
count | Number of items to fill, negative to fill until vector end |
value | Optional value to fill. Fill with default Obj if not given |
|
inline |
Fill vector with data
value | Value to fill |
offs | Start offset |
count | Number of items to fill, negative to fill until vector end |
|
inline |
Fill vector with data
items | Items to fill |
count | Number of items to fill |
offs | Optional start offset |
|
inline |
Find an object by name Obj MUST implement toString()
name | Object name |
offs | Optional index to start |
|
inline |
Find an object by name Obj MUST implement the == operator
val | Object value |
offs | Optional index to start |
|
inline |
Retrieve a pointer to first item in vector
|
inline |
Retrieve a pointer to first item in vector
|
inline |
Retrieve index of object by name Obj MUST implement toString()
name | Object name |
offs | Optional index to start |
found | Optional pointer to be filled with found object pointer |
References String::toString().
|
inline |
Retrieve index of object by value Obj MUST implement the == operator
val | Object value |
offs | Optional index to start |
found | Optional pointer to be filled with found object pointer |
|
inline |
Retrieve a pointer to last item in vector
|
inline |
Retrieve a pointer to last item in vector
|
inline |
Retrieve vector length
Referenced by GenericVector< Obj >::GenericVector(), GenericVector< Obj >::operator+=(), and GenericVector< Obj >::operator=().
|
inline |
Retrieve vector name
|
inline |
Addition (append) operator
other | Vector to append |
References GenericVector< Obj >::data(), and GenericVector< Obj >::length().
|
inline |
Addition (append) operator
item | Item to append |
|
inline |
Assignment (from other vector) operator
other | Vector to assign |
References GenericVector< Obj >::data(), and GenericVector< Obj >::length().
|
inline |
Assignment (from Obj vector) operator
item | Item to assign |
|
inline |
Retrieve the over alloc value
|
inline |
Set over alloc length
count | Value of over alloc length |
|
inline |
Remove last item(s)
count | Number of items to remove |
|
inline |
Resize the vector 'len' between length() and size(): just increase length 'len' between (size() - overAlloc()) and size(): just decrease length, assign empty Obj to remaining items
len | New vector length. No changes will be applied if len is 0 or equal to current vector length |
|
inline |
Append or set an item to vector
item | Item to append or set |
|
inline |
Retrieve vector size (total allocated items, including over alloc)
|
inlinevirtual |