|
Aegis
4.25.D505
|
00001 // 00002 // aegis - project change supervisor 00003 // Copyright (C) 2008 Peter Miller 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or (at 00008 // your option) any later version. 00009 // 00010 // This program 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 // General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License along 00016 // with this program. If not, see <http://www.gnu.org/licenses/>. 00017 // 00018 00019 #ifndef LIBAEGIS_INTROSPECTOR_VECTOR_H 00020 #define LIBAEGIS_INTROSPECTOR_VECTOR_H 00021 00022 #include <libaegis/introspector.h> 00023 00028 class introspector_vector 00029 { 00030 public: 00034 virtual ~introspector_vector(); 00035 00039 introspector_vector(); 00040 00044 introspector_vector(const introspector_vector &); 00045 00049 introspector_vector &operator=(const introspector_vector &); 00050 00054 void clear(); 00055 00060 bool empty() const { return (length == 0); } 00061 00065 size_t size() const { return length; } 00066 00070 introspector::pointer 00071 back() 00072 const 00073 { 00074 return (length == 0 ? introspector::pointer() : item[length - 1]); 00075 } 00076 00084 void 00085 push_back(const introspector::pointer &ip) 00086 { 00087 grow(1); 00088 item[length++] = ip; 00089 } 00090 00098 void push_back(const introspector_vector &il); 00099 00104 void pop_back(); 00105 00106 private: 00111 size_t length; 00112 00117 size_t maximum; 00118 00123 introspector::pointer *item; 00124 00132 void grow_slow(size_t nitems); 00133 00141 void 00142 grow(size_t nitems) 00143 { 00144 if (length + nitems > maximum) 00145 grow_slow(nitems); 00146 } 00147 }; 00148 00149 #endif // LIBAEGIS_INTROSPECTOR_VECTOR_H
1.7.6.1