Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

cmt_vector< T > Class Template Reference

#include <cmt_vector.h>

List of all members.

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_vectoroperator= (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

template<class T>
class cmt_vector< T >


Member Typedef Documentation

template<class T>
typedef T* cmt_vector< T >::element_ptr
 

Definition at line 16 of file cmt_vector.h.

template<class T>
typedef T cmt_vector< T >::element_type
 

Definition at line 15 of file cmt_vector.h.

template<class T>
typedef T** cmt_vector< T >::frame_ptr
 

Definition at line 17 of file cmt_vector.h.


Member Enumeration Documentation

template<class T>
anonymous enum [private]
 

Enumeration values:
frame_size 

Definition at line 212 of file cmt_vector.h.

00212 {frame_size = 4};


Constructor & Destructor Documentation

template<class T>
cmt_vector< T >::cmt_vector  )  [inline]
 

Definition at line 19 of file cmt_vector.h.

00020     {
00021       _data = 0;
00022       _frames = 0;
00023       _size = 0;
00024     }

template<class T>
cmt_vector< T >::cmt_vector const cmt_vector< T > &  other  )  [inline]
 

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     }

template<class T>
cmt_vector< T >::cmt_vector int  n  )  [inline]
 

Definition at line 41 of file cmt_vector.h.

00042     {
00043       _data = 0;
00044       _frames = 0;
00045       _size = 0;
00046 
00047       extend (n);
00048     }

template<class T>
cmt_vector< T >::~cmt_vector  )  [inline]
 

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     }


Member Function Documentation

template<class T>
T& cmt_vector< T >::add  )  [inline]
 

Definition at line 76 of file cmt_vector.h.

Referenced by Language::action(), Constituent::action(), Use::add(), Libmap::add(), Tag::add(), Script::add(), Project::add(), IgnorePattern::add(), ApplyPattern::add(), Pattern::add(), PatternList::add(), Language::add(), Include::add(), Group::add(), Fragment::add(), Constituent::add(), CmtPathPattern::add(), Branch::add(), Constituent::add_for_action(), DependencyAnalyzer::add_trigger(), Libmap::add_trigger(), Libmap::add_use(), Symbol::add_value_to_list(), Symbol::all_set(), Use::create(), Symbol::create(), Use::current(), Cmt::do_broadcast(), Cmt::do_set_versions(), ArgParser::do_show(), CmtModel::expand(), ArgParser::fill_arguments(), ArgParser::fill_one_argument(), ArgParser::fill_one_argument_filtered(), Project::fill_selection(), CmtGenerator::get_all_files(), Use::reach_package(), PackageSelector::run(), CmtSystem::scan_dir(), constituents_action_iterator::set(), CmtSystem::split(), and CmtModel::strict_expand().

00077     {
00078       resize (size() + 1);
00079       return (back ());
00080     }

template<class T>
T& cmt_vector< T >::back  )  [inline]
 

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     }

template<class T>
T& cmt_vector< T >::back  )  const [inline]
 

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     }

template<class T>
void cmt_vector< T >::clear  )  [inline]
 

Definition at line 190 of file cmt_vector.h.

Referenced by Symbol::add_value_to_list(), Symbol::all_set(), ArgParser::ArgParser(), Use::clear(), Tag::clear(), Project::clear(), PatternList::clear(), Language::clear(), DepsBuilder::clear(), Constituent::clear(), Package::clear_all(), Use::clear_all(), Tag::clear_all(), Symbol::clear_all(), Project::clear_all(), Pattern::clear_all(), PatternList::clear_all(), Language::clear_all(), Group::clear_all(), Fragment::clear_all(), Constituent::clear_all(), CmtPathPattern::clear_all(), Branch::clear_all(), Symbol::create(), Cmt::do_broadcast(), PatternCache::do_update(), CmtGenerator::get_all_files(), get_best_form(), cmt_vector< Pattern >::operator=(), Constituent::parse(), ArgParser::parse(), Package::remove_use(), UseProjectAction::run(), DepsBuilder::run(), CmtSystem::scan_dir(), Use::show_cycles(), CmtSystem::split(), StrategyMgr::StrategyMgr(), and CmtModel::strict_expand().

