00001 /* 00002 ot_lib - Object Type Library 00003 Copyright (C) 2002 Alessandro Bonfanti 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 Alessandro Bonfanti 00020 xjbon@tin.it 00021 */ 00022 00023 00024 #ifndef OT_VECTOR_H 00025 #define OT_VECTOR_H 00026 00027 // ----------------------------------------------------------------------------------- 00029 00032 // ----------------------------------------------------------------------------------- 00033 00034 class ot_vector : public ot_obj, public vector<ot_container_element> 00035 { 00036 00037 private: 00038 00039 public: 00040 00041 00042 // ######################################### 00043 // CONSTRUCTORS & DESTRUCTOR 00044 // ######################################### 00045 00047 ot_vector(int s=0); 00048 00051 ot_vector(const ot_vector &c); 00052 00054 virtual ~ot_vector(); 00055 00056 00057 // ######################################### 00058 // IMPLEMENTATIONS OF THE VIRTUAL FUNCTIONS 00059 // ######################################### 00060 00064 ot_obj *dup(void) const; 00065 00069 void asXml(ostream &s=cout,int i=0) const; 00070 00073 bool asData(ostream &s) const; 00074 00075 00076 // ######################################### 00077 // PROPIETARY FUNCTIONS 00078 // ######################################### 00079 00080 00082 00083 00084 00085 const ot_obj *get(int pos) const; 00086 00088 00089 00090 00091 00092 ot_obj *getPtr(int pos); 00093 00095 00096 00097 00098 00099 bool set(int pos,const ot_obj *o); 00100 00102 00103 00104 00105 00106 bool set(int pos,const ot_obj &o); 00107 00109 00110 00111 00112 bool erase(const ot_obj *o); 00113 00114 // ######################################### 00115 // MATH OPERATOR 00116 // ######################################### 00117 00119 ot_vector & operator = (const ot_vector &c); 00120 00122 bool operator == (const ot_vector &c); 00123 00125 bool operator != (const ot_vector &v); 00126 00128 bool operator == (const ot_obj *o) const 00129 { 00130 if(o && o->getType()==getType()) return(*this==*((ot_vector *) o)); 00131 else return(false); 00132 } 00133 00134 }; 00135 00136 #else 00137 #endif 00138