#include <cmt_vector.h>
Public Types | |
typedef T | element_type |
typedef T * | element_ptr |
typedef T ** | frame_ptr |
Public Member Functions | |
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 = 4 } |
Private Member Functions | |
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 16 of file cmt_vector.h. |
|
Definition at line 15 of file cmt_vector.h. |
|
Definition at line 17 of file cmt_vector.h. |
|
Definition at line 212 of file cmt_vector.h.
00212 {frame_size = 4}; |
|
Definition at line 19 of file cmt_vector.h.
|
|
Definition at line 26 of file cmt_vector.h.
00027 { 00028 _data = 0; 00029 _frames = 0; 00030 _size = 0; 00031 00032 cmt_vector<T>& me = *this; 00033 00034 extend (other._size); 00035 for (int i = 0; i < _size; i++) 00036 { 00037 me.element_at (i) = other.element_at (i); 00038 } 00039 } |
|
Definition at line 41 of file cmt_vector.h.
|
|
Definition at line 50 of file cmt_vector.h.
00051 { 00052 if (_data != 0) 00053 { 00054 for (int i = 0; i < _frames; i++) 00055 { 00056 delete[] _data[i]; 00057 _data[i] = 0; 00058 } 00059 #ifdef CMT_USE_NEW_DELETE 00060 delete[] _data; 00061 #else 00062 free (_data); 00063 #endif 00064 } 00065 _data = 0; 00066 _frames = 0; 00067 _size = 0; 00068 } |
|
|
Definition at line 163 of file cmt_vector.h.
00164 { 00165 if ((_data == 0) || 00166 (_size == 0)) 00167 { 00168 static T object; 00169 return (object); 00170 } 00171 else 00172 { 00173 return (element_at (_size - 1)); 00174 } 00175 } |
|
Definition at line 149 of file cmt_vector.h. Referenced by cmt_vector< Pattern >::add(), and Symbol::add_value_to_list().
00150 { 00151 if ((_data == 0) || 00152 (_size == 0)) 00153 { 00154 static T object; 00155 return (object); 00156 } 00157 else 00158 { 00159 return (element_at (_size - 1)); 00160 } 00161 } |
|
|
Definition at line 220 of file cmt_vector.h.
00221 { 00222 int frame = index / frame_size; 00223 return (_data[frame][index % frame_size]); 00224 } |
|
Definition at line 214 of file cmt_vector.h. Referenced by cmt_vector< Pattern >::back(), cmt_vector< Pattern >::cmt_vector(), cmt_vector< Pattern >::erase(), cmt_vector< Pattern >::operator=(), cmt_vector< Pattern >::operator[](), and cmt_vector< Pattern >::push_back().
00215 { 00216 int frame = index / frame_size; 00217 return (_data[frame][index % frame_size]); 00218 } |
|
Definition at line 87 of file cmt_vector.h.
00088 { 00089 if ((_data == 0) || 00090 (index < 0) || 00091 (index >= _size)) 00092 { 00093 return; 00094 } 00095 00096 for (int i = index; i < (_size - 1); i++) 00097 { 00098 element_at (i) = element_at (i + 1); 00099 } 00100 00101 _size--; 00102 } |
|
Definition at line 231 of file cmt_vector.h. Referenced by cmt_vector< Pattern >::cmt_vector(), cmt_vector< Pattern >::operator=(), cmt_vector< Pattern >::push_back(), and cmt_vector< Pattern >::resize().
00232 { 00233 if (n <= 0) return; 00234 00235 _size += n; 00236 00237 int f = frames (_size); 00238 if (f > _frames) 00239 { 00240 if (_data == 0) 00241 { 00242 00243 #ifdef CMT_USE_NEW_DELETE 00244 _data = new element_ptr [f]; 00245 #else 00246 _data = (frame_ptr) malloc (f * sizeof (element_ptr)); 00247 #endif 00248 00249 } 00250 else 00251 { 00252 00253 #ifdef CMT_USE_NEW_DELETE 00254 frame_ptr new_data; 00255 00256 new_data = new element_ptr [f]; 00257 for (int i = 0; i < _frames; i++) 00258 { 00259 new_data[i] = _data[i]; 00260 } 00261 delete[] _data; 00262 _data = new_data; 00263 #else 00264 _data = (frame_ptr) realloc (_data, f * sizeof (element_ptr)); 00265 #endif 00266 00267 } 00268 00269 for (int i = _frames; i < f; i++) 00270 { 00271 _data[i] = new T[frame_size]; 00272 } 00273 00274 _frames = f; 00275 } 00276 } |
|
Definition at line 226 of file cmt_vector.h. Referenced by cmt_vector< Pattern >::extend().
00227 { 00228 return ((n == 0) ? 0 : ((n - 1) / frame_size) + 1); 00229 } |
|
Definition at line 195 of file cmt_vector.h.
00196 { 00197 return (_data); 00198 } |
|
Definition at line 200 of file cmt_vector.h.
00201 { 00202 return (_frames); 00203 } |
|
Definition at line 205 of file cmt_vector.h.
00206 { 00207 return (frame_size); 00208 } |
|
Definition at line 104 of file cmt_vector.h.
00105 { 00106 clear (); 00107 00108 cmt_vector<T>& me = *this; 00109 00110 extend (other._size); 00111 for (int i = 0; i < _size; i++) 00112 { 00113 element_at (i) = other.element_at (i); 00114 } 00115 00116 return (me); 00117 } |
|
Definition at line 134 of file cmt_vector.h.
00135 { 00136 if ((_data == 0) || 00137 (index < 0) || 00138 (index >= _size)) 00139 { 00140 static T object; 00141 return (object); 00142 } 00143 else 00144 { 00145 return (element_at (index)); 00146 } 00147 } |
|
Definition at line 119 of file cmt_vector.h.
00120 { 00121 if ((_data == 0) || 00122 (index < 0) || 00123 (index >= _size)) 00124 { 00125 static T object; 00126 return (object); 00127 } 00128 else 00129 { 00130 return (element_at (index)); 00131 } 00132 } |
|
Definition at line 82 of file cmt_vector.h.
|
|
Definition at line 70 of file cmt_vector.h. Referenced by Use::add(), Tag::add(), DepsBuilder::add(), Project::add_child(), Project::add_parent(), PatternList::add_pattern(), Tag::add_tag_exclude(), Tag::add_tag_ref(), Package::add_use(), PatternCache::do_update(), StandardMacroBuilder::fill_for_all_constituents(), Use::get_paths(), header_file_action(), cmt_and_node::reduce(), Package::remove_use(), DepsBuilder::run(), Use::show_cycles(), and StrategyMgr::StrategyMgr().
00071 { 00072 extend (1); 00073 element_at (_size - 1) = object; 00074 } |
|
Definition at line 177 of file cmt_vector.h. Referenced by cmt_vector< Pattern >::add(), and StandardMacroBuilder::fill_for_all_constituents().
|
|
|
Definition at line 278 of file cmt_vector.h. |
|
Definition at line 279 of file cmt_vector.h. |
|
Definition at line 280 of file cmt_vector.h. Referenced by cmt_vector< Pattern >::cmt_vector(), and cmt_vector< Pattern >::operator=(). |