Main Page ? Class Hierarchy ? Compound List ? File List ? Compound Members ? File Members ?

Branch Class Reference

#include

Collaboration diagram for Branch:

[legend]
List of all members.

Public Types

typedef cmt_vector< Branch >? BranchVector

Public Methods

? Branch ()
? ~Branch ()
const cmt_string &? name () const
void? print (PrintMode mode) const

Static Public Methods

void? action (const CmtSystem::cmt_string_vector &words)
Branch *? find (const cmt_string &name)
void? add (const cmt_string &name)
void? print_all (PrintMode mode)
void? clear_all ()
BranchVector &? branches ()

Private Attributes

cmt_string? m_name

Member Typedef Documentation

typedef cmt_vector Branch::BranchVector
?

Definition at line 16 of file cmt_branch.h.


Constructor & Destructor Documentation

Branch::Branch (? ? )?
?

Definition at line 122 of file cmt_branch.cxx.

00124 {
00125 }

Branch::~Branch (? ? )?
?

Definition at line 128 of file cmt_branch.cxx.

00130 {
00131 }

Member Function Documentation

void Branch::action (? const CmtSystem::cmt_string_vector &? ? words )? [static]
?

Definition at line 22 of file cmt_branch.cxx.

References add(), name(), and cmt_vector< cmt_string >::size().

Referenced by KwdBranches::action().

00024 {
00025   for (int i = 1; i < words.size (); i++)
00026     {
00027       const cmt_string& name = words[i];
00028       if (name == "") return;
00029 
00030       add (name);
00031     }
00032 }

void Branch::add (? const cmt_string &? ? name )? [static]
?

Definition at line 60 of file cmt_branch.cxx.

References cmt_vector< Branch >::add(), branches(), find(), and m_name.

Referenced by action().

00062 {
00063   static BranchVector& Branches = branches ();
00064 
00065   {
00066     Branch* branch;
00067 
00068     branch = find (name);
00069     if (branch != 0) return;
00070   }
00071 
00072   Branch& branch = Branches.add ();
00073 
00074   branch.m_name = name;
00075 }

Branch::BranchVector & Branch::branches (? ? )? [static]
?

Definition at line 112 of file cmt_branch.cxx.

References Database::branches(), and Database::instance().

Referenced by add(), clear_all(), Cmt::do_config(), find(), and print_all().

00114 {
00115   static Database& db = Database::instance ();
00116   static BranchVector& Branches = db.branches ();
00117 
00118   return (Branches);
00119 }

void Branch::clear_all (? ? )? [static]
?

Definition at line 94 of file cmt_branch.cxx.

References branches(), cmt_vector< Branch >::clear(), m_name, and cmt_vector< Branch >::size().

Referenced by Database::clear().

00096 {
00097   static BranchVector& Branches = branches ();
00098 
00099   int number;
00100 
00101   for (number = 0; number < Branches.size (); number++)
00102     {
00103       Branch& b = Branches[number];
00104 
00105       b.m_name = "";
00106     }
00107 
00108   Branches.clear ();
00109 }

Branch * Branch::find (? const cmt_string &? ? name )? [static]
?

Definition at line 35 of file cmt_branch.cxx.

References branches(), name(), and cmt_vector< Branch >::size().

Referenced by add().

00037 {
00038   static BranchVector& Branches = branches ();
00039 
00040   int branch_index;
00041 
00042   if (Branches.size () == 0) return (0);
00043 
00044   for (branch_index = 0;
00045        branch_index < Branches.size ();
00046        branch_index++)
00047     {
00048       Branch& branch = Branches[branch_index];
00049 
00050       if (branch.name () == name)
00051         {
00052           return (&branch);
00053         }
00054     }
00055 
00056   return (0);
00057 }

const cmt_string & Branch::name (? ? )?
?

Definition at line 134 of file cmt_branch.cxx.

Referenced by action(), Cmt::do_config(), and find().

00136 {
00137   return (m_name);
00138 }

void Branch::print (? PrintMode? ? mode )? const
?

Definition at line 141 of file cmt_branch.cxx.

References PrintMode.

00143 {
00144   cout << m_name;
00145 }

void Branch::print_all (? PrintMode? ? mode )? [static]
?

Definition at line 78 of file cmt_branch.cxx.

References branches(), PrintMode, and cmt_vector< Branch >::size().

Referenced by Cmt::do_show_branches().

00080 {
00081   static BranchVector& Branches = branches ();
00082 
00083   int number;
00084 
00085   for (number = 0; number < Branches.size (); number++)
00086     {
00087       if (number > 0) cout << " ";
00088       Branches[number].print (mode);
00089     }
00090   if (number > 0) cout << endl;
00091 }

Member Data Documentation

cmt_string Branch::m_name [private]
?

Definition at line 32 of file cmt_branch.h.

Referenced by add(), and clear_all().


The documentation for this class was generated from the following files:
Generated on Wed Sep 1 10:59:52 2004 for CMT by 1.2.18