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

# Constituent Class Reference

`#include <cmt_constituent.h>`

Collaboration diagram for Constituent:

[legend]
List of all members.

## Public Types
typedef cmt_vector<Constituent> | ConstituentVector
## Public Methods
| Constituent ()
| ~Constituent ()
void | parse ()
void | clear ()
void | build_makefile (bool simulation) const
void | build_msdev_file (bool simulation) const
void | show () const
## Public Attributes
cmt_string | name
cmt_string | generator
ConstituentType | type
Group* | group
cmt_string | suffix
CmtSystem::cmt_string_vector | modules
bool | need_OS9
bool | windows
bool | no_static
bool | no_share
bool | need_prototypes
bool | need_check
bool | build_triggers
CmtSystem::cmt_string_vector | includes
CmtSystem::cmt_string_vector | imports
Variable::VariableVector | variables
## Static Public Methods
void | action (ConstituentType type, const CmtSystem::cmt_string_vector& words)
Constituent* | find (const cmt_string& name)
Constituent* | add (ConstituentType type, const cmt_string& name, const cmt_string& generator)
void | show (const cmt_string& name)
void | parse_all ()
void | show_all ()
void | show_names ()
void | build_all_makefiles (bool simulation)
void | build_all_msdev_files (bool simulation)
void | clear_all ()
ConstituentVector& | constituents ()
## Private Attributes
CmtSystem::cmt_string_vector | parameters

## Member Typedef Documentation

typedef cmt_vector<Constituent> Constituent::ConstituentVector

| Definition at line 12 of file cmt_constituent.h.

## Constructor & Destructor Documentation

Constituent::Constituent ( | )

| Definition at line 367 of file cmt_constituent.cxx.
    00368 {
    00369   clear ();
    00370 }

Constituent::~Constituent ( | )

| Definition at line 373 of file cmt_constituent.cxx.
    00374 {
    00375 }

## Member Function Documentation

void Constituent::action ( | ConstituentType type,
| const CmtSystem::cmt_string_vector & words )`[static]`

| Definition at line 252 of file cmt_constituent.cxx. Referenced by Cmt::select().
    00254 {
    00255   cmt_string generator;
    00256   cmt_string name;
    00257   Constituent* constituent;
    00258
    00259   int i = 1;
    00260
    00261   if (type == Document)
    00262     {
    00263       generator = words[i];
    00264       if (generator == "") return;
    00265       i++;
    00266     }
    00267
    00268   name = words[i];
    00269   if (name == "") return;
    00270   i++;
    00271
    00272   constituent = add (type, name, generator);
    00273
    00274   for (;i < words.size (); i++)
    00275     {
    00276       const cmt_string& w = words[i];
    00277       cmt_string& parameter = constituent->parameters.add ();
    00278       parameter = w;
    00279     }
    00280 }

Constituent * Constituent::add ( | ConstituentType type,
| const cmt_string & name,
| const cmt_string & generator )`[static]`

| Definition at line 317 of file cmt_constituent.cxx. Referenced by action().
    00320 {
    00321   static ConstituentVector& Constituents = constituents ();
    00322
    00323   {
    00324     Constituent* constituent;
    00325
    00326     if (name == "") return (0);
    00327
    00328     constituent = find (name);
    00329     if (constituent != 0) return (constituent);
    00330   }
    00331
    00332   Constituent& constituent = Constituents.add ();
    00333   constituent.clear ();
    00334
    00335   constituent.name      = name;
    00336   constituent.generator = generator;
    00337   constituent.type      = type;
    00338   constituent.need_prototypes = Cmt::need_prototypes ();
    00339
    00340   return (&constituent);
    00341 }

void Constituent::build_all_makefiles ( | bool simulation )`[static]`

| Definition at line 399 of file cmt_constituent.cxx. Referenced by Cmt::build_makefile().
    00400 {
    00401   static ConstituentVector& Constituents = constituents ();
    00402
    00403   int i;
    00404
    00405   for (i = 0; i < Constituents.size (); i++)
    00406     {
    00407       Constituent& constituent = Constituents[i];
    00408
    00409       constituent.build_makefile (simulation);
    00410     }
    00411 }

void Constituent::build_all_msdev_files ( | bool simulation )`[static]`

| Definition at line 414 of file cmt_constituent.cxx. Referenced by Cmt::build_msdev_file().
    00415 {
    00416   static ConstituentVector& Constituents = constituents ();
    00417
    00418   int i;
    00419
    00420   Generator::build_msdev_workspace (Constituents);
    00421
    00422   for (i = 0; i < Constituents.size (); i++)
    00423     {
    00424       Constituent& constituent = Constituents[i];
    00425
    00426       constituent.build_msdev_file (simulation);
    00427     }
    00428 }

void Constituent::build_makefile ( | bool simulation ) const

