Flow123d  JS_before_hm-2153-g6b139422c
Public Member Functions | Private Member Functions | Private Attributes | List of all members
units_converter::Semantic_actions< Iter_type > Class Template Reference

Class manages parsing of user defined field unit. More...

#include <unit_converter_template.hh>

Collaboration diagram for units_converter::Semantic_actions< Iter_type >:
Collaboration graph
[legend]

Public Member Functions

 Semantic_actions ()
 Constructor. More...
 
void new_shortcut (Iter_type begin, Iter_type end)
 Add new definition of formula. More...
 
void new_mult_factor (Iter_type begin, Iter_type end)
 Add new factor of unit (factor is multiplying) More...
 
void new_div_factor (Iter_type begin, Iter_type end)
 Add new factor of unit (factor is dividing) More...
 
void new_exp (boost::int64_t i)
 Compute exponent to actual factor of unit. More...
 
void new_multipl (double d)
 Add multipicative coeficient of unit. More...
 
void throw_exp_not_int (Iter_type begin, Iter_type end)
 Throw exception if exponent is not in correct format. More...
 
void throw_not_shortcut (Iter_type begin, Iter_type end)
 Throw exception if shortcut of factor is not in correct format. More...
 
void throw_not_equating (Iter_type begin, Iter_type end)
 Throw exception if sign '=' missing in definition. More...
 
void check_unit_data ()
 Check unit_data_ object. More...
 
UnitData unit_data () const
 

Private Member Functions

Semantic_actionsoperator= (const Semantic_actions &)
 
std::string get_str (std::string::const_iterator begin, std::string::const_iterator end) const
 

Private Attributes

UnitData unit_data_
 Full parsed data. More...
 
std::string unit_data_key_
 key of actual item of unit_data_ More...
 
int factor_idx_
 index to actual item of subvector of factors of unit_data_ More...
 

Detailed Description

template<class Iter_type>
class units_converter::Semantic_actions< Iter_type >

Class manages parsing of user defined field unit.

Class contains:

For example, unit is defined in format: "MPa/rho/g_; rho = 990*kg*m^-3; g_ = 9.8*m*s^-2"

Definition at line 73 of file unit_converter_template.hh.

Constructor & Destructor Documentation

◆ Semantic_actions()

template<class Iter_type >
units_converter::Semantic_actions< Iter_type >::Semantic_actions ( )
inline

Constructor.

Definition at line 77 of file unit_converter_template.hh.

Member Function Documentation

◆ check_unit_data()

template<class Iter_type >
void units_converter::Semantic_actions< Iter_type >::check_unit_data ( )
inline

Check unit_data_ object.

Method:

  • marks factors that are defined as derived unit
  • checks undefined factors of unit
  • check conflicts in definitions of unit (same shortcut is defined by user and predefined in application)
  • checks cyclic definition of unit

Definition at line 155 of file unit_converter_template.hh.

Here is the caller graph for this function:

◆ get_str()

template<class Iter_type >
std::string units_converter::Semantic_actions< Iter_type >::get_str ( std::string::const_iterator  begin,
std::string::const_iterator  end 
) const
inlineprivate

Definition at line 192 of file unit_converter_template.hh.

Here is the caller graph for this function:

◆ new_div_factor()

template<class Iter_type >
void units_converter::Semantic_actions< Iter_type >::new_div_factor ( Iter_type  begin,
Iter_type  end 
)
inline

Add new factor of unit (factor is dividing)

Definition at line 100 of file unit_converter_template.hh.

Here is the caller graph for this function:

◆ new_exp()

template<class Iter_type >
void units_converter::Semantic_actions< Iter_type >::new_exp ( boost::int64_t  i)
inline

Compute exponent to actual factor of unit.

Definition at line 107 of file unit_converter_template.hh.

Here is the caller graph for this function:

◆ new_mult_factor()

template<class Iter_type >
void units_converter::Semantic_actions< Iter_type >::new_mult_factor ( Iter_type  begin,
Iter_type  end 
)
inline

Add new factor of unit (factor is multiplying)

Definition at line 93 of file unit_converter_template.hh.

Here is the caller graph for this function:

◆ new_multipl()

template<class Iter_type >
void units_converter::Semantic_actions< Iter_type >::new_multipl ( double  d)
inline

Add multipicative coeficient of unit.

Definition at line 113 of file unit_converter_template.hh.

Here is the caller graph for this function:

◆ new_shortcut()

template<class Iter_type >
void units_converter::Semantic_actions< Iter_type >::new_shortcut ( Iter_type  begin,
Iter_type  end 
)
inline

Add new definition of formula.

Definition at line 84 of file unit_converter_template.hh.

Here is the caller graph for this function:

◆ operator=()

template<class Iter_type >
Semantic_actions& units_converter::Semantic_actions< Iter_type >::operator= ( const Semantic_actions< Iter_type > &  )
private

◆ throw_exp_not_int()

template<class Iter_type >
void units_converter::Semantic_actions< Iter_type >::throw_exp_not_int ( Iter_type  begin,
Iter_type  end 
)
inline

Throw exception if exponent is not in correct format.

Definition at line 119 of file unit_converter_template.hh.

Here is the caller graph for this function:

◆ throw_not_equating()

template<class Iter_type >
void units_converter::Semantic_actions< Iter_type >::throw_not_equating ( Iter_type  begin,
Iter_type  end 
)
inline

Throw exception if sign '=' missing in definition.

Definition at line 139 of file unit_converter_template.hh.

Here is the caller graph for this function:

◆ throw_not_shortcut()

template<class Iter_type >
void units_converter::Semantic_actions< Iter_type >::throw_not_shortcut ( Iter_type  begin,
Iter_type  end 
)
inline

Throw exception if shortcut of factor is not in correct format.

Definition at line 127 of file unit_converter_template.hh.

Here is the caller graph for this function:

◆ unit_data()

template<class Iter_type >
UnitData units_converter::Semantic_actions< Iter_type >::unit_data ( ) const
inline

Definition at line 185 of file unit_converter_template.hh.

Here is the caller graph for this function:

Member Data Documentation

◆ factor_idx_

template<class Iter_type >
int units_converter::Semantic_actions< Iter_type >::factor_idx_
private

index to actual item of subvector of factors of unit_data_

Definition at line 200 of file unit_converter_template.hh.

◆ unit_data_

template<class Iter_type >
UnitData units_converter::Semantic_actions< Iter_type >::unit_data_
private

Full parsed data.

Definition at line 198 of file unit_converter_template.hh.

◆ unit_data_key_

template<class Iter_type >
std::string units_converter::Semantic_actions< Iter_type >::unit_data_key_
private

key of actual item of unit_data_

Definition at line 199 of file unit_converter_template.hh.


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