#include
Inheritance diagram for OMF::List:
Some notes on memory management. Containers are intended to simply collect objects that are typically owned elsewhere. This means that the values stored in the list are never deleted or copy-constructed. Rather, they are simply shared pointers to the contained objects. The exception to the rule is the addition of primitives. In this case, it is expected of the adding entitiy to understand the memory management ramifications (whhat and when to delete).
Typically, this class is built around a container of pointers to heap-allocated objects. However, interfaces are provided for insertion that look like we're boxing stack-allocated variables. These insertion routines are provided for common primitives and result in the allocation of new objects for insertion. Note that the client MUST delete these later on.
Public Member Functions |
|
List () | |
List (const List &value) | |
virtual | ~List () |
const List & | operator= (const List &value) |
virtual Iterator | begin () |
virtual Iterator | end () |
virtual Iterator | find (Object *obj) |
virtual Iterator | find (bool value) |
virtual Iterator | find (int value) |
virtual Iterator | find (const char *value) |
virtual ConstIterator | begin () const |
virtual ConstIterator | end () const |
virtual ConstIterator | find (Object *obj) const |
virtual ConstIterator | find (bool value) const |
virtual ConstIterator | find (int value) const |
virtual ConstIterator | find (const char *value) const |
Object * | at (size_t index) |
Object * | at (size_t index) const |
Object * | operator[] (size_t index) |
Object * | operator[] (size_t index) const |
Object * | front () |
void | pushFront (Object *obj) |
void | pushFront (bool value) |
void | pushFront (int value) |
void | pushFront (const char *value) |
void | popFront () |
Object * | back () |
void | pushBack (Object *obj) |
void | pushBack (bool value) |
void | pushBack (int value) |
void | pushBack (const char *value) |
void | popBack () |
Iterator | insert (Iterator i, Object *obj) |
Iterator | insert (Iterator i, bool value) |
Iterator | insert (Iterator i, int value) |
Iterator | insert (Iterator i, const char *value) |
Iterator | erase (Iterator i) |
virtual bool | empty () const |
virtual size_t | size () const |
virtual void | add (Object *obj) |
virtual void | add (bool value) |
virtual void | add (int value) |
virtual void | add (const char *value) |
virtual void | remove (Object *obj) |
virtual void | remove (bool value) |
virtual void | remove (int value) |
virtual void | remove (const char *value) |
virtual void | clear () |
virtual const std::string & | typeCode () const |
bool | contains (Object *obj) const |
bool | contains (bool value) const |
bool | contains (int value) const |
bool | contains (const char *value) const |
void | collect (OMF::Object *obj) |
virtual unsigned | hashCode () const |
ModelObject * | metaObject () |
|
|
|
|
Implements OMF::Container. |
|
Implements OMF::Container. |
|
Implements OMF::Container. |
|
Add an object to the list. This is the same as appending the object. Implements OMF::Container. |
|
|
|
|
Implements OMF::Container. |
|
Implements OMF::Container. |
|
Clear the list. Implements OMF::Container. |
|
The collect method is a generic append for other list/set objects of the same type. The object must be a container for the collect to function. Note that if the object is not a container, no action is taken and no exception is raised. |
|
|
|
|
The contains method tests for the existence of an object within the container. |
|
Implements OMF::Container. |
|
Implements OMF::Container. |
|
Implements OMF::Container. |
|
|
Implements OMF::Container. |
|
Implements OMF::Container. |
|
Implements OMF::Container. |
|
Implements OMF::Container. |
|
Implements OMF::Container. |
|
Implements OMF::Container. |
|
Implements OMF::Container. |
|
Implements OMF::Container. |
|
|
The hash implementation for containers is to simply return the pointer value as an integer. We don't anticipate the need for value-based identity with containers. Implements OMF::Object. |
|
|
|
|
|
Return the meta-object of this instance. The meta-object is an instance of the metaclass of this object. For example, the metaclass of UML::Attribute is Model::Class. The metaobject for an instance of UML::Attribute is an instance of Model::Class. This method may force a load of an entire metamodel in order to return the correct object. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Implements OMF::Container. |
|
Implements OMF::Container. |
|
Implements OMF::Container. |
|
In this context the remove function removes all objects with the same identity as the given object. Implements OMF::Container. |
|
Implements OMF::Container. |
|
The typeCode method returns a textual description of an object's type. This can vary between classifications of objects. For primitives and collections, the names are essentially static. For model objects, enumerations and collections the name of the object is the scoped name of the instantiating class. Note that the names of primitives are not typed. Implements OMF::Object. |