- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Utils/Containers/ObjectArray.h

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00009 // Organization:        Model-based Embedded and Robotic Systems Group
    00010 //                                      Massachusetts Institute of Technology
    00011 //
    00013
    00014 #if !defined(AFX_OBJECTARRAY_H__B07C2AC3_97E9_4244_AFAB_381ED9C825D3__INCLUDED_)
    00015 #define AFX_OBJECTARRAY_H__B07C2AC3_97E9_4244_AFAB_381ED9C825D3__INCLUDED_
    00016
    00017 #if _MSC_VER > 1000
    00018 #pragma once
    00019 #endif // _MSC_VER > 1000
    00020
    00021 #include "DynamicArray.h"
    00022
    00023 namespace Mers {
    00024         namespace Utils {
    00025                 namespace Containers {
    00026
    00034                         class ObjectArray : public DynamicArray
    00035                         {
    00036                         public:
    00037                                 //-----------------------------------------
    00038                                 // Constructors
    00039                                 //-----------------------------------------
    00040
    00048                                 ObjectArray(bool myOwnershipStatus);
    00049
    00050                                 //-----------------------------------------
    00051                                 // Copy constructors
    00052                                 //-----------------------------------------
    00053
    00060                                 ObjectArray(ObjectArray const &other);
    00067                                 ObjectArray(ObjectArray const * other);
    00068
    00069                                 //-----------------------------------------
    00070                                 // Destructors
    00071                                 //-----------------------------------------
    00072
    00076                                 virtual ~ObjectArray();
    00077
    00078                                 //-----------------------------------------
    00079                                 // Iterators
    00080                                 //-----------------------------------------
    00081
    00082                                 typedef BaseModelObject * pointer;
    00083                                 typedef const BaseModelObject * const_pointer;
    00084                                 typedef ObjectArray ContainerType;
    00085                                 typedef IteratorTemplate<const_pointer, ContainerType> const_iterator;
    00086                                 typedef IteratorTemplate<pointer, ContainerType> iterator;
    00087                                 typedef const_iterator ConstantIterator;
    00088                                 typedef iterator Iterator;
    00089
    00090                                 //-----------------------------------------
    00091                                 // Functions
    00092                                 //-----------------------------------------
    00093
    00099                                 iterator begin()
    00100                                 {
    00101                                         return iterator(this, 0);
    00102                                 }
    00109                                 const_iterator begin() const
    00110                                 {
    00111                                         return const_iterator((ContainerType *)this, 0);
    00112                                 }
    00113
    00120                                 iterator end()
    00121                                 {
    00122                                         return iterator(this, getLength());
    00123                                 }
    00130                                 const_iterator end() const
    00131                                 {
    00132                                         return const_iterator((ContainerType *)this, getLength());
    00133                                 }
    00134
    00146                                 int pushBack(BaseModelObject * data);
    00154                                 BaseModelObject * popBack();
    00155
    00156                                 //-----------------------------------------
    00157                                 // Operators
    00158                                 //-----------------------------------------
    00159
    00168                                 BaseModelObject * & operator[](int elementIndex);
    00177                                 BaseModelObject * & operator[](unsigned int elementIndex);
    00186                                 BaseModelObject const * & operator[](int elementIndex) const;
    00195                                 BaseModelObject const * & operator[](unsigned int elementIndex) const;
    00196
    00206                                 ObjectArray const & operator =(ObjectArray const &other);
    00215                                 ObjectArray const & operator +=(ObjectArray const &other);
    00225                                 ObjectArray const & operator +=(BaseModelObject const &data);
    00226
    00236                                 bool operator ==(ObjectArray const &other) const;
    00246                                 bool operator !=(ObjectArray const &other) const;
    00247
    00248                         protected:
    00249                                 //-----------------------------------------
    00250                                 // Functions
    00251                                 //-----------------------------------------
    00252
    00253 #ifndef EMBEDDED
    00254
    00263                                 void printElement(std::ostream &out, void const * element) const;
    00264 #endif
    00265
    00273                                 void deleteElement(void * element) const;
    00282                                 void * newElement(void const * element) const;
    00294                                 bool isEqual(void const * element1, void const * element2) const;
    00295                         };
    00296                 }
    00297         }
    00298 }
    00299
    00300 #endif // !defined(AFX_OBJECTARRAY_H__B07C2AC3_97E9_4244_AFAB_381ED9C825D3__INCLUDED_)