# class ObjList | An object list class. More...
Full name | `TelEngine::ObjList`
Definition | `#include <yateclass.h>`
Inherits | TelEngine::GenObject [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- ObjList ()
- virtual ~ObjList ()
- virtual void* getObject (const String& name) const
- unsigned int length () const
- unsigned int count () const
- inline GenObject* get () const
- GenObject* set (const GenObject* obj, bool delold = true)
- inline ObjList* next () const
- ObjList* last () const
- ObjList* skipNull () const
- ObjList* skipNext () const
- GenObject* at (int index) const
- ObjList* operator+ (int index) const
- inline GenObject* operator[] (signed int index) const
- inline GenObject* operator[] (unsigned int index) const
- GenObject* operator[] (const String& str) const
- ObjList* find (const GenObject* obj) const
- ObjList* find (const String& str) const
- int index (const GenObject* obj) const
- int index (const String& str) const
- ObjList* insert (const GenObject* obj, bool compact = true)
- ObjList* append (const GenObject* obj, bool compact = true)
- GenObject* remove (bool delobj = true)
- GenObject* remove (GenObject* obj, bool delobj = true)
- GenObject* remove (const String& str, bool delobj = true)
- void clear ()
- inline bool autoDelete ()
- inline void setDelete (bool autodelete)

#### Public Static Methods

- static const ObjList& empty ()

## Detailed Description

A simple single-linked object list handling class

ObjList () | ### ObjList

Creates a new, empty list.

~ObjList () | ### ~ObjList

[virtual]

Destroys the list and everything in it.

void* getObject (const String& name) | ### getObject

[const virtual]

Get a pointer to a derived class given that class name

Parameters:

name | Name of the class we are asking for

Returns: Pointer to the requested class or NULL if this object doesn't implement it

Reimplemented from GenObject.

unsigned int length () | ### length

[const]

Get the number of elements in the list

Returns: Count of items

unsigned int count () | ### count

[const]

Get the number of non-null objects in the list

Returns: Count of items

inline GenObject* get () | ### get

[const]

Get the object associated to this list item

Returns: Pointer to the object or NULL

GenObject* set (const GenObject* obj, bool delold = true) | ### set

Set the object associated to this list item

Parameters:

obj | Pointer to the new object to set
delold | True to delete the old object (default)

Returns: Pointer to the old object if not destroyed

inline ObjList* next () | ### next

[const]

Get the next item in the list

Returns: Pointer to the next item in list or NULL

ObjList* last () | ### last

[const]

Get the last item in the list

Returns: Pointer to the last item in list

ObjList* skipNull () | ### skipNull

[const]

Skip over NULL holding items in the list

Returns: Pointer to the first non NULL holding item in list or NULL

ObjList* skipNext () | ### skipNext

[const]

Advance in the list skipping over NULL holding items

Returns: Pointer to the next non NULL holding item in list or NULL

GenObject* at (int index) | ### at

[const]

Get the object at a specific index in list

Parameters:

index | Index of the object to retrieve

Returns: Pointer to the object or NULL

ObjList* operator+ (int index) | ### operator+

[const]

Pointer-like indexing operator

Parameters:

index | Index of the list item to retrieve

Returns: Pointer to the list item or NULL

inline GenObject* operator[] (signed int index) | ### operator[]

[const]

Array-like indexing operator with signed parameter

Parameters:

index | Index of the object to retrieve

Returns: Pointer to the object or NULL

inline GenObject* operator[] (unsigned int index) | ### operator[]

[const]

Array-like indexing operator with unsigned parameter

Parameters:

index | Index of the object to retrieve

Returns: Pointer to the object or NULL

GenObject* operator[] (const String& str) | ### operator[]

[const]

Array-like indexing operator

Parameters:

str | String value of the object to locate

Returns: Pointer to the object or NULL

ObjList* find (const GenObject* obj) | ### find

[const]

Get the item in the list that holds an object

Parameters:

obj | Pointer to the object to search for

Returns: Pointer to the found item or NULL

ObjList* find (const String& str) | ### find

[const]

Get the item in the list that holds an object by String value

Parameters:

str | String value (toString) of the object to search for

Returns: Pointer to the found item or NULL

int index (const GenObject* obj) | ### index

[const]

Get the position in list of a GenObject by a pointer to it

Parameters:

obj | Pointer to the object to search for

Returns: Index of object in list, -1 if not found

int index (const String& str) | ### index

[const]

Get the position in list of the first GenObject with a given value

Parameters:

str | String value (toString) of the object to search for

Returns: Index of object in list, -1 if not found

ObjList* insert (const GenObject* obj, bool compact = true) | ### insert

Insert an object at this point

Parameters:

obj | Pointer to the object to insert
compact | True to replace NULL values in list if possible

Returns: A pointer to the inserted list item

ObjList* append (const GenObject* obj, bool compact = true) | ### append

Append an object to the end of the list

Parameters:

obj | Pointer to the object to append
compact | True to replace NULL values in list if possible

Returns: A pointer to the inserted list item

GenObject* remove (bool delobj = true) | ### remove

Delete this list item

Parameters:

delobj | True to delete the object (default)

Returns: Pointer to the object if not destroyed

GenObject* remove (GenObject* obj, bool delobj = true) | ### remove

Delete the list item that holds a given object

Parameters:

obj | Object to search in the list
delobj | True to delete the object (default)

Returns: Pointer to the object if not destroyed

GenObject* remove (const String& str, bool delobj = true) | ### remove

Delete the first list item that holds an object with a iven value

Parameters:

str | String value (toString) of the object to remove
delobj | True to delete the object (default)

Returns: Pointer to the object if not destroyed

void clear () | ### clear

Clear the list and optionally delete all contained objects

inline bool autoDelete () | ### autoDelete

Get the automatic delete flag

Returns: True if will delete on destruct, false otherwise

inline void setDelete (bool autodelete) | ### setDelete

Set the automatic delete flag

Parameters:

autodelete | True to delete on destruct, false otherwise

const ObjList& empty () | ### empty

[static]

A static empty object list

Returns: Reference to a static empty list

Generated by: paulc on bussard on Fri Dec 21 16:28:34 2012, using kdoc 2.0a54.