| Definition at line 431 of file cmt_constituent.cxx. Referenced by build_all_makefiles(), and Cmt::build_makefile().
    00432 {
    00433   if (!simulation)
    00434     {
    00435       Generator::build_constituent_makefile (*this);
    00436     }
    00437     //else cout << command << endl;
    00438 }

void Constituent::build_msdev_file ( | bool simulation ) const

| Definition at line 441 of file cmt_constituent.cxx. Referenced by build_all_msdev_files(), and Cmt::build_msdev_file().
    00442 {
    00443   if (!simulation)
    00444     {
    00445       Generator::build_msdev (*this);
    00446     }
    00447     //else cout << command << endl;
    00448 }

void Constituent::clear ( | )

| Definition at line 378 of file cmt_constituent.cxx. Referenced by Constituent(), add(), and clear_all().
    00379 {
    00380   name      = "";
    00381   generator = "";
    00382   type = Document;
    00383   group     = 0;
    00384   modules.clear ();
    00385   parameters.clear ();
    00386   need_OS9        = false;
    00387   windows         = false;
    00388   no_static       = false;
    00389   no_share        = false;
    00390   need_prototypes = false;
    00391   need_check      = false;
    00392   build_triggers  = false;
    00393   includes.clear ();
    00394   imports.clear ();
    00395   variables.clear ();
    00396 }

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

| Definition at line 345 of file cmt_constituent.cxx. Referenced by Database::clear().
    00346 {
    00347   static ConstituentVector& Constituents = constituents ();
    00348
    00349   for (int i = 0; i < Constituents.size (); i++)
    00350     {
    00351       Constituent& c = Constituents[i];
    00352       c.clear ();
    00353     }
    00354   Constituents.clear ();
    00355 }

Constituent::ConstituentVector & Constituent::constituents ( | )`[static]`

| Definition at line 358 of file cmt_constituent.cxx. Referenced by add(), build_all_makefiles(), build_all_msdev_files(), Generator::build_constituents_makefile(), Generator::build_make_setup(), clear_all(), StandardMacroBuilder::fill_for_all_constituents(), find(), parse_all(), Cmt::set_standard_macros(), show_all(), and show_names().
    00359 {
    00360   static Database& db = Database::instance ();
    00361   static ConstituentVector& Constituents = db.constituents ();
    00362
    00363   return (Constituents);
    00364 }

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

| Definition at line 73 of file cmt_constituent.cxx. Referenced by add(), Generator::build_constituent_makefile(), Generator::build_dependencies(), Cmt::build_makefile(), Cmt::build_msdev_file(), TriggerGenerator::run(), and show().
    00074 {
    00075   static ConstituentVector& Constituents = constituents ();
    00076
    00077   int constituent_index;
    00078
    00079   if (Constituents.size () == 0) return (0);
    00080
    00081   for (constituent_index = 0;
    00082        constituent_index < Constituents.size ();
    00083        constituent_index++)
    00084     {
    00085       Constituent& constituent = Constituents[constituent_index];
    00086
    00087       if (constituent.name == name)
    00088         {
    00089           return (&constituent);
    00090         }
    00091     }
    00092
    00093   return (0);
    00094 }

void Constituent::parse ( | )

| Definition at line 283 of file cmt_constituent.cxx. Referenced by parse_all().
    00284 {
    00285   if (parameters.size () == 0) return;
    00286
    00287   Constituent& me = *this;
    00288
    00289   modules.clear ();
    00290
    00291   constituents_action_iterator it (me);
    00292
    00293   for (int i = 0; i < parameters.size (); i++)
    00294     {
    00295       const cmt_string& w = parameters[i];
    00296       cmt_string ew = w;
    00297
    00298       Symbol::expand (ew);
    00299
    00300       CmtSystem::cmt_string_vector ws;
    00301
    00302       CmtSystem::split (ew, " \t", ws);
    00303
    00304       for (int j = 0; j < ws.size (); ++j)
    00305         {
    00306           const cmt_string& w = ws[j];
    00307
    00308             //cerr << "Constituent " << name << " Setting module " << w << endl;
    00309           it.set (w);
    00310         }
    00311     }
    00312
    00313   parameters.clear ();
    00314 }

void Constituent::parse_all ( | )`[static]`

| Definition at line 29 of file cmt_constituent.cxx. Referenced by StandardMacroBuilder::fill_for_all_constituents().
    00030 {
    00031   static ConstituentVector& Constituents = constituents ();
    00032
    00033   int number;
    00034
    00035   for (number = 0; number < Constituents.size (); number++)
    00036     {
    00037       Constituent& constituent = Constituents[number];
    00038
    00039       constituent.parse ();
    00040     }
    00041 }

void Constituent::show ( | ) const

