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

Strategy Class Reference

#include <cmt_project.h>

Collaboration diagram for Strategy:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Strategy ()
void clear ()
void set (StrategyDef *definition, bool value, const cmt_string &project_name)
 ---------------------------------------------------------- Specify a new value for this strategy.

void update (StrategyDef *definition, bool value, const cmt_string &project_name)
 ---------------------------------------------------------- Change the effective value for this strategy.


Public Attributes

StrategyDefm_definition
bool m_specified
bool m_specified_value
bool m_value
Tagm_on_tag
Tagm_off_tag
cmt_string m_context

Constructor & Destructor Documentation

Strategy::Strategy  ) 
 

Definition at line 1974 of file cmt_project.cxx.

References clear().

01975 {
01976   clear ();
01977 }


Member Function Documentation

void Strategy::clear  ) 
 

Definition at line 1980 of file cmt_project.cxx.

References m_definition, m_off_tag, m_on_tag, m_specified, m_specified_value, and m_value.

Referenced by Project::set_strategy(), Strategy(), and Project::update_strategy().

01981 {
01982   m_definition = 0;
01983   m_specified = false;
01984   m_specified_value = false;
01985   m_value = false;
01986   m_on_tag = 0;
01987   m_off_tag = 0;
01988 }

void Strategy::set StrategyDef definition,
bool  value,
const cmt_string project_name
 

---------------------------------------------------------- Specify a new value for this strategy.

This only happens when a strategy statement is met in a project file or in a requirements file.

Definition at line 1994 of file cmt_project.cxx.

References m_definition, m_specified, m_specified_value, and update().

Referenced by Project::set_strategy().

01995 {
01996   //cerr << "Setting strategy " << definition->m_name << " for project " << project_name << " to " << value << endl;
01997 
01998   m_definition = definition;
01999   m_specified = true;
02000   m_specified_value = value;
02001 
02002   update (definition, value, project_name);
02003 }

void Strategy::update StrategyDef definition,
bool  value,
const cmt_string project_name
 

---------------------------------------------------------- Change the effective value for this strategy.

This has no impact on to the specified value. This will adapt the tag settings

Definition at line 2010 of file cmt_project.cxx.

References Tag::add(), Tag::add_tag_exclude(), Tag::find(), m_definition, m_off_tag, StrategyDef::m_off_value, m_on_tag, StrategyDef::m_on_value, m_value, Tag::mark(), PriorityConfig, and Tag::unmark().

Referenced by set(), and Project::update_strategy().

02011 {
02012   //cerr << "Updating strategy " << definition->m_name << " for project " << project_name << " to " << value << endl;
02013 
02014   m_value = value;
02015   m_definition = definition;
02016 
02017   cmt_string to_tag_name = project_name;
02018   cmt_string to_untag_name = project_name;
02019 
02020   to_tag_name += "_";
02021   to_untag_name += "_";
02022 
02023   if (m_value)
02024     {
02025       to_tag_name += m_definition->m_on_value;
02026       to_untag_name += m_definition->m_off_value;
02027     }
02028   else
02029     {
02030       to_tag_name += m_definition->m_off_value;
02031       to_untag_name += m_definition->m_on_value;
02032     }
02033 
02034   m_on_tag = Tag::find (to_tag_name);
02035   m_off_tag = Tag::find (to_untag_name);
02036 
02037   if (m_on_tag == 0) 
02038     {
02039       m_on_tag = Tag::add (to_tag_name, PriorityConfig, "PROJECT", 0);
02040       m_off_tag = Tag::add (to_untag_name, PriorityConfig, "PROJECT", 0);
02041 
02042       m_on_tag->add_tag_exclude (m_off_tag);
02043       m_off_tag->add_tag_exclude (m_on_tag);
02044     }
02045 
02046   m_off_tag->unmark ();
02047   m_on_tag->mark ();
02048 }


Member Data Documentation

cmt_string Strategy::m_context
 

Definition at line 40 of file cmt_project.h.

Referenced by Project::set_strategy(), and Project::show_specified_strategies().

StrategyDef* Strategy::m_definition
 

Definition at line 34 of file cmt_project.h.

Referenced by clear(), Project::get_strategy(), Project::has_strategy(), Project::is_specified(), set(), Project::set_strategy(), Project::show_specified_strategies(), update(), Project::update_strategy(), and Project::update_strategy_from_children().

Tag* Strategy::m_off_tag
 

Definition at line 39 of file cmt_project.h.

Referenced by clear(), and update().

Tag* Strategy::m_on_tag
 

Definition at line 38 of file cmt_project.h.

Referenced by clear(), and update().

bool Strategy::m_specified
 

Definition at line 35 of file cmt_project.h.

Referenced by clear(), Project::get_strategy(), Project::is_specified(), set(), Project::show_specified_strategies(), Project::update_strategy(), and Project::update_strategy_from_children().

bool Strategy::m_specified_value
 

Definition at line 36 of file cmt_project.h.

Referenced by clear(), Project::get_strategy(), and set().

bool Strategy::m_value
 

Definition at line 37 of file cmt_project.h.

Referenced by clear(), Project::get_strategy(), Project::show_specified_strategies(), and update().


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