#include <cmt_vector.h>
Public Types | |
typedef T | element_type |
typedef T* | element_ptr |
typedef T** | frame_ptr |
Public Methods | |
cmt_vector () | |
cmt_vector (const cmt_vector& other) | |
cmt_vector (int n) | |
~cmt_vector () | |
void | push_back (const T& object) |
T& | add () |
void | pop_back () |
void | erase (int index) |
cmt_vector& | operator= (const cmt_vector& other) |
T& | operator[] (int index) const |
T& | operator[] (int index) |
T& | back () const |
T& | back () |
void | resize (int new_size) |
int | size () const |
void | clear () |
frame_ptr | get_frame () const |
int | get_frame_number () const |
int | get_frame_size () const |
Private Types | |
enum | { frame_size = 10 } |
Private Methods | |
T& | element_at (int index) |
T& | element_at (int index) const |
int | frames (int n) |
void | extend (int n) |
Private Attributes | |
frame_ptr | _data |
int | _frames |
int | _size |
|
Definition at line 10 of file cmt_vector.h. |
|
Definition at line 9 of file cmt_vector.h. |
|
Definition at line 11 of file cmt_vector.h. |
|
Definition at line 206 of file cmt_vector.h. 00206 { frame_size = 10 } |
|
Definition at line 13 of file cmt_vector.h. 00014 { 00015 _data = 0; 00016 _frames = 0; 00017 _size = 0; 00018 } |
|
Definition at line 20 of file cmt_vector.h. 00021 { 00022 _data = 0; 00023 _frames = 0; 00024 _size = 0; 00025 00026 cmt_vector<T>& me = *this; 00027 00028 extend (other._size); 00029 for (int i = 0; i < _size; i++) 00030 { 00031 me.element_at (i) = other.element_at (i); 00032 } 00033 } |
|
Definition at line 35 of file cmt_vector.h. 00036 { 00037 _data = 0; 00038 _frames = 0; 00039 _size = 0; 00040 00041 extend (n); 00042 } |
|
Definition at line 44 of file cmt_vector.h. 00045 { 00046 if (_data != 0) 00047 { 00048 for (int i = 0; i < _frames; i++) 00049 { 00050 delete[] _data[i]; 00051 _data[i] = 0; 00052 } 00053 #ifdef CMT_USE_NEW_DELETE 00054 delete[] _data; 00055 #else 00056 free (_data); 00057 #endif 00058 } 00059 _data = 0; 00060 _frames = 0; 00061 _size = 0; 00062 } |
|
Definition at line 70 of file cmt_vector.h. Referenced by Error::Error(), Libmap::add(), Tag::add(), Pattern::add(), Language::add(), Group::add(), Fragment::add(), Constituent::add(), Branch::add(), CmtSystem::add_cmt_path(), MakefileGenerator::analyze_document_file(), MakefileGenerator::analyze_file(), Use::create(), Symbol::create(), Use::current(), CmtSystem::scan_dir(), and CmtSystem::split(). |
|
Definition at line 157 of file cmt_vector.h. 00158 { 00159 if ((_data == 0) || 00160 (_size == 0)) 00161 { 00162 static T object; 00163 return (object); 00164 } 00165 else 00166 { 00167 return (element_at (_size - 1)); 00168 } 00169 } |
|
Definition at line 143 of file cmt_vector.h. Referenced by add(). 00144 { 00145 if ((_data == 0) || 00146 (_size == 0)) 00147 { 00148 static T object; 00149 return (object); 00150 } 00151 else 00152 { 00153 return (element_at (_size - 1)); 00154 } 00155 } |
|
Definition at line 184 of file cmt_vector.h. Referenced by MakefileGenerator::build_library_makefile(), Use::clear(), Tag::clear(), cmt_node_set::clear(), Use::clear_all(), Tag::clear_all(), Symbol::clear_all(), Pattern::clear_all(), Language::clear_all(), Group::clear_all(), Fragment::clear_all(), Constituent::clear_all(), Branch::clear_all(), CmtSystem::get_cmt_paths(), Use::get_paths(), operator=(), MakefileGenerator::reset(), CmtSystem::scan_dir(), and CmtSystem::split(). 00185 { 00186 _size = 0; 00187 } |
|
Definition at line 214 of file cmt_vector.h. 00215 { 00216 int frame = index / frame_size; 00217 return (_data[frame][index % frame_size]); 00218 } |
|
Definition at line 208 of file cmt_vector.h. Referenced by back(), cmt_vector(), erase(), operator=(), operator[](), and push_back(). 00209 { 00210 int frame = index / frame_size; 00211 return (_data[frame][index % frame_size]); 00212 } |
|
Definition at line 81 of file cmt_vector.h. Referenced by cmt_node_set::pop(). 00082 { 00083 if ((_data == 0) || 00084 (index < 0) || 00085 (index >= _size)) 00086 { 00087 return; 00088 } 00089 00090 for (int i = index; i < (_size - 1); i++) 00091 { 00092 element_at (i) = element_at (i + 1); 00093 } 00094 00095 _size--; 00096 } |
|
Definition at line 225 of file cmt_vector.h. Referenced by cmt_vector(), operator=(), push_back(), and resize(). 00226 { 00227 if (n <= 0) return; 00228 00229 _size += n; 00230 00231 int f = frames (_size); 00232 if (f > _frames) 00233 { 00234 if (_data == 0) 00235 { 00236 00237 #ifdef CMT_USE_NEW_DELETE 00238 _data = new element_ptr [f]; 00239 #else 00240 _data = (frame_ptr) malloc (f * sizeof (element_ptr)); 00241 #endif 00242 00243 } 00244 else 00245 { 00246 00247 #ifdef CMT_USE_NEW_DELETE 00248 frame_ptr new_data; 00249 00250 new_data = new element_ptr [f]; 00251 for (int i = 0; i < _frames; i++) 00252 { 00253 new_data[i] = _data[i]; 00254 } 00255 delete[] _data; 00256 _data = new_data; 00257 #else 00258 _data = (frame_ptr) realloc (_data, f * sizeof (element_ptr)); 00259 #endif 00260 00261 } 00262 00263 for (int i = _frames; i < f; i++) 00264 { 00265 _data[i] = new T[frame_size]; 00266 } 00267 00268 _frames = f; 00269 } 00270 } |
|
Definition at line 220 of file cmt_vector.h. Referenced by extend(). 00221 { 00222 return ((n == 0) ? 0 : ((n - 1) / frame_size) + 1); 00223 } |
|
Definition at line 189 of file cmt_vector.h. Referenced by dumper::dump_vector(). 00190 { 00191 return (_data); 00192 } |
|
Definition at line 194 of file cmt_vector.h. Referenced by dumper::dump_vector(). 00195 { 00196 return (_frames); 00197 } |
|
Definition at line 199 of file cmt_vector.h. Referenced by dumper::dump_vector(). 00200 { 00201 return (frame_size); 00202 } |
|
Definition at line 98 of file cmt_vector.h. 00099 { 00100 clear (); 00101 00102 cmt_vector<T>& me = *this; 00103 00104 extend (other._size); 00105 for (int i = 0; i < _size; i++) 00106 { 00107 element_at (i) = other.element_at (i); 00108 } 00109 00110 return (me); 00111 } |
|
Definition at line 128 of file cmt_vector.h. 00129 { 00130 if ((_data == 0) || 00131 (index < 0) || 00132 (index >= _size)) 00133 { 00134 static T object; 00135 return (object); 00136 } 00137 else 00138 { 00139 return (element_at (index)); 00140 } 00141 } |
|
Definition at line 113 of file cmt_vector.h. 00114 { 00115 if ((_data == 0) || 00116 (index < 0) || 00117 (index >= _size)) 00118 { 00119 static T object; 00120 return (object); 00121 } 00122 else 00123 { 00124 return (element_at (index)); 00125 } 00126 } |
|
Definition at line 76 of file cmt_vector.h. 00077 { 00078 if (_size > 0) _size--; 00079 } |
|
Definition at line 64 of file cmt_vector.h. Referenced by Use::add(), Tag::add(), Tag::add_tag_exclude(), Tag::add_tag_ref(), DependencyAnalyzer::add_use(), Use::get_paths(), cmt_node_set::push(), and cmt_and_node::reduce(). 00065 { 00066 extend (1); 00067 element_at (_size - 1) = object; 00068 } |
|
Definition at line 171 of file cmt_vector.h. Referenced by add(). 00172 { 00173 if (new_size < 0) return; 00174 00175 extend (new_size - _size); 00176 _size = new_size; 00177 } |
|
|
Definition at line 272 of file cmt_vector.h. |
|
Definition at line 273 of file cmt_vector.h. |
|
Definition at line 274 of file cmt_vector.h. |