#include <cmt_project.h>
Collaboration diagram for Project:
Public Types | |
typedef cmt_vector< Project > | ProjectVector |
typedef cmt_vector< Project * > | ProjectPtrVector |
Public Member Functions | |
Project () | |
const cmt_string & | get_name () const |
const cmt_string & | get_release () const |
const cmt_string & | get_container () const |
const cmt_string & | get_container_version () const |
const cmt_string & | get_cmtpath () const |
const cmt_string & | get_cmtpath_pwd () const |
const cmt_string & | get_cmtpath_source () const |
int | get_children_size () const |
Project * | get_child (int index) const |
bool | visited () const |
void | set_name (const cmt_string &name) |
void | set_release (const cmt_string &release) |
void | set_container (const cmt_string &container) |
void | set_container_version (const cmt_string &version) |
void | set_cmtpath (const cmt_string &path) |
void | set_cmtpath_pwd (const cmt_string &path) |
void | set_cmtpath_source (const cmt_string &source) |
void | clear () |
void | configure () |
bool | has_parent (Project *p) const |
bool | has_child (Project *p) const |
void | add_parent (Project *p) |
void | add_child (Project *p) |
void | container_action (const cmt_string &name, const cmt_string &version) |
--------------------------------------------------------- A container statement is met in the project file | |
void | use_action (const cmt_string &name, const cmt_string &release) |
--------------------------------------------------------- A use statement is met in the project file | |
Project & | operator= (const Project &other) |
bool | operator== (const cmt_string &name) const |
bool | operator!= (const cmt_string &name) const |
void | show () |
void | show_specified_strategies () const |
bool | has_strategy (const StrategyDef *definition) const |
bool | is_specified (const StrategyDef *definition) const |
bool | get_strategy (const StrategyDef *definition) const |
bool | get_strategy (const cmt_string &name) const |
void | set_default_strategy (const cmt_string &name) |
void | set_strategy (const cmt_string &name, const cmt_string &value, const cmt_string &context) |
void | set_strategy (StrategyDef *definition, bool b_value, const cmt_string &context) |
void | update_strategy (StrategyDef *definition, bool b_value) |
---------------------------------------------------------- The strategy value is changed because of indirect influences - default strategy at initialization time - change in the children - change in the children list | |
void | update_strategy_from_children (StrategyDef *definition) |
---------------------------------------------------------- At least one of the children has changed this strategy Or the list of children has changed. | |
void | update_strategies_from_children () |
---------------------------------------------------------- At least one of the children has changed its strategies Or the list of children has changed. | |
void | visit (IProjectVisitor &visitor) |
Static Public Member Functions | |
void | create (const cmt_string &name, const cmt_string &release, const cmt_string &path) |
Project * | find_by_name (const cmt_string &name) |
Project * | find_by_cmtpath (const cmt_string &cmtpath) |
Project * | get_current () |
Project * | add (const cmt_string &name, const cmt_string &release) |
ProjectVector & | projects () |
void | clear_all () |
void | show_all () |
void | show_specified_strategies_for_all () |
void | show_paths () |
const cmt_string & | get_project_file_name () |
void | fill_selection (int depth, CmtSystem::cmt_string_vector &path_selections) |
void | broadcast (IProjectAction &action) |
void | reverse_broadcast (IProjectAction &action) |
void | scan_paths (PathScanner &scanner, PathScanner::actor &actor) |
void | scan_paths_for_package (PathScanner &scanner, const cmt_string &name) |
cmt_string | find_in_cmt_paths (const cmt_string &path) |
void | fill_cmtpaths (cmt_string &buffer) |
void | start_visit (IProjectVisitor &visitor) |
Private Member Functions | |
void | fill_cmtpath (cmt_string &buffer) |
Private Attributes | |
cmt_string | m_name |
cmt_string | m_release |
cmt_string | m_container |
cmt_string | m_container_version |
ProjectPtrVector | m_parents |
ProjectPtrVector | m_children |
bool | m_visited |
cmt_string | m_cmtpath |
cmt_string | m_cmtpath_pwd |
cmt_string | m_cmtpath_source |
bool | m_configured |
cmt_vector< Strategy > | m_strategies |
|
Definition at line 95 of file cmt_project.h. |
|
Definition at line 94 of file cmt_project.h. Referenced by add(), broadcast(), clear_all(), ProjectFactory::create_project(), fill_selection(), find_by_cmtpath(), find_by_name(), find_in_cmt_paths(), get_current(), projects(), Database::projects(), reverse_broadcast(), scan_paths(), scan_paths_for_package(), show_all(), show_specified_strategies_for_all(), and start_visit(). |
|
Definition at line 1101 of file cmt_project.cxx. References clear().
|
|
Definition at line 715 of file cmt_project.cxx. References cmt_vector< T >::add(), clear(), configure(), find_by_name(), Cmt::get_quiet(), get_release(), projects(), ProjectVector, CmtError::set(), set_name(), and set_release(). Referenced by ProjectFactory::create_project().
00717 { 00718 static ProjectVector& Projects = projects (); 00719 00720 //cout << "Project::add> name=" << name << endl; 00721 00722 { 00723 Project* project; 00724 00725 project = find_by_name (name); 00726 if (project != 0) 00727 { 00728 if (!Cmt::get_quiet ()) 00729 { 00730 if (release != project->get_release ()) 00731 { 00732 cerr << "#CMT> Project " << name << " requested with conflicting releases " << project->get_release () << " and " << release << endl; 00733 CmtError::set (CmtError::project_release_conflict, name); 00734 } 00735 } 00736 00737 // Project objects are recreated here to follow the hierarchy 00738 // This duplication is needed for properly applying the strategies 00739 Project& p = Projects.add (); 00740 00741 p.set_name (name); 00742 p.set_release (release); 00743 p.configure (); 00744 00745 return (&p); 00746 00747 //return (project); 00748 } 00749 } 00750 00751 Project& project = Projects.add (); 00752 project.clear (); 00753 project.set_name (name); 00754 project.set_release (release); 00755 project.configure (); 00756 00757 return (&project); 00758 } |
|
Definition at line 1304 of file cmt_project.cxx. References has_child(), has_parent(), m_children, and cmt_vector< T >::push_back(). Referenced by ProjectFactory::create_project(), and use_action().
01305 { 01306 if (p == 0) return; 01307 if (p == this) return; 01308 01309 if (has_child (p)) return; 01310 if (has_parent (p)) return; 01311 01312 m_children.push_back (p); 01313 } |
|
Definition at line 1290 of file cmt_project.cxx. References has_child(), has_parent(), m_parents, and cmt_vector< T >::push_back(). Referenced by ProjectFactory::create_project(), and use_action().
01291 { 01292 if (p == 0) return; 01293 if (p == this) return; 01294 01295 //cerr << "Adding parent " << p->get_name () << " to " << m_name << endl; 01296 01297 if (has_child (p)) return; 01298 if (has_parent (p)) return; 01299 01300 m_parents.push_back (p); 01301 } |
|
Definition at line 896 of file cmt_project.cxx. References projects(), ProjectVector, IProjectAction::run(), and cmt_vector< T >::size(). Referenced by Use::move_to().
00897 { 00898 static ProjectVector& Projects = projects (); 00899 00900 for (int i = 0; i < Projects.size (); i++) 00901 { 00902 const Project& project = Projects[i]; 00903 00904 if (!action.run (project)) break; 00905 } 00906 } |
|
Definition at line 1211 of file cmt_project.cxx. References cmt_vector< Strategy >::clear(), cmt_vector< T >::clear(), m_children, m_cmtpath, m_cmtpath_pwd, m_cmtpath_source, m_configured, m_name, m_parents, m_release, and m_strategies. Referenced by add(), clear_all(), and Project().
01212 { 01213 m_name = ""; 01214 m_release = ""; 01215 m_cmtpath = ""; 01216 m_cmtpath_pwd = ""; 01217 m_cmtpath_source = ""; 01218 01219 m_parents.clear (); 01220 m_children.clear (); 01221 01222 m_configured = false; 01223 01224 m_strategies.clear (); 01225 } |
|
Definition at line 770 of file cmt_project.cxx. References cmt_vector< T >::clear(), clear(), projects(), ProjectVector, and cmt_vector< T >::size(). Referenced by Database::clear(), and ProjectFactory::reset().
00771 { 00772 static ProjectVector& Projects = projects (); 00773 00774 for (int i = 0; i < Projects.size (); i++) 00775 { 00776 Project& project = Projects[i]; 00777 project.clear (); 00778 } 00779 00780 Projects.clear (); 00781 } |
|
Definition at line 1316 of file cmt_project.cxx. References m_configured, and set_default_strategy(). Referenced by add().
01317 { 01318 if (m_configured) return; 01319 m_configured = true; 01320 01321 set_default_strategy ("SetupConfig"); 01322 set_default_strategy ("SetupRoot"); 01323 set_default_strategy ("SetupCleanup"); 01324 set_default_strategy ("BuildPrototypes"); 01325 set_default_strategy ("InstallArea"); 01326 } |
|
--------------------------------------------------------- A container statement is met in the project file
Definition at line 1331 of file cmt_project.cxx. References set_container(), and set_container_version(). Referenced by KwdContainer::action().
01332 { 01333 //cerr << "Container action " << name << " " << version << endl; 01334 01335 set_container (name); 01336 set_container_version (version); 01337 } |
|
Definition at line 554 of file cmt_project.cxx. References CmtSystem::cd(), ProjectPatcher::commit(), Cmt::get_cmt_version(), get_project_file_name(), CmtSystem::mkdir(), cmt_string::read(), Awk::run(), CmtSystem::test_directory(), and CmtSystem::test_file(). Referenced by Cmt::do_create_project().
00557 { 00558 cout << "------------------------------------------" << endl; 00559 cout << "Configuring environment for project " << name << " " << release; 00560 00561 if (path != "") 00562 { 00563 cout << " in " << path; 00564 } 00565 00566 cout << endl; 00567 cout << "CMT version " << Cmt::get_cmt_version () << "." << endl; 00568 cout << "------------------------------------------" << endl; 00569 00570 if (path != "") 00571 { 00572 if (!CmtSystem::mkdir (path)) 00573 { 00574 cout << "Cannot create the " << path << " directory" << endl; 00575 return; 00576 } 00577 00578 if (!CmtSystem::cd (path)) 00579 { 00580 cout << "Cannot access the " << path << " directory" << endl; 00581 return; 00582 } 00583 } 00584 00585 if (!CmtSystem::mkdir (name)) 00586 { 00587 cout << "Cannot create the " << name << " directory" << endl; 00588 return; 00589 } 00590 00591 if (!CmtSystem::cd (name)) 00592 { 00593 cout << "Cannot access the " << name << " directory" << endl; 00594 return; 00595 } 00596 00597 if (release != "") 00598 { 00599 if (!CmtSystem::mkdir (release)) 00600 { 00601 cout << "Cannot create the " << release << " directory" << endl; 00602 return; 00603 } 00604 00605 if (!CmtSystem::cd (release)) 00606 { 00607 cout << "Cannot access the " << release << " directory" << endl; 00608 return; 00609 } 00610 } 00611 00612 if (!CmtSystem::test_directory ("cmt")) 00613 { 00614 if (!CmtSystem::mkdir ("cmt")) 00615 { 00616 cout << "Cannot create the cmt directory" << endl; 00617 return; 00618 } 00619 else 00620 { 00621 cout << "Installing the cmt directory" << endl; 00622 } 00623 } 00624 00625 CmtSystem::cd ("cmt"); 00626 00627 if (!CmtSystem::test_file (get_project_file_name ())) 00628 { 00629 cout << "Creating a new project file" << endl; 00630 00631 ofstream f (get_project_file_name ()); 00632 if (f) 00633 { 00634 f << "project " << name << endl; 00635 f << endl; 00636 f.close (); 00637 } 00638 } 00639 else 00640 { 00641 cmt_string text; 00642 text.read (get_project_file_name ()); 00643 00644 ProjectPatcher p (name); 00645 00646 p.run (text); 00647 p.commit (); 00648 00649 cout << "project file already there" << endl; 00650 } 00651 } |
|
|
|
Definition at line 1087 of file cmt_project.cxx. References start_visit(). Referenced by Cmt::guess_current_project().
01088 { 01089 /* 01090 Try to re-create all CMTPATH items from project definitions. 01091 The goal is to generate CMTPATH even if this EV was not pre-set 01092 which is the case when CMTPROJECTPATH is only used 01093 */ 01094 01095 VisitorForFillCMTPATH visitor (buffer); 01096 01097 start_visit (visitor); 01098 } |
|
Definition at line 867 of file cmt_project.cxx. References cmt_vector< T >::add(), CmtSystem::cmt_string_vector, get_cmtpath(), get_cmtpath_pwd(), get_cmtpath_source(), projects(), ProjectVector, and cmt_vector< T >::size(). Referenced by Cmt::do_broadcast().
00868 { 00869 static ProjectVector& Projects = projects (); 00870 00871 for (int i = 0; i < Projects.size (); i++) 00872 { 00873 Project& project = Projects[i]; 00874 00875 const cmt_string& p = project.get_cmtpath (); 00876 const cmt_string& pwd = project.get_cmtpath_pwd (); 00877 const cmt_string& src = project.get_cmtpath_source (); 00878 00879 if (src != "default path") 00880 { 00881 if (depth > 0) 00882 { 00883 cmt_string& s1 = path_selections.add (); 00884 s1 = p; 00885 cmt_string& s2 = path_selections.add (); 00886 s2 = pwd; 00887 depth--; 00888 00889 if (depth == 0) break; 00890 } 00891 } 00892 } 00893 } |
|
Definition at line 669 of file cmt_project.cxx. References CmtSystem::compress_path(), m_cmtpath, m_cmtpath_pwd, projects(), ProjectVector, and cmt_vector< T >::size(). Referenced by KwdSetupStrategy::action(), KwdBuildStrategy::action(), Use::fill_standard_macros(), get_strategy(), and CmtInstallAreaMgr::setup_current_installarea().
00670 { 00671 cmt_string compressed_path = cmtpath; 00672 CmtSystem::compress_path (compressed_path); 00673 00674 static ProjectVector& Projects = projects (); 00675 00676 for (int i = 0; i < Projects.size (); i++) 00677 { 00678 Project& p = Projects[i]; 00679 00680 if (p.m_cmtpath == compressed_path) return (&p); 00681 if (p.m_cmtpath_pwd == compressed_path) return (&p); 00682 } 00683 00684 return (0); 00685 } |
|
Definition at line 654 of file cmt_project.cxx. References m_name, projects(), ProjectVector, and cmt_vector< T >::size(). Referenced by add(), and use_action().
00655 { 00656 static ProjectVector& Projects = projects (); 00657 00658 for (int i = 0; i < Projects.size (); i++) 00659 { 00660 Project& p = Projects[i]; 00661 00662 if (p.m_name == name) return (&p); 00663 } 00664 00665 return (0); 00666 } |
|
Definition at line 950 of file cmt_project.cxx. References cmt_string::find(), m_cmtpath, m_cmtpath_pwd, m_cmtpath_source, projects(), ProjectVector, CmtSystem::pwd(), cmt_vector< T >::size(), and CmtSystem::test_directory(). Referenced by CmtInstallAreaMgr::build_current_installarea(), Cmt::configure_current_cmtpath(), Cmt::do_broadcast(), Use::get_cmtpath_and_offset(), and Cmt::guess_current_project().
00951 { 00952 const cmt_string pwd = CmtSystem::pwd (); 00953 00954 static ProjectVector& Projects = projects (); 00955 00956 for (int i = 0; i < Projects.size (); i++) 00957 { 00958 const Project& project = Projects[i]; 00959 00960 const cmt_string& p = project.m_cmtpath; 00961 const cmt_string& w = project.m_cmtpath_pwd; 00962 const cmt_string& s = project.m_cmtpath_source; 00963 00964 if (s == "default path") continue; 00965 00966 if (CmtSystem::test_directory (p)) 00967 { 00968 if (path.find (p) != cmt_string::npos) 00969 { 00970 return (p); 00971 } 00972 00973 // To become the current area, a path must correspond to the current package 00974 if (path.find (w) != cmt_string::npos) 00975 { 00976 return (p); 00977 } 00978 } 00979 00980 if (p == w) continue; 00981 00982 if (CmtSystem::test_directory (w)) 00983 { 00984 if (path.find (w) != cmt_string::npos) 00985 { 00986 return (w); 00987 } 00988 } 00989 } 00990 00991 return (""); 00992 } |
|
Definition at line 1155 of file cmt_project.cxx. References m_children, and cmt_vector< T >::size(). Referenced by visit().
01156 { 01157 if (index < 0) return (0); 01158 if (index >= m_children.size ()) return (0); 01159 return (m_children[index]); 01160 } |
|
Definition at line 1149 of file cmt_project.cxx. References m_children, and cmt_vector< T >::size(). Referenced by visit().
01150 { 01151 return (m_children.size ()); 01152 } |
|
Definition at line 1131 of file cmt_project.cxx. References m_cmtpath. Referenced by ProjectFactory::create_project(), fill_selection(), UseProjectAction::run(), and CmtPathPatternProjectAction::run().
01132 { 01133 return (m_cmtpath); 01134 } |
|
Definition at line 1137 of file cmt_project.cxx. References m_cmtpath_pwd. Referenced by ProjectFactory::create_project(), fill_selection(), VisitorForFillCMTPATH::in(), VisitorForShowPaths::in(), VisitorForFillCMTPATH::pre(), and VisitorForShowPaths::pre().
01138 { 01139 return (m_cmtpath_pwd); 01140 } |
|
Definition at line 1143 of file cmt_project.cxx. References m_cmtpath_source. Referenced by fill_selection(), VisitorForFillCMTPATH::in(), VisitorForShowPaths::in(), VisitorForFillCMTPATH::pre(), VisitorForShowPaths::pre(), and CmtPathPatternProjectAction::run().
01144 { 01145 return (m_cmtpath_source); 01146 } |
|
Definition at line 1119 of file cmt_project.cxx. References m_container.
01120 { 01121 return (m_container); 01122 } |
|
Definition at line 1125 of file cmt_project.cxx. References m_container_version.
01126 { 01127 return (m_container_version); 01128 } |
|
Definition at line 688 of file cmt_project.cxx. References cmt_string::find(), m_cmtpath, m_cmtpath_pwd, projects(), ProjectVector, CmtSystem::pwd(), and cmt_vector< T >::size(). Referenced by Cmt::do_show_strategies(), StandardMacroBuilder::fill_for_project(), show_all(), and start_visit().
00689 { 00690 cmt_string here = CmtSystem::pwd (); 00691 00692 static ProjectVector& Projects = projects (); 00693 00694 Project* result = 0; 00695 00696 for (int i = (Projects.size () - 1); i >= 0; i--) 00697 { 00698 Project& p = Projects[i]; 00699 00700 if (here.find (p.m_cmtpath_pwd) == 0) 00701 { 00702 result = &p; 00703 } 00704 00705 if (here.find (p.m_cmtpath) == 0) 00706 { 00707 result = &p; 00708 } 00709 } 00710 00711 return (result); 00712 } |
|
Definition at line 1107 of file cmt_project.cxx. References m_name. Referenced by ProjectFactory::create_project(), SyntaxParser::do_parse_words(), StandardMacroBuilder::fill_for_project(), Use::fill_standard_macros(), has_child(), has_parent(), CmtPathPatternProjectAction::run(), set_strategy(), CmtInstallAreaMgr::setup_current_installarea(), show(), and update_strategy().
01108 { 01109 return (m_name); 01110 } |
|
Definition at line 859 of file cmt_project.cxx. Referenced by create(), and Cmt::guess_current_project().
00860 { 00861 static const cmt_string name = "project.cmt"; 00862 00863 return (name); 00864 } |
|
Definition at line 1113 of file cmt_project.cxx. References m_release. Referenced by add(), ProjectFactory::create_project(), and Use::fill_standard_macros().
01114 { 01115 return (m_release); 01116 } |
|
Definition at line 1532 of file cmt_project.cxx. References StrategyMgr::find_strategy(), get_strategy(), and StrategyMgr::instance().
01533 { 01534 static StrategyMgr& mgr = StrategyMgr::instance (); 01535 01536 StrategyDef* def = mgr.find_strategy (name); 01537 if (def == 0) 01538 { 01539 cerr << "#CMT> strategy " << name << " undefined" << endl; 01540 return (false); 01541 } 01542 01543 return (get_strategy (def)); 01544 } |
|
Definition at line 1566 of file cmt_project.cxx. References StrategyDef::m_default_value, Strategy::m_definition, Strategy::m_specified, Strategy::m_specified_value, m_strategies, Strategy::m_value, and cmt_vector< Strategy >::size(). Referenced by get_strategy(), get_strategy(), and update_strategy_from_children().
01567 { 01568 int i; 01569 01570 for (i = 0; i < m_strategies.size (); i++) 01571 { 01572 Strategy& s = m_strategies[i]; 01573 if (s.m_definition == def) 01574 { 01575 // This strategy is applied in this project 01576 if (s.m_specified) 01577 { 01578 return (s.m_specified_value); 01579 } 01580 return (s.m_value); 01581 } 01582 } 01583 01584 // This strategy is not applied in this project 01585 return (def->m_default_value); 01586 } |
|
Definition at line 1259 of file cmt_project.cxx. References get_name(), m_children, and cmt_vector< T >::size(). Referenced by add_child(), and add_parent().
01260 { 01261 if (p == 0) return (false); 01262 if (p == this) return (false); 01263 01264 const cmt_string& name = p->get_name (); 01265 01266 int i; 01267 01268 for (i = 0; i < m_children.size (); i++) 01269 { 01270 const Project* child = m_children[i]; 01271 if (child == 0) continue; 01272 01273 if (child->get_name () == name) 01274 { 01275 // registered as a child 01276 return (true); 01277 } 01278 01279 if (child->has_child (p)) 01280 { 01281 // recurse 01282 return (true); 01283 } 01284 } 01285 01286 return (false); 01287 } |
|
Definition at line 1228 of file cmt_project.cxx. References get_name(), m_parents, and cmt_vector< T >::size(). Referenced by add_child(), and add_parent().
01229 { 01230 if (p == 0) return (false); 01231 if (p == this) return (false); 01232 01233 const cmt_string& name = p->get_name (); 01234 01235 int i; 01236 01237 for (i = 0; i < m_parents.size (); i++) 01238 { 01239 const Project* parent = m_parents[i]; 01240 if (parent == 0) continue; 01241 01242 if (parent->get_name () == name) 01243 { 01244 // registered as a parent 01245 return (true); 01246 } 01247 01248 if (parent->has_parent (p)) 01249 { 01250 // recurse 01251 return (true); 01252 } 01253 } 01254 01255 return (false); 01256 } |
|
Definition at line 1515 of file cmt_project.cxx. References Strategy::m_definition, m_strategies, and cmt_vector< Strategy >::size().
01516 { 01517 int i; 01518 01519 for (i = 0; i < m_strategies.size (); i++) 01520 { 01521 const Strategy& s = m_strategies[i]; 01522 if (s.m_definition == definition) 01523 { 01524 return (true); 01525 } 01526 } 01527 01528 return (false); 01529 } |
|
Definition at line 1547 of file cmt_project.cxx. References Strategy::m_definition, Strategy::m_specified, m_strategies, and cmt_vector< Strategy >::size(). Referenced by update_strategy_from_children().
01548 { 01549 int i; 01550 01551 for (i = 0; i < m_strategies.size (); i++) 01552 { 01553 Strategy& s = m_strategies[i]; 01554 if (s.m_definition == definition) 01555 { 01556 // This strategy is applied in this project 01557 return (s.m_specified); 01558 } 01559 } 01560 01561 // This strategy is not applied in this project 01562 return (false); 01563 } |
|
Definition at line 1428 of file cmt_project.cxx. References m_name.
01429 { 01430 return ((m_name != name)); 01431 } |
|
Definition at line 1411 of file cmt_project.cxx. References m_cmtpath, m_cmtpath_pwd, m_cmtpath_source, and m_name.
01412 { 01413 m_name = other.m_name; 01414 m_cmtpath = other.m_cmtpath; 01415 m_cmtpath_pwd = other.m_cmtpath_pwd; 01416 m_cmtpath_source = other.m_cmtpath_source; 01417 01418 return (*this); 01419 } |
|
Definition at line 1422 of file cmt_project.cxx. References m_name.
01423 { 01424 return ((m_name == name)); 01425 } |
|
Definition at line 761 of file cmt_project.cxx. References Database::instance(), Database::projects(), and ProjectVector. Referenced by add(), broadcast(), clear_all(), ProjectFactory::create_project(), fill_selection(), find_by_cmtpath(), find_by_name(), find_in_cmt_paths(), get_current(), reverse_broadcast(), scan_paths(), scan_paths_for_package(), show_all(), show_specified_strategies_for_all(), and start_visit().
00762 { 00763 static Database& db = Database::instance (); 00764 static ProjectVector& Projects = db.projects (); 00765 00766 return (Projects); 00767 } |
|
Definition at line 909 of file cmt_project.cxx. References projects(), ProjectVector, IProjectAction::run(), and cmt_vector< T >::size(). Referenced by CmtPathPattern::apply().
00910 { 00911 static ProjectVector& Projects = projects (); 00912 00913 for (int i = (Projects.size () - 1); i >= 0; i--) 00914 { 00915 const Project& project = Projects[i]; 00916 00917 if (!action.run (project)) break; 00918 } 00919 } |
|
Definition at line 922 of file cmt_project.cxx. References m_cmtpath, projects(), ProjectVector, PathScanner::scan_path(), and cmt_vector< T >::size(). Referenced by Cmt::do_broadcast(), Cmt::do_show_clients(), and Cmt::do_show_packages().
00923 { 00924 static ProjectVector& Projects = projects (); 00925 00926 for (int i = 0; i < Projects.size (); i++) 00927 { 00928 const Project& project = Projects[i]; 00929 00930 const cmt_string& p = project.m_cmtpath; 00931 scanner.scan_path (p, a); 00932 } 00933 } |
|
Definition at line 936 of file cmt_project.cxx. References m_cmtpath, projects(), ProjectVector, PathScanner::scan_package(), and cmt_vector< T >::size(). Referenced by Cmt::do_show_versions().
00937 { 00938 static ProjectVector& Projects = projects (); 00939 00940 for (int i = 0; i < Projects.size (); i++) 00941 { 00942 const Project& project = Projects[i]; 00943 00944 const cmt_string& p = project.m_cmtpath; 00945 scanner.scan_package (p, name); 00946 } 00947 } |
|
Definition at line 1193 of file cmt_project.cxx. References m_cmtpath. Referenced by ProjectFactory::create_project().
01194 { 01195 m_cmtpath = path; 01196 } |
|
Definition at line 1199 of file cmt_project.cxx. References m_cmtpath_pwd. Referenced by ProjectFactory::create_project().
01200 { 01201 m_cmtpath_pwd = path; 01202 } |
|
Definition at line 1205 of file cmt_project.cxx. References m_cmtpath_source. Referenced by ProjectFactory::create_project().
01206 { 01207 m_cmtpath_source = source; 01208 } |
|
Definition at line 1181 of file cmt_project.cxx. References m_container. Referenced by container_action().
01182 { 01183 m_container = container; 01184 } |
|
Definition at line 1187 of file cmt_project.cxx. References m_container_version. Referenced by container_action().
01188 { 01189 m_container_version = container_version; 01190 } |
|
Definition at line 1589 of file cmt_project.cxx. References StrategyMgr::find_strategy(), StrategyMgr::instance(), StrategyDef::m_default_value, and update_strategy(). Referenced by configure().
01590 { 01591 static StrategyMgr& mgr = StrategyMgr::instance (); 01592 01593 StrategyDef* def = mgr.find_strategy (name); 01594 if (def == 0) 01595 { 01596 cerr << "#CMT> strategy " << name << " undefined" << endl; 01597 return; 01598 } 01599 01600 update_strategy (def, def->m_default_value); 01601 } |
|
Definition at line 1169 of file cmt_project.cxx. References m_name. Referenced by add().
01170 { 01171 m_name = name; 01172 } |
|
Definition at line 1175 of file cmt_project.cxx. References m_release. Referenced by add().
01176 { 01177 m_release = release; 01178 } |
|
Definition at line 1636 of file cmt_project.cxx. References cmt_vector< Strategy >::add(), Strategy::clear(), get_name(), Strategy::m_context, Strategy::m_definition, m_parents, m_strategies, Strategy::set(), cmt_vector< T >::size(), cmt_vector< Strategy >::size(), and update_strategy().
01637 { 01638 bool need_strategy = true; 01639 01640 int i; 01641 01642 for (i = 0; i < m_strategies.size (); i++) 01643 { 01644 Strategy& s = m_strategies[i]; 01645 if (s.m_definition == definition) 01646 { 01647 // This strategy is already applied in this project. Let's change it's value 01648 s.set (definition, b_value, get_name ()); 01649 if (context != "") 01650 { 01651 if (s.m_context != "") s.m_context += " "; 01652 s.m_context += context; 01653 } 01654 need_strategy = false; 01655 break; 01656 } 01657 } 01658 01659 if (need_strategy) 01660 { 01661 // This strategy is not yet applied in this project. 01662 01663 Strategy& s = m_strategies.add (); 01664 s.clear (); 01665 s.set (definition, b_value, get_name ()); 01666 s.m_context = context; 01667 } 01668 01669 for (i = 0; i < m_parents.size (); i++) 01670 { 01671 Project* project = m_parents[i]; 01672 01673 project->update_strategy (definition, b_value); 01674 } 01675 } |
|
Definition at line 1605 of file cmt_project.cxx. References StrategyMgr::find_strategy(), StrategyMgr::instance(), StrategyDef::m_off_value, and StrategyDef::m_on_value. Referenced by KwdSetupStrategy::action(), and KwdBuildStrategy::action().
01606 { 01607 static StrategyMgr& mgr = StrategyMgr::instance (); 01608 01609 StrategyDef* def = mgr.find_strategy (name); 01610 if (def == 0) 01611 { 01612 cerr << "#CMT> strategy " << name << " undefined" << endl; 01613 return; 01614 } 01615 01616 bool b_value = false; 01617 01618 if (value == def->m_on_value) 01619 { 01620 b_value = true; 01621 } 01622 else if (value == def->m_off_value) 01623 { 01624 b_value = false; 01625 } 01626 else 01627 { 01628 cerr << "#CMT> requested strategy value " << value << " undefined in strategy " << name << endl; 01629 return; 01630 } 01631 01632 set_strategy (def, b_value, context); 01633 } |
|
Definition at line 1434 of file cmt_project.cxx. References cmt_string::find(), get_name(), m_children, m_cmtpath, m_cmtpath_source, m_name, m_parents, m_release, m_visited, CmtSystem::pwd(), and cmt_vector< T >::size(). Referenced by show_all().
01435 { 01436 static int level = 0; 01437 01438 bool is_current = false; 01439 01440 cmt_string here = CmtSystem::pwd (); 01441 01442 if (here.find (m_cmtpath) == 0) 01443 { 01444 if (m_cmtpath_source != "default path") 01445 { 01446 is_current = true; 01447 } 01448 } 01449 01450 for (int tab = 0; tab < level; tab++) cout << " "; 01451 cout << m_name << " " << m_release << " (in " << m_cmtpath << ")"; 01452 01453 if (is_current) cout << " (current)"; 01454 01455 int i; 01456 01457 for (i = 0; i < m_parents.size (); i++) 01458 { 01459 Project* p = m_parents[i]; 01460 if (p == 0) continue; 01461 cout << " P=" << p->get_name (); 01462 } 01463 01464 for (i = 0; i < m_children.size (); i++) 01465 { 01466 Project* p = m_children[i]; 01467 if (p == 0) continue; 01468 cout << " C=" << p->get_name (); 01469 } 01470 01471 cout << endl; 01472 01473 if (m_visited) return; 01474 01475 m_visited = true; 01476 01477 for (i = 0; i < m_children.size (); i++) 01478 { 01479 Project* p = m_children[i]; 01480 if (p == 0) continue; 01481 level++; 01482 p->show (); 01483 level--; 01484 } 01485 } |
|
Definition at line 784 of file cmt_project.cxx. References get_current(), m_visited, projects(), ProjectVector, show(), and cmt_vector< T >::size(). Referenced by ProjectFactory::create_project(), and Cmt::do_show_projects().
00785 { 00786 static Project::ProjectVector& Projects = Project::projects (); 00787 00788 for (int i = 0; i < Projects.size (); i++) 00789 { 00790 Project& p = Projects[i]; 00791 p.m_visited = false; 00792 } 00793 00794 Project* current = get_current (); 00795 00796 if (current != 0) current->show (); 00797 } |
|
Definition at line 851 of file cmt_project.cxx. References start_visit(). Referenced by Cmt::do_show_path().
00852 { 00853 VisitorForShowPaths visitor; 00854 00855 start_visit (visitor); 00856 } |
|
Definition at line 1489 of file cmt_project.cxx. References Strategy::m_context, Strategy::m_definition, StrategyDef::m_keyword, m_name, StrategyDef::m_off_value, StrategyDef::m_on_value, Strategy::m_specified, m_strategies, Strategy::m_value, and cmt_vector< Strategy >::size(). Referenced by show_specified_strategies_for_all().
01490 { 01491 int i; 01492 01493 for (i = 0; i < m_strategies.size (); i++) 01494 { 01495 const Strategy& s = m_strategies[i]; 01496 if (s.m_specified) 01497 { 01498 const StrategyDef* def = s.m_definition; 01499 01500 cout << "# Project " << m_name 01501 << " sets " << def->m_keyword 01502 << " strategy to " << ((s.m_value) ? def->m_on_value : def->m_off_value); 01503 01504 if (s.m_context != "") 01505 { 01506 cout << " (from package " << s.m_context << ")"; 01507 } 01508 01509 cout << endl; 01510 } 01511 } 01512 } |
|
Definition at line 800 of file cmt_project.cxx. References projects(), ProjectVector, show_specified_strategies(), and cmt_vector< T >::size(). Referenced by Cmt::do_show_strategies().
00801 { 00802 static ProjectVector& Projects = projects (); 00803 00804 for (int i = 0; i < Projects.size (); i++) 00805 { 00806 const Project& project = Projects[i]; 00807 project.show_specified_strategies (); 00808 } 00809 } |
|
Definition at line 1019 of file cmt_project.cxx. References get_current(), m_visited, IProjectVisitor::post(), IProjectVisitor::pre(), projects(), ProjectVector, cmt_vector< T >::size(), and visit(). Referenced by fill_cmtpaths(), and show_paths().
01020 { 01021 static Project::ProjectVector& Projects = Project::projects (); 01022 01023 for (int i = 0; i < Projects.size (); i++) 01024 { 01025 Project& p = Projects[i]; 01026 p.m_visited = false; 01027 } 01028 01029 Project* p = get_current (); 01030 01031 if (p == 0) return; 01032 01033 visitor.pre (p); 01034 p->visit (visitor); 01035 visitor.post (p); 01036 } |
|
---------------------------------------------------------- At least one of the children has changed its strategies Or the list of children has changed. We need to update the strategy values accordingly This will not change the specified values Definition at line 1829 of file cmt_project.cxx. References StrategyMgr::get_definitions(), m_parents, cmt_vector< T >::size(), StrategyDef::StrategyDefs, and update_strategy_from_children(). Referenced by ProjectFactory::create_project(), and use_action().
01830 { 01831 StrategyDef::StrategyDefs& defs = StrategyMgr::get_definitions (); 01832 01833 //cerr << "Updating strategies from children for project " << m_name << endl; 01834 01835 int i; 01836 01837 for (i = 0; i < defs.size (); i++) 01838 { 01839 StrategyDef* def = defs[i]; 01840 01841 update_strategy_from_children (def); 01842 } 01843 01844 for (i = 0; i < m_parents.size (); i++) 01845 { 01846 Project* p = m_parents[i]; 01847 p->update_strategies_from_children (); 01848 } 01849 } |
|
---------------------------------------------------------- The strategy value is changed because of indirect influences - default strategy at initialization time - change in the children - change in the children list (This is not a specification : see the set_strategy method) Definition at line 1685 of file cmt_project.cxx. References cmt_vector< Strategy >::add(), Strategy::clear(), get_name(), Strategy::m_definition, m_parents, Strategy::m_specified, m_strategies, cmt_vector< T >::size(), cmt_vector< Strategy >::size(), and Strategy::update(). Referenced by set_default_strategy(), set_strategy(), and update_strategy_from_children().
01686 { 01687 bool need_strategy = true; 01688 bool specified = false; 01689 01690 int i; 01691 01692 for (i = 0; i < m_strategies.size (); i++) 01693 { 01694 Strategy& s = m_strategies[i]; 01695 if (s.m_definition == definition) 01696 { 01697 need_strategy = false; 01698 01699 if (!s.m_specified) 01700 { 01701 // This strategy is already applied in this project. Let's change it's value 01702 s.update (definition, b_value, get_name ()); 01703 } 01704 else 01705 { 01706 specified = true; 01707 } 01708 break; 01709 } 01710 } 01711 01712 if (need_strategy) 01713 { 01714 // This strategy is not yet applied in this project. 01715 01716 Strategy& s = m_strategies.add (); 01717 s.clear (); 01718 s.update (definition, b_value, get_name ()); 01719 } 01720 01721 if (!specified) 01722 { 01723 for (i = 0; i < m_parents.size (); i++) 01724 { 01725 Project* project = m_parents[i]; 01726 01727 project->update_strategy (definition, b_value); 01728 } 01729 } 01730 } |
|
---------------------------------------------------------- At least one of the children has changed this strategy Or the list of children has changed. We need to update the strategy value accordingly This will not change the specified value for this strategy Definition at line 1738 of file cmt_project.cxx. References get_strategy(), is_specified(), m_children, StrategyDef::m_default_value, Strategy::m_definition, StrategyDef::m_priority_value, Strategy::m_specified, m_strategies, cmt_vector< T >::size(), cmt_vector< Strategy >::size(), and update_strategy(). Referenced by update_strategies_from_children().
01739 { 01740 // If this strategy is specified we don't care what happens from the children 01741 01742 //cerr << "Updating strategy " << definition->m_name << " from children for project " << m_name << endl; 01743 01744 int i; 01745 01746 for (i = 0; i < m_strategies.size (); i++) 01747 { 01748 Strategy& s = m_strategies[i]; 01749 if (s.m_definition == definition) 01750 { 01751 // This strategy is applied in this project. 01752 01753 if (s.m_specified) 01754 { 01755 // There will be no impact since the strategy is specified 01756 01757 //cerr << "This strategy is specified in this project" << endl; 01758 return; 01759 } 01760 01761 break; 01762 } 01763 } 01764 01765 // The strategy is not specified locally so we will now figure out 01766 // which strategy has to be considered from the mixture of specifications 01767 // from all children. 01768 01769 // Algorithm: 01770 // - We consider children by pairs 01771 // - a child that specifies its strategy wins over a child that does not 01772 // - when the two children have the same level of priority we consider the priority value 01773 01774 Project* selected = 0; 01775 bool selected_is_specified = false; 01776 bool selected_value = definition->m_default_value; 01777 01778 for (i = 0; i < m_children.size (); i++) 01779 { 01780 Project* p = m_children[i]; 01781 01782 //cerr << "Checking strategy for child " << p->get_name () << endl; 01783 01784 bool is_specified = p->is_specified (definition); 01785 bool value = p->get_strategy (definition); 01786 01787 if (selected == 0) 01788 { 01789 selected = p; 01790 selected_is_specified = is_specified; 01791 selected_value = value; 01792 continue; 01793 } 01794 01795 if (is_specified == selected_is_specified) 01796 { 01797 if (selected_value != value) 01798 { 01799 // same level of priority but different values -> we must decide 01800 bool priority_value = definition->m_priority_value; 01801 if (value == priority_value) 01802 { 01803 selected = p; 01804 selected_is_specified = is_specified; 01805 selected_value = value; 01806 } 01807 } 01808 } 01809 else 01810 { 01811 if (is_specified) 01812 { 01813 selected = p; 01814 selected_is_specified = is_specified; 01815 selected_value = value; 01816 } 01817 } 01818 } 01819 01820 update_strategy (definition, selected_value); 01821 } |
|
--------------------------------------------------------- A use statement is met in the project file
Definition at line 1342 of file cmt_project.cxx. References add_child(), add_parent(), CmtSystem::cmt_string_vector, IProjectFactory::create_project(), CmtSystem::file_separator(), find_by_name(), CmtSystem::getenv(), ProjectFactory::instance(), m_name, CmtSystem::path_separator(), cmt_vector< T >::size(), CmtSystem::split(), CmtSystem::test_directory(), and update_strategies_from_children(). Referenced by KwdUse::action().
01343 { 01344 //cerr << "Use action " << name << " " << release << endl; 01345 01346 // A project with its release is specified 01347 // 01348 // Is this project already visible? 01349 // If not: look for it 01350 // + get CMTPROJECTPATH 01351 // + search from all entries of CMTPROJECTPATH : p(i)/<name>/<release> 01352 // + when found, this should become a new CMTPATH entry 01353 // + the new project is then parsed ... etc... 01354 01355 cmt_string cmtprojectpath = CmtSystem::getenv ("CMTPROJECTPATH"); 01356 cmt_string sep; 01357 sep = CmtSystem::path_separator (); 01358 01359 //cerr << "cmtprojectpath = " << cmtprojectpath << endl; 01360 CmtSystem::cmt_string_vector items; 01361 CmtSystem::split (cmtprojectpath, sep, items); 01362 01363 bool found = false; 01364 01365 for (int i = 0; i < items.size (); i++) 01366 { 01367 const cmt_string& item = items[i]; 01368 cmt_string p = item; 01369 p += CmtSystem::file_separator (); 01370 p += name; 01371 p += CmtSystem::file_separator (); 01372 p += release; 01373 01374 if (CmtSystem::test_directory (p)) 01375 { 01376 //cerr << "Project directory " << p << " exists " << endl; 01377 01378 found = true; 01379 01380 IProjectFactory& factory = ProjectFactory::instance (); 01381 01382 factory.create_project (name, p, "ProjectPath", this); 01383 01384 break; 01385 } 01386 } 01387 01388 if (!found) 01389 { 01390 Project* p = Project::find_by_name (name); 01391 01392 if (p != 0) 01393 { 01394 found = true; 01395 01396 p->add_parent (this); 01397 add_child (p); 01398 01399 update_strategies_from_children (); 01400 } 01401 } 01402 01403 if (!found && (cmtprojectpath != "")) 01404 { 01405 cerr << "#CMT> Project " << name << " " << release << " requested by " << m_name << " not found in CMTPROJECTPATH" << endl; 01406 } 01407 } |
|
Definition at line 995 of file cmt_project.cxx. References get_child(), get_children_size(), IProjectVisitor::in(), m_children, m_visited, cmt_vector< T >::size(), and visited(). Referenced by start_visit().
00996 { 00997 if (m_visited) return; 00998 m_visited = true; 00999 01000 int i; 01001 01002 for (i = 0; i < get_children_size (); i++) 01003 { 01004 Project* child = get_child (i); 01005 01006 if (child->visited ()) continue; 01007 01008 visitor.in (child); 01009 } 01010 01011 for (i = 0; i < m_children.size (); i++) 01012 { 01013 Project* child = m_children[i]; 01014 child->visit (visitor); 01015 } 01016 } |
|
Definition at line 1163 of file cmt_project.cxx. References m_visited. Referenced by visit().
01164 { 01165 return (m_visited); 01166 } |
|
Definition at line 189 of file cmt_project.h. Referenced by add_child(), clear(), get_child(), get_children_size(), has_child(), show(), update_strategy_from_children(), and visit(). |
|
Definition at line 193 of file cmt_project.h. Referenced by clear(), find_by_cmtpath(), find_in_cmt_paths(), get_cmtpath(), get_current(), operator=(), scan_paths(), scan_paths_for_package(), set_cmtpath(), and show(). |
|
Definition at line 194 of file cmt_project.h. Referenced by clear(), find_by_cmtpath(), find_in_cmt_paths(), get_cmtpath_pwd(), get_current(), operator=(), and set_cmtpath_pwd(). |
|
Definition at line 195 of file cmt_project.h. Referenced by clear(), find_in_cmt_paths(), get_cmtpath_source(), operator=(), set_cmtpath_source(), and show(). |
|
Definition at line 197 of file cmt_project.h. Referenced by clear(), and configure(). |
|
Definition at line 185 of file cmt_project.h. Referenced by get_container(), and set_container(). |
|
Definition at line 186 of file cmt_project.h. Referenced by get_container_version(), and set_container_version(). |
|
Definition at line 183 of file cmt_project.h. Referenced by clear(), find_by_name(), get_name(), operator!=(), operator=(), operator==(), set_name(), show(), show_specified_strategies(), and use_action(). |
|
Definition at line 188 of file cmt_project.h. Referenced by add_parent(), clear(), has_parent(), set_strategy(), show(), update_strategies_from_children(), and update_strategy(). |
|
Definition at line 184 of file cmt_project.h. Referenced by clear(), get_release(), set_release(), and show(). |
|
Definition at line 199 of file cmt_project.h. Referenced by clear(), get_strategy(), has_strategy(), is_specified(), set_strategy(), show_specified_strategies(), update_strategy(), and update_strategy_from_children(). |
|
Definition at line 191 of file cmt_project.h. Referenced by show(), show_all(), start_visit(), visit(), and visited(). |