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

StrategyMgr Class Reference

#include <cmt_project.h>

Collaboration diagram for StrategyMgr:

Collaboration graph
[legend]
List of all members.

Static Public Member Functions

StrategyMgrinstance ()
 ---------------------------------------------------------- The StrategyMgr singleton

StrategyDeffind_strategy (const cmt_string &name)
 ---------------------------------------------------------- Find a strategy definition by its name

bool get_default_strategy (const cmt_string &name)
 ---------------------------------------------------------- Retreive the default value defined for a given strategy

bool get_priority_strategy (const cmt_string &name)
 ---------------------------------------------------------- Retreive the priority value defined for a given strategy This value is used when two children of a project request two conflicting strategy values

StrategyDef::StrategyDefsget_definitions ()
 ---------------------------------------------------------- Return the vector of all existing strategy definitions


Private Member Functions

 StrategyMgr ()
 ---------------------------------------------------------- The StrategyMgr constructor Here are primarily constructed all strategy definitions


Private Attributes

StrategyDef::StrategyDefs m_defs

Constructor & Destructor Documentation

StrategyMgr::StrategyMgr  )  [private]
 

---------------------------------------------------------- The StrategyMgr constructor Here are primarily constructed all strategy definitions

Definition at line 1864 of file cmt_project.cxx.

References cmt_vector< T >::clear(), StrategyDef::m_default_value, m_defs, StrategyDef::m_keyword, StrategyDef::m_name, StrategyDef::m_off_value, StrategyDef::m_on_value, StrategyDef::m_priority_value, and cmt_vector< T >::push_back().

01865 {
01866   m_defs.clear ();
01867 
01868   StrategyDef* s;
01869 
01870   s = new StrategyDef;
01871   s->m_keyword = "build";
01872   s->m_name = "BuildPrototypes";
01873   s->m_on_value = "prototypes";
01874   s->m_off_value = "no_prototypes";
01875   s->m_default_value = true;
01876   s->m_priority_value = false;
01877 
01878   m_defs.push_back (s);
01879 
01880   s = new StrategyDef;
01881   s->m_keyword = "build";
01882   s->m_name = "InstallArea";
01883   s->m_on_value = "with_installarea";
01884   s->m_off_value = "without_installarea";
01885   s->m_default_value = false;
01886   s->m_priority_value = true;
01887 
01888   m_defs.push_back (s);
01889 
01890   s = new StrategyDef;
01891   s->m_keyword = "setup";
01892   s->m_name = "SetupConfig";
01893   s->m_on_value = "config";
01894   s->m_off_value = "no_config";
01895   s->m_default_value = true;
01896   s->m_priority_value = false;
01897 
01898   m_defs.push_back (s);
01899 
01900   s = new StrategyDef;
01901   s->m_keyword = "setup";
01902   s->m_name = "SetupRoot";
01903   s->m_on_value = "root";
01904   s->m_off_value = "no_root";
01905   s->m_default_value = true;
01906   s->m_priority_value = false;
01907 
01908   m_defs.push_back (s);
01909 
01910   s = new StrategyDef;
01911   s->m_keyword = "setup";
01912   s->m_name = "SetupCleanup";
01913   s->m_on_value = "cleanup";
01914   s->m_off_value = "no_cleanup";
01915   s->m_default_value = true;
01916   s->m_priority_value = false;
01917 
01918   m_defs.push_back (s);
01919 }


Member Function Documentation

StrategyDef * StrategyMgr::find_strategy const cmt_string name  )  [static]
 

---------------------------------------------------------- Find a strategy definition by its name

Definition at line 1924 of file cmt_project.cxx.

References instance(), m_defs, StrategyDef::m_name, and cmt_vector< T >::size().

Referenced by get_default_strategy(), get_priority_strategy(), Project::get_strategy(), Project::set_default_strategy(), and Project::set_strategy().

01925 {
01926   static StrategyMgr& me = instance ();
01927 
01928   int i;
01929 
01930   for (i = 0; i < me.m_defs.size (); i++)
01931     {
01932       StrategyDef* def = me.m_defs[i];
01933       if (def->m_name == name)
01934         {
01935           return (def);
01936         }
01937     }
01938 
01939   return (0);
01940 }

bool StrategyMgr::get_default_strategy const cmt_string name  )  [static]
 

---------------------------------------------------------- Retreive the default value defined for a given strategy

Definition at line 1945 of file cmt_project.cxx.

References find_strategy(), and StrategyDef::m_default_value.

Referenced by get_strategy().

01946 {
01947   StrategyDef* def = find_strategy (name);
01948   if (def == 0) return (false);
01949   return (def->m_default_value);
01950 }

StrategyDef::StrategyDefs & StrategyMgr::get_definitions  )  [static]
 

---------------------------------------------------------- Return the vector of all existing strategy definitions

Definition at line 1966 of file cmt_project.cxx.

References instance(), m_defs, and StrategyDef::StrategyDefs.

Referenced by Project::update_strategies_from_children().

01967 {
01968   static StrategyMgr& me = instance ();
01969 
01970   return (me.m_defs);
01971 }

bool StrategyMgr::get_priority_strategy const cmt_string name  )  [static]
 

---------------------------------------------------------- Retreive the priority value defined for a given strategy This value is used when two children of a project request two conflicting strategy values

Definition at line 1956 of file cmt_project.cxx.

References find_strategy(), and StrategyDef::m_priority_value.

01957 {
01958   StrategyDef* def = find_strategy (name);
01959   if (def == 0) return (false);
01960   return (def->m_priority_value);
01961 }

StrategyMgr & StrategyMgr::instance  )  [static]
 

---------------------------------------------------------- The StrategyMgr singleton

Definition at line 1854 of file cmt_project.cxx.

Referenced by find_strategy(), get_definitions(), Project::get_strategy(), Project::set_default_strategy(), and Project::set_strategy().

01855 {
01856   static StrategyMgr me;
01857   return (me);
01858 }


Member Data Documentation

StrategyDef::StrategyDefs StrategyMgr::m_defs [private]
 

Definition at line 59 of file cmt_project.h.

Referenced by find_strategy(), get_definitions(), and StrategyMgr().


The documentation for this class was generated from the following files:
Generated on Mon May 2 10:26:02 2005 for CMT by doxygen 1.3.5