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

# Branch Class Reference

`#include <cmt_branch.h>`

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> Branch::BranchVector

| Definition at line 10 of file cmt_branch.h.

## Constructor & Destructor Documentation

Branch::Branch ( | )

| Definition at line 116 of file cmt_branch.cxx.
    00118 {
    00119 }

Branch::~Branch ( | )

| Definition at line 122 of file cmt_branch.cxx.
    00124 {
    00125 }

## Member Function Documentation

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

| Definition at line 16 of file cmt_branch.cxx. Referenced by Cmt::select().
    00018 {
    00019   for (int i = 1; i < words.size (); i++)
    00020     {
    00021       const cmt_string& name = words[i];
    00022       if (name == "") return;
    00023
    00024       add (name);
    00025     }
    00026 }

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

| Definition at line 54 of file cmt_branch.cxx.
    00056 {
    00057   static BranchVector& Branches = branches ();
    00058
    00059   {
    00060     Branch* branch;
    00061
    00062     branch = find (name);
    00063     if (branch != 0) return;
    00064   }
    00065
    00066   Branch& branch = Branches.add ();
    00067
    00068   branch.m_name = name;
    00069 }

Branch::BranchVector & Branch::branches ( | )`[static]`

| Definition at line 106 of file cmt_branch.cxx. Referenced by Cmt::do_config().
    00108 {
    00109   static Database& db = Database::instance ();
    00110   static BranchVector& Branches = db.branches ();
    00111
    00112   return (Branches);
    00113 }

void Branch::clear_all ( | )`[static]`

| Definition at line 88 of file cmt_branch.cxx. Referenced by Database::clear().
    00090 {
    00091   static BranchVector& Branches = branches ();
    00092
    00093   int number;
    00094
    00095   for (number = 0; number < Branches.size (); number++)
    00096     {
    00097       Branch& b = Branches[number];
    00098
    00099       b.m_name = "";
    00100     }
    00101
    00102   Branches.clear ();
    00103 }

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

| Definition at line 29 of file cmt_branch.cxx.
    00031 {
    00032   static BranchVector& Branches = branches ();
    00033
    00034   int branch_index;
    00035
    00036   if (Branches.size () == 0) return (0);
    00037
    00038   for (branch_index = 0;
    00039        branch_index < Branches.size ();
    00040        branch_index++)
    00041     {
    00042       Branch& branch = Branches[branch_index];
    00043
    00044       if (branch.name () == name)
    00045         {
    00046           return (&branch);
    00047         }
    00048     }
    00049
    00050   return (0);
    00051 }

const cmt_string & Branch::name ( | ) const

| Definition at line 128 of file cmt_branch.cxx. Referenced by Cmt::do_config(), and find().
    00130 {
    00131   return (m_name);
    00132 }

void Branch::print ( | PrintMode mode ) const

| Definition at line 135 of file cmt_branch.cxx.
    00137 {
    00138   cout << m_name;
    00139 }

void Branch::print_all ( | PrintMode mode )`[static]`

| Definition at line 72 of file cmt_branch.cxx. Referenced by Cmt::do_show_branches().
    00074 {
    00075   static BranchVector& Branches = branches ();
    00076
    00077   int number;
    00078
    00079   for (number = 0; number < Branches.size (); number++)
    00080     {
    00081       if (number > 0) cout << " ";
    00082       Branches[number].print (mode);
    00083     }
    00084   if (number > 0) cout << endl;
    00085 }

## Member Data Documentation

cmt_string Branch::m_name`[private]`

| Definition at line 26 of file cmt_branch.h.

The documentation for this class was generated from the following files:

- cmt_branch.h
- cmt_branch.cxx