ra4_draw
4bd0201e3d922d42bd545d4b045ed44db33454a4
|
A variable to be accessible in Baby classes. More...
#include <generate_baby.hpp>
Public Member Functions | |
Variable (const std::string &name) | |
Standard constructor. More... | |
const std::string & | Name () const |
Get variable name. More... | |
std::string & | Name () |
Get variable name. More... | |
std::string | Type () const |
Get one type for variable across all Baby classes. More... | |
std::string | Type (const std::string &baby_type) const |
Get type of variable for a derived Baby class. More... | |
std::string | DecoratedType () const |
Get type with "std::" and "*" if needed. More... | |
std::string | DecoratedType (const std::string &baby_type) const |
Get type with "std::" and "*" if needed. More... | |
bool | HasEntry (const std::string &baby_type) const |
Check if a derived Baby class has this variable. More... | |
void | SetEntry (const std::string &baby_type, const std::string &type) |
Set the type of this variable for use in a derived Baby class. More... | |
bool | ImplementInBase () const |
Check if variable can be implemented directly in Baby. More... | |
bool | VirtualInBase () const |
Check if variable should have pure virtual method in Baby. More... | |
bool | ImplementIn (const std::string &baby_type) const |
Check if variable needs accessor implemented in a derived Baby class. More... | |
bool | NotInBase () const |
Check if variable is completely absent in base Baby. More... | |
bool | EverythingIn (const std::string &baby_type) const |
Check if variable needs declaration and definition in a derived class. More... | |
bool | operator< (const Variable &other) const |
Comparison operator allows storing Variable in set. More... | |
Private Member Functions | |
std::set< std::string > | GetTypeSet () const |
Get all types (int, float, etc.) used across derived Baby classes. More... | |
Private Attributes | |
std::string | name_ |
Name of variable (e.g., ht, met, etc.) More... | |
std::map< std::string, std::string > | type_map_ |
Map from Baby type (basic, full, etc.) to variabl type (int, float, etc.) More... | |
A variable to be accessible in Baby classes.
Stores information about which concrete classes in which to implement the variable.
Used only to generate Baby classes, but not in subsequent analysis code.
Definition at line 14 of file generate_baby.hpp.
Variable::Variable | ( | const std::string & | name | ) |
Standard constructor.
[in] | name | Name of variable (e.g., ht, met, etc.) |
Definition at line 63 of file generate_baby.cxx.
string Variable::DecoratedType | ( | ) | const |
Get type with "std::" and "*" if needed.
Definition at line 124 of file generate_baby.cxx.
References Type().
string Variable::DecoratedType | ( | const std::string & | baby_type | ) | const |
Get type with "std::" and "*" if needed.
[in] | baby_type | Name of derived Baby class (e.g., basic, full) for which to get type |
Definition at line 142 of file generate_baby.cxx.
References Type().
bool Variable::EverythingIn | ( | const std::string & | baby_type | ) | const |
Check if variable needs declaration and definition in a derived class.
[in] | baby_type | Specifies derived Baby class to check |
Definition at line 247 of file generate_baby.cxx.
References NotInBase(), and Type().
|
private |
Get all types (int, float, etc.) used across derived Baby classes.
May include an empty string if variable is absent from some derived Baby classes
Definition at line 270 of file generate_baby.cxx.
References type_map_.
Referenced by ImplementInBase(), NotInBase(), and VirtualInBase().
bool Variable::HasEntry | ( | const std::string & | baby_type | ) | const |
bool Variable::ImplementIn | ( | const std::string & | baby_type | ) | const |
Check if variable needs accessor implemented in a derived Baby class.
[in] | baby_type | Type of derived Baby to check |
Definition at line 213 of file generate_baby.cxx.
References Type(), and VirtualInBase().
bool Variable::ImplementInBase | ( | ) | const |
Check if variable can be implemented directly in Baby.
Implementation in Baby requires that the variable be present in all derived Baby classes with the same type
Definition at line 179 of file generate_baby.cxx.
References GetTypeSet().
Referenced by Type().
const std::string & Variable::Name | ( | ) | const |
Get variable name.
Definition at line 72 of file generate_baby.cxx.
References name_.
Referenced by GetVariables().
std::string & Variable::Name | ( | ) |
Get variable name.
Definition at line 80 of file generate_baby.cxx.
References name_.
bool Variable::NotInBase | ( | ) | const |
Check if variable is completely absent in base Baby.
This occus if the variable has different types in different derived Baby classes
Definition at line 225 of file generate_baby.cxx.
References GetTypeSet().
Referenced by EverythingIn().
bool Variable::operator< | ( | const Variable & | other | ) | const |
Comparison operator allows storing Variable in set.
Sorts alphabetically by name
[in] | other | Variable to compare to |
Definition at line 259 of file generate_baby.cxx.
References name_.
void Variable::SetEntry | ( | const std::string & | baby_type, |
const std::string & | type | ||
) |
Set the type of this variable for use in a derived Baby class.
[in] | baby_type | Specifies the derived Baby class (e.g., basic, full) for which to set variable type |
[in] | type | Variable type to set (e.g., int, float) |
Definition at line 167 of file generate_baby.cxx.
References type_map_.
Referenced by GetVariables().
string Variable::Type | ( | ) | const |
Get one type for variable across all Baby classes.
Definition at line 91 of file generate_baby.cxx.
References ImplementInBase(), type_map_, and VirtualInBase().
Referenced by DecoratedType(), EverythingIn(), and ImplementIn().
string Variable::Type | ( | const std::string & | baby_type | ) | const |
Get type of variable for a derived Baby class.
[in] | baby_type | Name of derived Baby class (e.g., basic, full) for which to get type |
Definition at line 109 of file generate_baby.cxx.
References HasEntry(), and type_map_.
bool Variable::VirtualInBase | ( | ) | const |
Check if variable should have pure virtual method in Baby.
Pure virtual accessor is needed if and only if the variable has exactly one type across all derived Baby classes, but does is only present in a subset of the classes.
Definition at line 192 of file generate_baby.cxx.
References GetTypeSet().
Referenced by ImplementIn(), and Type().
|
private |
Name of variable (e.g., ht, met, etc.)
Definition at line 41 of file generate_baby.hpp.
Referenced by Name(), and operator<().
|
private |
Map from Baby type (basic, full, etc.) to variabl type (int, float, etc.)
Definition at line 42 of file generate_baby.hpp.
Referenced by GetTypeSet(), HasEntry(), SetEntry(), and Type().