| Definition at line 451 of file cmt_constituent.cxx. Referenced by Cmt::do_show_constituent(), show(), and show_all().
    00452 {
    00453   int i;
    00454
    00455   switch (type)
    00456     {
    00457       case Library:
    00458         cout << "library";
    00459         break;
    00460       case Application:
    00461         cout << "application";
    00462         break;
    00463       case Document:
    00464         cout << "document " << generator;
    00465         break;
    00466     }
    00467
    00468   cout << " " << name;
    00469
    00470   if (group != 0)
    00471     {
    00472       cout << " -group=" << group->name ();
    00473     }
    00474
    00475   if (suffix != 0)
    00476     {
    00477       cout << " -suffix=" << suffix;
    00478     }
    00479
    00480   if ((type == Application) && need_check)
    00481     {
    00482       cout << " -check";
    00483     }
    00484
    00485   if ((type == Library) && no_share)
    00486     {
    00487       cout << " -no_share";
    00488     }
    00489
    00490   if ((type == Library) && no_static)
    00491     {
    00492       cout << " -no_static";
    00493     }
    00494
    00495   if ((type == Library) && build_triggers)
    00496     {
    00497       cout << " -triggers";
    00498     }
    00499
    00500   for (i = 0; i < (imports.size ()); i++)
    00501     {
    00502       const cmt_string& import_name = imports[i];
    00503
    00504       cout << " -import=" << import_name;
    00505     }
    00506
    00507   for (i = 0; i < (modules.size ()); i++)
    00508     {
    00509       const cmt_string& module_name = modules[i];
    00510
    00511       cout << " " << module_name;
    00512     }
    00513
    00514   for (i = 0; i < (variables.size ()); i++)
    00515     {
    00516       const Variable& v = variables[i];
    00517
    00518       cout << " " << v.name << "=" << v.value;
    00519     }
    00520
    00521   cout << endl;
    00522 }

void Constituent::show ( | const cmt_string & name )`[static]`

| Definition at line 18 of file cmt_constituent.cxx.
    00019 {
    00020   Constituent* cptr = find (name);
    00021   if (cptr == 0) return;
    00022
    00023   const Constituent& constituent = *cptr;
    00024
    00025   constituent.show ();
    00026 }

void Constituent::show_all ( | )`[static]`

| Definition at line 44 of file cmt_constituent.cxx. Referenced by Cmt::do_show_constituents().
    00045 {
    00046   static ConstituentVector& Constituents = constituents ();
    00047
    00048   int number;
    00049
    00050   for (number = 0; number < Constituents.size (); number++)
    00051     {
    00052       const Constituent& constituent = Constituents[number];
    00053
    00054       constituent.show ();
    00055     }
    00056 }

void Constituent::show_names ( | )`[static]`

| Definition at line 59 of file cmt_constituent.cxx. Referenced by Cmt::do_show_constituent_names().
    00060 {
    00061   static ConstituentVector& Constituents = constituents ();
    00062
    00063   int number;
    00064
    00065   for (number = 0; number < Constituents.size (); number++)
    00066     {
    00067       Constituent& constituent = Constituents[number];
    00068       cout << constituent.name << endl;
    00069     }
    00070 }

## Member Data Documentation

bool Constituent::build_triggers

| Definition at line 50 of file cmt_constituent.h.

cmt_string Constituent::generator

| Definition at line 39 of file cmt_constituent.h.

Group * Constituent::group

| Definition at line 41 of file cmt_constituent.h.

CmtSystem::cmt_string_vector Constituent::imports

| Definition at line 52 of file cmt_constituent.h.

CmtSystem::cmt_string_vector Constituent::includes

| Definition at line 51 of file cmt_constituent.h.

CmtSystem::cmt_string_vector Constituent::modules

| Definition at line 43 of file cmt_constituent.h.

cmt_string Constituent::name

| Definition at line 38 of file cmt_constituent.h.

bool Constituent::need_OS9

| Definition at line 44 of file cmt_constituent.h.

bool Constituent::need_check

| Definition at line 49 of file cmt_constituent.h.

bool Constituent::need_prototypes

| Definition at line 48 of file cmt_constituent.h.

bool Constituent::no_share

| Definition at line 47 of file cmt_constituent.h.

bool Constituent::no_static

| Definition at line 46 of file cmt_constituent.h.

CmtSystem::cmt_string_vector Constituent::parameters`[private]`

| Definition at line 56 of file cmt_constituent.h.

cmt_string Constituent::suffix

| Definition at line 42 of file cmt_constituent.h.

ConstituentType Constituent::type

| Definition at line 40 of file cmt_constituent.h.

Variable::VariableVector Constituent::variables

| Definition at line 53 of file cmt_constituent.h.

bool Constituent::windows

| Definition at line 45 of file cmt_constituent.h.

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

- cmt_constituent.h
- cmt_constituent.cxx