Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

OMF::List Class Reference

#include <List.hpp>

Inheritance diagram for OMF::List:

OMF::Container OMF::Object List of all members.

Detailed Description

The List class is a container of objects that implements ordered, non-unique containment semantics. That is to say the order of objects added to the list is important and an object can be in the list more than once.

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 ()


Constructor & Destructor Documentation

OMF::List::List (   ) 
 

OMF::List::List (  const List &  value  ) 
 

virtual OMF::List::~List (   )  [virtual]
 


Member Function Documentation

virtual void OMF::List::add (  const char *  value  )  [virtual]
 

Implements OMF::Container.

virtual void OMF::List::add (  int  value  )  [virtual]
 

Implements OMF::Container.

virtual void OMF::List::add (  bool  value  )  [virtual]
 

Implements OMF::Container.

virtual void OMF::List::add (  Object *  obj  )  [virtual]
 

Add an object to the list. This is the same as appending the object.

Implements OMF::Container.

Object* OMF::List::at (  size_t  index  )  const
 

Object* OMF::List::at (  size_t  index  ) 
 

Object* OMF::List::back (   ) 
 

virtual ConstIterator OMF::List::begin (   )  const [virtual]
 

Implements OMF::Container.

virtual Iterator OMF::List::begin (   )  [virtual]
 

Implements OMF::Container.

virtual void OMF::List::clear (   )  [virtual]
 

Clear the list.

Implements OMF::Container.

void OMF::Container::collect (  OMF::Object *  obj  )  [inherited]
 

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.

bool OMF::Container::contains (  const char *  value  )  const [inherited]
 

bool OMF::Container::contains (  int  value  )  const [inherited]
 

bool OMF::Container::contains (  bool  value  )  const [inherited]
 

bool OMF::Container::contains (  Object *  obj  )  const [inherited]
 

The contains method tests for the existence of an object within the container.

virtual bool OMF::List::empty (   )  const [virtual]
 

Implements OMF::Container.

virtual ConstIterator OMF::List::end (   )  const [virtual]
 

Implements OMF::Container.

virtual Iterator OMF::List::end (   )  [virtual]
 

Implements OMF::Container.

Iterator OMF::List::erase (  Iterator  i  ) 
 

virtual ConstIterator OMF::List::find (  const char *  value  )  const [virtual]
 

Implements OMF::Container.

virtual ConstIterator OMF::List::find (  int  value  )  const [virtual]
 

Implements OMF::Container.

virtual ConstIterator OMF::List::find (  bool  value  )  const [virtual]
 

Implements OMF::Container.

virtual ConstIterator OMF::List::find (  Object *  obj  )  const [virtual]
 

Implements OMF::Container.

virtual Iterator OMF::List::find (  const char *  value  )  [virtual]
 

Implements OMF::Container.

virtual Iterator OMF::List::find (  int  value  )  [virtual]
 

Implements OMF::Container.

virtual Iterator OMF::List::find (  bool  value  )  [virtual]
 

Implements OMF::Container.

virtual Iterator OMF::List::find (  Object *  obj  )  [virtual]
 

Implements OMF::Container.

Object* OMF::List::front (   ) 
 

virtual unsigned OMF::Container::hashCode (   )  const [virtual, inherited]
 

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.

Iterator OMF::List::insert (  Iterator  i,
const char *  value
) 
 

Iterator OMF::List::insert (  Iterator  i,
int  value
) 
 

Iterator OMF::List::insert (  Iterator  i,
bool  value
) 
 

Iterator OMF::List::insert (  Iterator  i,
Object *  obj
) 
 

ModelObject* OMF::Object::metaObject (   )  [inherited]
 

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.

const List& OMF::List::operator= (  const List &  value  ) 
 

Object* OMF::List::operator[] (  size_t  index  )  const
 

Object* OMF::List::operator[] (  size_t  index  ) 
 

void OMF::List::popBack (   ) 
 

void OMF::List::popFront (   ) 
 

void OMF::List::pushBack (  const char *  value  ) 
 

void OMF::List::pushBack (  int  value  ) 
 

void OMF::List::pushBack (  bool  value  ) 
 

void OMF::List::pushBack (  Object *  obj  ) 
 

void OMF::List::pushFront (  const char *  value  ) 
 

void OMF::List::pushFront (  int  value  ) 
 

void OMF::List::pushFront (  bool  value  ) 
 

void OMF::List::pushFront (  Object *  obj  ) 
 

virtual void OMF::List::remove (  const char *  value  )  [virtual]
 

Implements OMF::Container.

virtual void OMF::List::remove (  int  value  )  [virtual]
 

Implements OMF::Container.

virtual void OMF::List::remove (  bool  value  )  [virtual]
 

Implements OMF::Container.

virtual void OMF::List::remove (  Object *  obj  )  [virtual]
 

In this context the remove function removes all objects with the same identity as the given object.

Implements OMF::Container.

virtual size_t OMF::List::size (   )  const [virtual]
 

Implements OMF::Container.

virtual const std::string& OMF::List::typeCode (   )  const [virtual]
 

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.


The documentation for this class was generated from the following file:
Generated on Fri Sep 10 13:07:38 2004 for OpenModelingFramework by doxygen 1.3.8