00191     {
00192       _size = 0;
00193     }

template<class T>
T& cmt_vector< T >::element_at int  index  )  const [inline, private]
 

Definition at line 220 of file cmt_vector.h.

00221     {
00222       int frame = index / frame_size;
00223       return (_data[frame][index % frame_size]);
00224     }

template<class T>
T& cmt_vector< T >::element_at int  index  )  [inline, private]
 

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     }

template<class T>
void cmt_vector< T >::erase int  index  )  [inline]
 

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     }

template<class T>
void cmt_vector< T >::extend int  n  )  [inline, private]
 

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     }

template<class T>
int cmt_vector< T >::frames int  n  )  [inline, private]
 

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     }

template<class T>
frame_ptr cmt_vector< T >::get_frame  )  const [inline]
 

Definition at line 195 of file cmt_vector.h.

00196       {
00197         return (_data);
00198       }

template<class T>
int cmt_vector< T >::get_frame_number  )  const [inline]
 

Definition at line 200 of file cmt_vector.h.

00201       {
00202         return (_frames);
00203       }

template<class T>
int cmt_vector< T >::get_frame_size  )  const [inline]
 

Definition at line 205 of file cmt_vector.h.

00206       {
00207         return (frame_size);
00208       }

template<class T>
cmt_vector& cmt_vector< T >::operator= const cmt_vector< T > &  other  )  [inline]
 

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     }

template<class T>
T& cmt_vector< T >::operator[] int  index  )  [inline]
 

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     }

template<class T>
T& cmt_vector< T >::operator[] int  index  )  const [inline]
 

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     }

template<class T>
void cmt_vector< T >::pop_back  )  [inline]
 

Definition at line 82 of file cmt_vector.h.

00083     {
00084       if (_size > 0) _size--;
00085     }

template<class T>
void cmt_vector< T >::push_back const T &  object  )  [inline]
 

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     }

template<class T>
void cmt_vector< T >::resize int  new_size  )  [inline]
 

Definition at line 177 of file cmt_vector.h.

Referenced by cmt_vector< Pattern >::add(), and StandardMacroBuilder::fill_for_all_constituents().

00178     {
00179       if (new_size < 0) return;
00180 
00181       extend (new_size - _size);
00182       _size = new_size;
00183     }

template<class T>
int cmt_vector< T >::size  )  const [inline]
 

Definition at line 185 of file cmt_vector.h.

