ra4_draw  4bd0201e3d922d42bd545d4b045ed44db33454a4
Classes | Functions
generate_baby.hpp File Reference
#include <string>
#include <map>
#include <set>

Go to the source code of this file.

Classes

class  SimpleVariable
 Pairs a type and name of a variable accessible via Baby. More...
 
class  Variable
 A variable to be accessible in Baby classes. More...
 

Functions

std::set< VariableGetVariables (const std::set< std::string > &files)
 
bool IsComment (const std::string &line)
 Check if line in variable list file is a comment (blank) More...
 
SimpleVariable GetVariable (std::string line)
 Extracts variable type and name from line from variable text files. More...
 
void RemoveExtraSpaces (std::string &line)
 Removes leading, trailing, and double spaced from a text line. More...
 
void WriteBaseHeader (const std::set< Variable > &vars, const std::set< std::string > &types)
 Writes inc/baby.hpp. More...
 
void WriteBaseSource (const std::set< Variable > &vars)
 Writes src/baby.cpp. More...
 
void WriteSpecializedHeader (const std::set< Variable > &vars, const std::string &type)
 Writes a derived Baby header file. More...
 
void WriteSpecializedSource (const std::set< Variable > &vars, const std::string &type)
 Writes a derived Baby source file. More...
 
void WriteMergedHeader (const std::set< Variable > &vars, const std::set< std::string > &types)
 

Function Documentation

SimpleVariable GetVariable ( string  line)

Extracts variable type and name from line from variable text files.

Parameters
[in]lineThe line to be parsed
Returns
SimpleVariable with name and type set

Definition at line 344 of file generate_baby.cxx.

References ERROR, and RemoveExtraSpaces().

Referenced by GetVariables().

std::set<Variable> GetVariables ( const set< string > &  files)

/brief Reads files to get variable names and associated types

Parameters
[in]filesSet of files to be read. Typically everything in txt/variables
Returns
All variables with associated types used for each derived Baby class

Definition at line 285 of file generate_baby.cxx.

References GetVariable(), IsComment(), Variable::Name(), SimpleVariable::name_, Variable::SetEntry(), and SimpleVariable::type_.

Referenced by main().

bool IsComment ( const string &  line)

Check if line in variable list file is a comment (blank)

Not very robust. Currently, a line is a "comment" if is is less than 3 characters long or contains neither letters nor underscores. Should add support for "#" starting a comment line and more robust checking.

Returns
True if line meets above definition of a comment

Definition at line 325 of file generate_baby.cxx.

Referenced by GetVariables().

void RemoveExtraSpaces ( string &  line)

Removes leading, trailing, and double spaced from a text line.

Parameters
[in,out]lineLine of text from which spaces are to be removed

Definition at line 361 of file generate_baby.cxx.

Referenced by GetVariable().

void WriteBaseHeader ( const set< Variable > &  vars,
const set< string > &  types 
)

Writes inc/baby.hpp.

Parameters
[in]varsAll variables for all Baby classes, with type information
[in]typesNames of derived Baby classes (basic, full, etc.)

Definition at line 410 of file generate_baby.cxx.

Referenced by main().

void WriteBaseSource ( const set< Variable > &  vars)

Writes src/baby.cpp.

Parameters
[in]varsAll variables for all Baby classes, with type information

Definition at line 524 of file generate_baby.cxx.

Referenced by main().

void WriteMergedHeader ( const std::set< Variable > &  vars,
const std::set< std::string > &  types 
)
void WriteSpecializedHeader ( const set< Variable > &  vars,
const string &  type 
)

Writes a derived Baby header file.

Parameters
[in]varsAll variables for all Baby classes, with type information
[in]typeName of derived Baby class (basic, full, etc.)

Definition at line 811 of file generate_baby.cxx.

References ToUpper().

Referenced by main().

void WriteSpecializedSource ( const set< Variable > &  vars,
const string &  type 
)

Writes a derived Baby source file.

Parameters
[in]varsAll variables for all Baby classes, with type information
[in]typeName of derived Baby class (basic, full, etc.)

Definition at line 871 of file generate_baby.cxx.

Referenced by main().