Alexandria 2.32.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Pyston::AttrGetter< T > Class Template Reference

#include <AttributeSet.h>

Inheritance diagram for Pyston::AttrGetter< T >:
Collaboration diagram for Pyston::AttrGetter< T >:

Public Member Functions

 AttrGetter (const unsigned pos, const std::string &name)
std::string repr () const override
void visit (Visitor &visitor) const override
eval (const Context &, const Arguments &arguments) const override
Public Member Functions inherited from Pyston::Node< T >
 Node ()
virtual ~Node ()=default
template<typename... Args>
eval (const Context &context, Args... args) const
template<typename... Args>
eval (Args... args) const
Public Member Functions inherited from Pyston::NodeBase
 NodeBase (const std::type_index &type_index)
virtual ~NodeBase ()=default
const std::type_indextype () const

Private Attributes

unsigned m_pos
std::string m_name

Additional Inherited Members

Protected Member Functions inherited from Pyston::Node< T >
eval_helper (const Context &context, Arguments &arguments) const
template<typename A0, typename... AN>
eval_helper (const Context &context, Arguments &arguments, A0 v0, AN... an) const

Detailed Description

template<typename T>
class Pyston::AttrGetter< T >

A node that retrieves the value from a dictionary

Definition at line 34 of file AttributeSet.h.

Constructor & Destructor Documentation

◆ AttrGetter()

template<typename T>
Pyston::AttrGetter< T >::AttrGetter ( const unsigned pos,
const std::string & name )
inline

Constructor

Parameters
posPosition of the Placeholder. It will be used to retrieve later the value assigned to it.
nameThe name of the attribute

Definition at line 43 of file AttributeSet.h.

References m_name, and m_pos.

Member Function Documentation

◆ eval()

template<typename T>
T Pyston::AttrGetter< T >::eval ( const Context & ,
const Arguments & arguments ) const
inlineoverridevirtual

Evaluate the computing tree

In principle one could avoid to pass any values here, and assign directly the final value to the placeholders that were used to create this tree. However, this would cause the placeholders not to be thread-safe, and a tree would have to be either cloned, either protected by a mutex. Passing the values as an argument allows making the full tree immutable once built, and fully thread safe.

Returns
Result of the evaluation
Exceptions
std::out_of_rangeif the key is missing

Implements Pyston::Node< T >.

Definition at line 65 of file AttributeSet.h.

References m_name, and m_pos.

◆ repr()

template<typename T>
std::string Pyston::AttrGetter< T >::repr ( ) const
inlineoverridevirtual

Returns
A human readable representation of the node
Note
It should not include the representation of the children, if any. That's what visitors are for.

Implements Pyston::NodeBase.

Definition at line 48 of file AttributeSet.h.

References m_name, m_pos, and std::to_string().

Here is the call graph for this function:

◆ visit()

template<typename T>
void Pyston::AttrGetter< T >::visit ( Visitor & visitor) const
inlineoverridevirtual

Entry point for the visitor

Implements Pyston::NodeBase.

Definition at line 55 of file AttributeSet.h.

References Pyston::Visitor::enter(), and Pyston::Visitor::exit().

Here is the call graph for this function:

Member Data Documentation

◆ m_name

template<typename T>
std::string Pyston::AttrGetter< T >::m_name
private

Definition at line 76 of file AttributeSet.h.

Referenced by AttrGetter(), eval(), and repr().

◆ m_pos

template<typename T>
unsigned Pyston::AttrGetter< T >::m_pos
private

Definition at line 75 of file AttributeSet.h.

Referenced by AttrGetter(), eval(), and repr().


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