ATLAS Offline Software
|
Class describing a single element in a text expression. More...
#include <StackElement.h>
Public Types | |
enum | ElementType { SE_UNK = 0, SE_INT = 1, SE_DOUBLE = 2, SE_VECINT = 3, SE_VECDOUBLE = 4 } |
Type of the data held by this object. More... | |
Public Member Functions | |
template<> | |
std::vector< int > | vectorValue (std::size_t sizeIfScalar) |
template<> | |
std::vector< double > | vectorValue (size_t sizeIfScalar) |
template<> | |
StackElement | _pow (const StackElement &n) |
template<> | |
void | ensureCompatibleVectors (const StackElement &other) const |
Constructor definitions | |
StackElement () | |
Default constructor. More... | |
StackElement (unsigned int val) | |
Constructor creating the object with an unsigned integer value. More... | |
StackElement (int val) | |
Constructor creating the object with a signed integer value. More... | |
StackElement (double val) | |
Constructor creating the object with a double value. More... | |
StackElement (const std::vector< int > &val) | |
Constructor creating the object with a vector of integers value. More... | |
StackElement (const std::vector< double > &val) | |
Constructor creating the object with a vector of doubles value. More... | |
StackElement (std::vector< int > &&val) | |
Constructor creating the object with a vector of integers value. More... | |
StackElement (std::vector< double > &&val) | |
Constructor creating the object with a vector of doubles value. More... | |
StackElement (const std::string &val, IProxyLoader *proxyLoader) | |
Constructor creating the object from a text expression. More... | |
StackElement (const StackElement &a) | |
StackElement (StackElement &&a) | |
Assignment operators | |
StackElement & | operator= (int rhs) |
Operator assigning an integer value to the object. More... | |
StackElement & | operator= (double rhs) |
Operator assigning a double value to the object. More... | |
StackElement & | operator= (const std::vector< int > &rhs) |
Operator assigning a vector of integers to the object. More... | |
StackElement & | operator= (const std::vector< double > &rhs) |
Operator assigning a vector of doubles to the object. More... | |
StackElement & | operator= (std::vector< int > &&rhs) |
Operator assigning a vector of integers to the object. More... | |
StackElement & | operator= (std::vector< double > &&rhs) |
Operator assigning a vector of doubles to the object. More... | |
StackElement & | operator= (StackElement &&rhs) |
Comparison and logical operators | |
StackElement | operator! () |
NOT operator. More... | |
StackElement | operator- () |
Inverse operator. More... | |
Modifier operators | |
StackElement & | operator-= (StackElement &rhs) |
Subtract a scalar type from the object. More... | |
template<typename T > | |
StackElement & | operator-= (const T &rhs) |
template<typename T > | |
StackElement & | operator-= (const std::vector< T > &rhs) |
Subtract a vector type from the object. More... | |
StackElement & | operator+= (StackElement &rhs) |
Add a scalar type to the object. More... | |
template<typename T > | |
StackElement & | operator+= (const T &rhs) |
template<typename T > | |
StackElement & | operator+= (const std::vector< T > &rhs) |
Add a vector type to the object. More... | |
StackElement & | operator*= (StackElement &rhs) |
Multiply the object by a scalar type. More... | |
template<typename T > | |
StackElement & | operator*= (const T &rhs) |
template<typename T > | |
StackElement & | operator*= (const std::vector< T > &rhs) |
Multiply the object by a vector type. More... | |
StackElement & | operator/= (StackElement &rhs) |
Divide the object by a scalar type. More... | |
template<typename T > | |
StackElement & | operator/= (const T &rhs) |
template<typename T > | |
StackElement & | operator/= (const std::vector< T > &rhs) |
Divide the object by a vector type. More... | |
StackElement | operator- (StackElement &rhs) |
Operator subtracting a value from the object. More... | |
template<typename T > | |
StackElement | operator- (const T &rhs) |
StackElement | operator+ (StackElement &rhs) |
Operator adding a value to the object. More... | |
template<typename T > | |
StackElement | operator+ (const T &rhs) |
StackElement | operator* (StackElement &rhs) |
Operator multiplying the object by a value. More... | |
template<typename T > | |
StackElement | operator* (const T &rhs) |
StackElement | operator/ (StackElement &rhs) |
Operator dividing the object by a value. More... | |
template<typename T > | |
StackElement | operator/ (const T &rhs) |
Accessor functions | |
ElementType | getType () const |
Get the variable type of the object. More... | |
bool | isScalar () const |
Check if the object describes a scalar value. More... | |
bool | isVector () const |
Check if the object describes a vector value. More... | |
bool | isProxy () const |
Check if the object takes its value from a StoreGate object. More... | |
const std::string & | proxyVarName () const |
int | asInt () const |
Get the internal value of the object as an integer. More... | |
bool | asBool () const |
Get the internal value of the object as a boolean. More... | |
template<typename T > | |
T | scalarValue () const |
Evaluate the value of the object into the requested scalar type. More... | |
template<typename T > | |
std::vector< T > | vectorValue (std::size_t sizeIfScalar=0) |
Evaluate the value of the object into the requested vector type. More... | |
Modifier functions | |
void | makeInt () |
Function constructing internal integer values in case double values were given to the object initially. More... | |
void | makeDouble () |
Function constructing internal double values in case integer values were given to the object initially. More... | |
void | makeVector (std::size_t n) |
Function converting a possibly scalar value into a vector. More... | |
StackElement | valueFromProxy () const |
Set the internal variables of the object based on the objects in SG. More... | |
Internal functions evaluating mathematical operations | |
template<typename T > | |
StackElement | _pow (const T &n) |
Function raising the object's value to the n'th power. More... | |
StackElement | _sum () |
Function calculating a sum value. More... | |
StackElement | _count () |
Function counting elements. More... | |
StackElement | _abs () |
Function taking the absolute value of the object. More... | |
StackElement | _sqrt () |
Function taking the square root of the object. More... | |
StackElement | _cbrt () |
Function taking the cubic root of the object. More... | |
StackElement | _sin () |
Function taking the sinus value of the object. More... | |
StackElement | _cos () |
Function taking the cosine value of the object. More... | |
StackElement | _tan () |
Function taking the tangent value of the object. More... | |
StackElement | _asin () |
Function taking the arc sinus value of the object. More... | |
StackElement | _acos () |
Function taking the arc cosine value of the object. More... | |
StackElement | _atan () |
Function taking the arc tangent value of the object. More... | |
StackElement | _sinh () |
Function taking the sinus hyperbolic value of the object. More... | |
StackElement | _cosh () |
Function taking the cosine hyperbolic value of the object. More... | |
StackElement | _tanh () |
Function taking the tangent hyperbolic value of the object. More... | |
StackElement | _asinh () |
Function taking the arc sinus hyperbolic value of the object. More... | |
StackElement | _acosh () |
Function taking the arc cosine hyperbolic value of the object. More... | |
StackElement | _atanh () |
Function taking the arc tangent hyperbolic value of the object. More... | |
StackElement | _log () |
Function taking the logarithm of the object. More... | |
StackElement | _exp () |
Function taking the natural exponent of the object. More... | |
Private Member Functions | |
Internal operations on the object | |
void | makeVectorIfNecessary (const StackElement &other) |
The macro is not needed anymore: More... | |
void | makeVectorIfNecessary (const std::vector< int > &other) |
void | makeVectorIfNecessary (const std::vector< double > &other) |
void | makeDoubleIfNecessary (const StackElement &other) |
void | makeDoubleIfNecessary (int other) |
void | makeDoubleIfNecessary (double other) |
void | makeDoubleIfNecessary (const std::vector< int > &other) |
void | makeDoubleIfNecessary (const std::vector< double > &other) |
void | ensureCompatible (const StackElement &other) const |
template<typename T > | |
void | ensureCompatibleVectors (const T &other) const |
template<typename T > | |
void | ensureCompatibleVectors (const std::vector< T > &other) const |
size_t | size () const |
Private Attributes | |
ElementType | m_type = SE_UNK |
The type of the variable held by the object. More... | |
int | m_intVal = 0 |
The value of the object represented as an integer. More... | |
double | m_doubleVal = 0. |
The value of the object represented as a double. More... | |
std::vector< int > | m_vecIntVal |
The value of the object represented as a vector of integers. More... | |
std::vector< double > | m_vecDoubleVal |
The value of the object represented as a vector of doubles. More... | |
std::string | m_varName |
The name/definition of the variable. More... | |
IProxyLoader * | m_proxyLoader = nullptr |
Loader for the described variable. More... | |
std::atomic< IProxyLoader::VariableType > | m_variableType = IProxyLoader::VT_UNK |
Type of the variable provided by the proxy loader. More... | |
std::atomic< bool > | m_determinedVariableType = false |
Internal flag showing whether the type of the variable was already determined. More... | |
std::atomic< bool > | m_moved = false |
Friends | |
std::ostream & | operator<< (std::ostream &os, const StackElement &el) |
Declare the print operator as a friend of the class. More... | |
Internal functions evaluating binary comparisons | |
StackElement | _eq (StackElement &other) |
StackElement | _neq (StackElement &other) |
StackElement | _and (StackElement &other) |
StackElement | _or (StackElement &other) |
StackElement | _gt (StackElement &other) |
StackElement | _gte (StackElement &other) |
StackElement | _lt (StackElement &other) |
StackElement | _lte (StackElement &other) |
template<class T_CompHelper > | |
StackElement | _comparisonOp (StackElement &other, T_CompHelper comp_helper) |
Class describing a single element in a text expression.
A vector of such objects is used to describe a full text expression. As such, it's able to perform all the operations that can be described in a text expression. Most operations are destructive i.e. vector content will be modified and moved on operations. This is to reduce the number of vector copy operations. Thus, if the content should be preserved, a copy needs to be created and the operation should be applied to the copy.
$Revision$ $Date$
Definition at line 50 of file StackElement.h.
enum ExpressionParsing::StackElement::ElementType |
Type of the data held by this object.
Definition at line 58 of file StackElement.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Constructor creating the object with a vector of integers value.
Definition at line 78 of file StackElement.h.
|
inline |
Constructor creating the object with a vector of doubles value.
Definition at line 80 of file StackElement.h.
|
inline |
Constructor creating the object with a vector of integers value.
Definition at line 82 of file StackElement.h.
|
inline |
Constructor creating the object with a vector of doubles value.
Definition at line 84 of file StackElement.h.
|
inline |
Constructor creating the object from a text expression.
Definition at line 86 of file StackElement.h.
ExpressionParsing::StackElement::StackElement | ( | const StackElement & | a | ) |
ExpressionParsing::StackElement::StackElement | ( | StackElement && | a | ) |
StackElement ExpressionParsing::StackElement::_abs | ( | ) |
StackElement ExpressionParsing::StackElement::_acos | ( | ) |
Function taking the arc cosine value of the object.
StackElement ExpressionParsing::StackElement::_acosh | ( | ) |
Function taking the arc cosine hyperbolic value of the object.
StackElement ExpressionParsing::StackElement::_and | ( | StackElement & | other | ) |
Definition at line 507 of file StackElement.cxx.
StackElement ExpressionParsing::StackElement::_asin | ( | ) |
Function taking the arc sinus value of the object.
StackElement ExpressionParsing::StackElement::_asinh | ( | ) |
Function taking the arc sinus hyperbolic value of the object.
StackElement ExpressionParsing::StackElement::_atan | ( | ) |
Function taking the arc tangent value of the object.
StackElement ExpressionParsing::StackElement::_atanh | ( | ) |
Function taking the arc tangent hyperbolic value of the object.
StackElement ExpressionParsing::StackElement::_cbrt | ( | ) |
Function taking the cubic root of the object.
|
private |
Definition at line 466 of file StackElement.cxx.
StackElement ExpressionParsing::StackElement::_cos | ( | ) |
Function taking the cosine value of the object.
StackElement ExpressionParsing::StackElement::_cosh | ( | ) |
Function taking the cosine hyperbolic value of the object.
StackElement ExpressionParsing::StackElement::_count | ( | ) |
StackElement ExpressionParsing::StackElement::_eq | ( | StackElement & | other | ) |
Definition at line 505 of file StackElement.cxx.
StackElement ExpressionParsing::StackElement::_exp | ( | ) |
Function taking the natural exponent of the object.
StackElement ExpressionParsing::StackElement::_gt | ( | StackElement & | other | ) |
Definition at line 509 of file StackElement.cxx.
StackElement ExpressionParsing::StackElement::_gte | ( | StackElement & | other | ) |
Definition at line 510 of file StackElement.cxx.
StackElement ExpressionParsing::StackElement::_log | ( | ) |
Function taking the logarithm of the object.
StackElement ExpressionParsing::StackElement::_lt | ( | StackElement & | other | ) |
Definition at line 511 of file StackElement.cxx.
StackElement ExpressionParsing::StackElement::_lte | ( | StackElement & | other | ) |
Definition at line 512 of file StackElement.cxx.
StackElement ExpressionParsing::StackElement::_neq | ( | StackElement & | other | ) |
Definition at line 506 of file StackElement.cxx.
StackElement ExpressionParsing::StackElement::_or | ( | StackElement & | other | ) |
Definition at line 508 of file StackElement.cxx.
StackElement ExpressionParsing::StackElement::_pow | ( | const StackElement & | n | ) |
Definition at line 516 of file StackElement.cxx.
StackElement ExpressionParsing::StackElement::_pow | ( | const T & | n | ) |
Function raising the object's value to the n'th power.
StackElement ExpressionParsing::StackElement::_sin | ( | ) |
Function taking the sinus value of the object.
StackElement ExpressionParsing::StackElement::_sinh | ( | ) |
Function taking the sinus hyperbolic value of the object.
StackElement ExpressionParsing::StackElement::_sqrt | ( | ) |
Function taking the square root of the object.
StackElement ExpressionParsing::StackElement::_sum | ( | ) |
StackElement ExpressionParsing::StackElement::_tan | ( | ) |
Function taking the tangent value of the object.
StackElement ExpressionParsing::StackElement::_tanh | ( | ) |
Function taking the tangent hyperbolic value of the object.
bool ExpressionParsing::StackElement::asBool | ( | ) | const |
Get the internal value of the object as a boolean.
Definition at line 255 of file StackElement.cxx.
int ExpressionParsing::StackElement::asInt | ( | ) | const |
Get the internal value of the object as an integer.
Definition at line 246 of file StackElement.cxx.
|
private |
Definition at line 752 of file StackElement.cxx.
void ExpressionParsing::StackElement::ensureCompatibleVectors | ( | const StackElement & | other | ) | const |
Definition at line 763 of file StackElement.cxx.
|
private |
|
private |
StackElement::ElementType ExpressionParsing::StackElement::getType | ( | ) | const |
Get the variable type of the object.
The macro is not needed anymore:
Definition at line 226 of file StackElement.cxx.
bool ExpressionParsing::StackElement::isProxy | ( | ) | const |
Check if the object takes its value from a StoreGate object.
Definition at line 241 of file StackElement.cxx.
bool ExpressionParsing::StackElement::isScalar | ( | ) | const |
bool ExpressionParsing::StackElement::isVector | ( | ) | const |
Check if the object describes a vector value.
Definition at line 236 of file StackElement.cxx.
void ExpressionParsing::StackElement::makeDouble | ( | ) |
Function constructing internal double values in case integer values were given to the object initially.
Definition at line 347 of file StackElement.cxx.
|
private |
Definition at line 713 of file StackElement.cxx.
|
private |
Definition at line 743 of file StackElement.cxx.
|
private |
Definition at line 738 of file StackElement.cxx.
|
private |
Definition at line 729 of file StackElement.cxx.
|
private |
Definition at line 724 of file StackElement.cxx.
void ExpressionParsing::StackElement::makeInt | ( | ) |
Function constructing internal integer values in case double values were given to the object initially.
Definition at line 331 of file StackElement.cxx.
void ExpressionParsing::StackElement::makeVector | ( | std::size_t | n | ) |
Function converting a possibly scalar value into a vector.
Definition at line 363 of file StackElement.cxx.
|
private |
|
private |
Definition at line 703 of file StackElement.cxx.
|
private |
Definition at line 692 of file StackElement.cxx.
StackElement ExpressionParsing::StackElement::operator! | ( | ) |
StackElement ExpressionParsing::StackElement::operator* | ( | const T & | rhs | ) |
StackElement ExpressionParsing::StackElement::operator* | ( | StackElement & | rhs | ) |
Operator multiplying the object by a value.
StackElement& ExpressionParsing::StackElement::operator*= | ( | const std::vector< T > & | rhs | ) |
Multiply the object by a vector type.
StackElement& ExpressionParsing::StackElement::operator*= | ( | const T & | rhs | ) |
StackElement& ExpressionParsing::StackElement::operator*= | ( | StackElement & | rhs | ) |
Multiply the object by a scalar type.
StackElement ExpressionParsing::StackElement::operator+ | ( | const T & | rhs | ) |
StackElement ExpressionParsing::StackElement::operator+ | ( | StackElement & | rhs | ) |
Operator adding a value to the object.
StackElement& ExpressionParsing::StackElement::operator+= | ( | const std::vector< T > & | rhs | ) |
Add a vector type to the object.
StackElement& ExpressionParsing::StackElement::operator+= | ( | const T & | rhs | ) |
StackElement& ExpressionParsing::StackElement::operator+= | ( | StackElement & | rhs | ) |
Add a scalar type to the object.
StackElement ExpressionParsing::StackElement::operator- | ( | ) |
StackElement ExpressionParsing::StackElement::operator- | ( | const T & | rhs | ) |
StackElement ExpressionParsing::StackElement::operator- | ( | StackElement & | rhs | ) |
Operator subtracting a value from the object.
StackElement& ExpressionParsing::StackElement::operator-= | ( | const std::vector< T > & | rhs | ) |
Subtract a vector type from the object.
StackElement& ExpressionParsing::StackElement::operator-= | ( | const T & | rhs | ) |
StackElement& ExpressionParsing::StackElement::operator-= | ( | StackElement & | rhs | ) |
Subtract a scalar type from the object.
StackElement ExpressionParsing::StackElement::operator/ | ( | const T & | rhs | ) |
StackElement ExpressionParsing::StackElement::operator/ | ( | StackElement & | rhs | ) |
Operator dividing the object by a value.
StackElement& ExpressionParsing::StackElement::operator/= | ( | const std::vector< T > & | rhs | ) |
Divide the object by a vector type.
StackElement& ExpressionParsing::StackElement::operator/= | ( | const T & | rhs | ) |
StackElement& ExpressionParsing::StackElement::operator/= | ( | StackElement & | rhs | ) |
Divide the object by a scalar type.
StackElement & ExpressionParsing::StackElement::operator= | ( | const std::vector< double > & | rhs | ) |
Operator assigning a vector of doubles to the object.
Definition at line 86 of file StackElement.cxx.
StackElement & ExpressionParsing::StackElement::operator= | ( | const std::vector< int > & | rhs | ) |
Operator assigning a vector of integers to the object.
Definition at line 64 of file StackElement.cxx.
StackElement & ExpressionParsing::StackElement::operator= | ( | double | rhs | ) |
StackElement & ExpressionParsing::StackElement::operator= | ( | int | rhs | ) |
StackElement& ExpressionParsing::StackElement::operator= | ( | StackElement && | rhs | ) |
StackElement & ExpressionParsing::StackElement::operator= | ( | std::vector< double > && | rhs | ) |
Operator assigning a vector of doubles to the object.
Definition at line 98 of file StackElement.cxx.
StackElement & ExpressionParsing::StackElement::operator= | ( | std::vector< int > && | rhs | ) |
Operator assigning a vector of integers to the object.
Definition at line 75 of file StackElement.cxx.
|
inline |
Definition at line 184 of file StackElement.h.
T ExpressionParsing::StackElement::scalarValue | ( | ) | const |
Evaluate the value of the object into the requested scalar type.
|
private |
StackElement ExpressionParsing::StackElement::valueFromProxy | ( | ) | const |
Set the internal variables of the object based on the objects in SG.
Definition at line 382 of file StackElement.cxx.
std::vector< double > ExpressionParsing::StackElement::vectorValue | ( | size_t | sizeIfScalar | ) |
Definition at line 299 of file StackElement.cxx.
std::vector< int > ExpressionParsing::StackElement::vectorValue | ( | std::size_t | sizeIfScalar | ) |
Definition at line 266 of file StackElement.cxx.
std::vector< T > ExpressionParsing::StackElement::vectorValue | ( | std::size_t | sizeIfScalar = 0 | ) |
Evaluate the value of the object into the requested vector type.
|
friend |
Declare the print operator as a friend of the class.
Definition at line 775 of file StackElement.cxx.
|
mutableprivate |
Internal flag showing whether the type of the variable was already determined.
Definition at line 323 of file StackElement.h.
|
private |
The value of the object represented as a double.
Definition at line 309 of file StackElement.h.
|
private |
The value of the object represented as an integer.
Definition at line 307 of file StackElement.h.
|
mutableprivate |
Definition at line 324 of file StackElement.h.
|
private |
Loader for the described variable.
Definition at line 318 of file StackElement.h.
|
private |
The type of the variable held by the object.
Definition at line 304 of file StackElement.h.
|
mutableprivate |
Type of the variable provided by the proxy loader.
Definition at line 320 of file StackElement.h.
|
private |
The name/definition of the variable.
Definition at line 316 of file StackElement.h.
|
private |
The value of the object represented as a vector of doubles.
Definition at line 313 of file StackElement.h.
|
private |
The value of the object represented as a vector of integers.
Definition at line 311 of file StackElement.h.