Referenced by Use::action(), Tag::action(), KwdSetupStrategy::action(), KwdIncludePath::action(), KwdBuildStrategy::action(), Symbol::action(), IgnorePattern::action(), ApplyPattern::action(), Pattern::action(), Include::action(), Fragment::action(), CmtPathPattern::action(), Branch::action(), Tag::action_apply(), Tag::action_exclude(), cmt_vector< Pattern >::add(), Use::add(), Pattern::add(), CmtPathPattern::add(), add_cmt_paths_from_text(), DepsBuilder::add_includes(), PatternList::add_pattern(), Tag::add_tag_exclude(), Tag::add_tag_ref(), DependencyAnalyzer::add_trigger(), Package::add_use(), Symbol::add_value_to_list(), Symbol::all_print(), Script::all_print(), Symbol::all_print_clean(), Script::all_print_clean(), Symbol::all_set(), LibraryGenerator::analyze_file(), Pattern::apply(), CmtPathPattern::apply_all(), PatternList::apply_all_globals(), Use::apply_global_patterns(), Use::author_action(), Project::broadcast(), ActionBuilder::build(), ScriptBuilder::build(), MacroBuilder::build(), PathBuilder::build(), SetBuilder::build(), DependencyGenerator::build(), ConstituentsMakefileGenerator::build(), MakeSetupGenerator::build(), ReadmeGenerator::build(), DocumentGenerator::build(), LibraryGenerator::build(), Constituent::build_all_makefiles(), Constituent::build_all_msdev_files(), Constituent::build_all_vsnet_files(), build_deps(), Use::build_library_links(), VSNETGenerator::build_project(), MSDEVGenerator::build_project(), VSNETGenerator::build_workspace(), MSDEVGenerator::build_workspace(), CmtLock::check(), Tag::check_tag_used(), Symbol::check_tag_used(), CvsImplementation::checkout(), PathBuilder::clean(), Use::clear_all(), Tag::clear_all(), Project::clear_all(), Pattern::clear_all(), PatternList::clear_all(), Language::clear_all(), Group::clear_all(), Fragment::clear_all(), Constituent::clear_all(), CmtPathPattern::clear_all(), Branch::clear_all(), CmtInstallAreaMgr::config(), Fragment::copy(), Use::create(), ProjectFactory::create_project(), Use::current(), Cmt::do_awk(), Cmt::do_broadcast(), Cmt::do_build_constituent_makefile(), Cmt::do_build_dependencies(), Cmt::do_build_library_links(), Cmt::do_build_msdev(), Cmt::do_build_os9_makefile(), Cmt::do_build_prototype(), Cmt::do_build_triggers(), Cmt::do_build_vsnet(), Cmt::do_build_windefs(), Cmt::do_check_configuration(), Cmt::do_check_files(), Cmt::do_check_version(), Cmt::do_config(), Cmt::do_create(), Cmt::do_create_project(), Cmt::do_do(), Cmt::do_expand_model(), Cmt::do_filter(), SyntaxParser::do_parse_line(), SyntaxParser::do_parse_words(), Cmt::do_remove(), Cmt::do_remove_library_links(), Cmt::do_run(), Cmt::do_run_sequence(), Cmt::do_set_version(), Cmt::do_show_action(), Cmt::do_show_action_names(), Cmt::do_show_actions(), Cmt::do_show_all_tags(), Cmt::do_show_clients(), Cmt::do_show_constituent(), Cmt::do_show_fragment(), Cmt::do_show_include_dirs(), Cmt::do_show_language(), Cmt::do_show_macro(), Cmt::do_show_macro_names(), Cmt::do_show_macros(), Cmt::do_show_packages(), Cmt::do_show_pattern(), Cmt::do_show_set_names(), Cmt::do_show_sets(), Cmt::do_show_tags(), Cmt::do_show_versions(), ApplicationAnalyzer::end(), LibraryAnalyzer::end(), CmtModel::expand(), StandardMacroBuilder::fill_for_all_constituents(), StandardMacroBuilder::fill_for_constituent_macros(), StandardMacroBuilder::fill_for_fincludes(), StandardMacroBuilder::fill_for_includes(), StandardMacroBuilder::fill_for_use_cflags(), StandardMacroBuilder::fill_for_use_cppflags(), StandardMacroBuilder::fill_for_use_fflags(), StandardMacroBuilder::fill_for_use_fincludes(), StandardMacroBuilder::fill_for_use_includes(), StandardMacroBuilder::fill_for_use_libraries(), StandardMacroBuilder::fill_for_use_linkopts(), StandardMacroBuilder::fill_for_use_pp_cflags(), StandardMacroBuilder::fill_for_use_pp_cppflags(), StandardMacroBuilder::fill_for_use_pp_fflags(), StandardMacroBuilder::fill_for_use_requirements(), StandardMacroBuilder::fill_for_use_stamps(), Use::fill_includes_macro(), Use::fill_macro_all(), Project::fill_selection(), DependencyAnalyzer::filter(), TriggerAnalyzer::filter(), SequenceRunner::filter(), CmtMountFilterParser::filter(), Packager::filter(), WinDefAwk::filter(), RecursivePass4::filter(), RecursivePass3::filter(), RecursivePass2::filter(), RecursivePass1::filter(), Cut::filter(), CvsImplementation::filter_list(), Use::find(), Libmap::find(), Script::find(), IgnorePattern::find(), PatternList::find(), Language::find(), Include::find(), Group::find(), Fragment::find(), Variable::find(), Constituent::find(), Branch::find(), Project::find_by_cmtpath(), Project::find_by_name(), Project::find_in_cmt_paths(), Use::find_index(), CvsImplementation::find_matching_version(), find_path_entry(), PatternList::find_pattern(), StrategyMgr::find_strategy(), Language::find_with_suffix(), Libmap::find_with_trigger(), Use::get_all_clients(), CmtGenerator::get_all_files(), get_best_form(), Project::get_child(), Project::get_children_size(), Project::get_current(), Use::get_paths(), get_release_from_path(), Use::get_selected_version(), use_action_iterator::get_use(), Project::has_child(), Project::has_parent(), header_file_action(), Tag::install(), CmtSystem::is_package_directory(), Tag::is_primary(), Tag::is_selected(), Symbol::is_selected(), Use::manager_action(), Tag::mark(), CvsImplementation::match_version_request(), CmtSystem::mkdir(), Use::move(), Use::move_to(), ArgParser::option_tag(), ArgParser::option_tag_add(), ArgParser::option_tag_remove(), ArgParser::option_use(), Constituent::parse(), Constituent::parse_all(), Cmt::parser(), Pattern::pattern_number(), CmtPathPattern::pattern_number(), CmtGenerator::prepare_use_context(), Cmt::print(), Include::print_all(), Branch::print_all(), Cmt::print_clean(), Include::print_filters(), Cmt::print_macros(), Use::reach_package(), CvsImplementation::really_checkout_package_contents(), CmtSystem::remove_directory(), Package::remove_use(), Use::reorder(), Cmt::restore_all_tags(), Tag::restore_tree(), Project::reverse_broadcast(), UseProjectAction::run(), UseAnalyzer::run(), ClientCollector::run(), DepsBuilder::run(), PathScanner::scan_package(), PathScanner::scan_path(), Project::scan_paths(), Project::scan_paths_for_package(), Use::select_alternate(), Use::select_clients(), SymbolValueList::select_first(), SymbolValueList::select_last(), Use::set_auto_imports(), Use::set_auto_imports_state(), Project::set_strategy(), Libmap::set_used(), Language::setup_all_fragments(), Project::show(), Pattern::show(), Language::show(), Constituent::show(), Use::show_all(), Project::show_all(), Language::show_all(), Group::show_all(), Fragment::show_all(), Constituent::show_all(), CmtPathPattern::show_all(), Pattern::show_all_applied_patterns(), PatternList::show_all_pattern_names(), PatternList::show_all_patterns(), Use::show_cycles(), Tag::show_definition(), Language::show_names(), Constituent::show_names(), show_packages(), Project::show_specified_strategies_for_all(), Use::show_sub_uses(), Project::start_visit(), CmtModel::strict_expand(), Symbol::symbol_number(), Tag::tag_number(), CvsImplementation::tags(), Use::undiscard_all(), Tag::unmark_all(), Use::unselect_all(), Project::update_strategies_from_children(), Project::update_strategy(), Project::update_strategy_from_children(), Project::use_action(), Tag::use_operand(), Tag::use_ref(), Cmt::vector_to_string(), Project::visit(), and Fragment::wincopy().

00186     {
00187       return (_size);
00188     }


Member Data Documentation

template<class T>
frame_ptr cmt_vector< T >::_data [private]
 

Definition at line 278 of file cmt_vector.h.

template<class T>
int cmt_vector< T >::_frames [private]
 

Definition at line 279 of file cmt_vector.h.

template<class T>
int cmt_vector< T >::_size [private]
 

Definition at line 280 of file cmt_vector.h.

Referenced by cmt_vector< Pattern >::cmt_vector(), and cmt_vector< Pattern >::operator=().


The documentation for this class was generated from the following file:
Generated on Mon May 2 10:25:31 2005 for CMT by doxygen 1.3.5