C++ Mathematical Expression Toolkit (ExprTk) release
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
exprtk::details::generic_function_node< T, GenericFunction > Class Template Reference
Inheritance diagram for exprtk::details::generic_function_node< T, GenericFunction >:
[legend]
Collaboration diagram for exprtk::details::generic_function_node< T, GenericFunction >:
[legend]

Public Types

typedef type_store< Ttype_store_t
 
typedef expression_node< T > * expression_ptr
 
typedef variable_node< Tvariable_node_t
 
typedef vector_node< Tvector_node_t
 
typedef variable_node_tvariable_node_ptr_t
 
typedef vector_node_tvector_node_ptr_t
 
typedef range_interface< Trange_interface_t
 
typedef range_data_type< Trange_data_type_t
 
typedef range_interface< T >::range_t range_t
 
typedef std::pair< expression_ptr, boolbranch_t
 
typedef vector_holder< T > * vh_t
 
typedef vector_view< T > * vecview_t
 
typedef std::vector< Ttmp_vs_t
 
typedef std::vector< type_store_ttypestore_list_t
 
typedef std::vector< range_data_type_trange_list_t
 
- Public Types inherited from exprtk::details::expression_node< T >
enum  node_type {
  e_none , e_null , e_constant , e_unary ,
  e_binary , e_binary_ext , e_trinary , e_quaternary ,
  e_vararg , e_conditional , e_while , e_repeat ,
  e_for , e_switch , e_mswitch , e_return ,
  e_retenv , e_variable , e_stringvar , e_stringconst ,
  e_stringvarrng , e_cstringvarrng , e_strgenrange , e_strconcat ,
  e_stringvarsize , e_strswap , e_stringsize , e_stringvararg ,
  e_function , e_vafunction , e_genfunction , e_strfunction ,
  e_strcondition , e_strccondition , e_add , e_sub ,
  e_mul , e_div , e_mod , e_pow ,
  e_lt , e_lte , e_gt , e_gte ,
  e_eq , e_ne , e_and , e_nand ,
  e_or , e_nor , e_xor , e_xnor ,
  e_in , e_like , e_ilike , e_inranges ,
  e_ipow , e_ipowinv , e_abs , e_acos ,
  e_acosh , e_asin , e_asinh , e_atan ,
  e_atanh , e_ceil , e_cos , e_cosh ,
  e_exp , e_expm1 , e_floor , e_log ,
  e_log10 , e_log2 , e_log1p , e_neg ,
  e_pos , e_round , e_sin , e_sinc ,
  e_sinh , e_sqrt , e_tan , e_tanh ,
  e_cot , e_sec , e_csc , e_r2d ,
  e_d2r , e_d2g , e_g2d , e_notl ,
  e_sgn , e_erf , e_erfc , e_ncdf ,
  e_frac , e_trunc , e_uvouv , e_vov ,
  e_cov , e_voc , e_vob , e_bov ,
  e_cob , e_boc , e_vovov , e_vovoc ,
  e_vocov , e_covov , e_covoc , e_vovovov ,
  e_vovovoc , e_vovocov , e_vocovov , e_covovov ,
  e_covocov , e_vocovoc , e_covovoc , e_vococov ,
  e_sf3ext , e_sf4ext , e_nulleq , e_strass ,
  e_vector , e_vecsize , e_vecelem , e_veccelem ,
  e_vecelemrtc , e_veccelemrtc , e_rbvecelem , e_rbvecelemrtc ,
  e_rbveccelem , e_rbveccelemrtc , e_vecinit , e_vecvalass ,
  e_vecvecass , e_vecopvalass , e_vecopvecass , e_vecfunc ,
  e_vecvecswap , e_vecvecineq , e_vecvalineq , e_valvecineq ,
  e_vecvecarith , e_vecvalarith , e_valvecarith , e_vecunaryop ,
  e_vecondition , e_break , e_continue , e_swap ,
  e_assert
}
 
typedef T value_type
 
typedef expression_node< T > * expression_ptr
 
typedef node_collector_interface< expression_node< T > > nci_t
 
typedef nci_t::noderef_list_t noderef_list_t
 
typedef node_depth_base< expression_node< T > > ndb_t
 
- Public Types inherited from exprtk::details::node_collector_interface< expression_node< T > >
typedef expression_node< T > * node_ptr_t
 
typedef expression_node< T > ** node_pp_t
 
typedef std::vector< node_pp_tnoderef_list_t
 
- Public Types inherited from exprtk::details::node_depth_base< expression_node< T > >
typedef expression_node< T > * node_ptr_t
 
typedef std::pair< node_ptr_t, bool > nb_pair_t
 

Public Member Functions

 generic_function_node (const std::vector< expression_ptr > &arg_list, GenericFunction *func=reinterpret_cast< GenericFunction * >(0))
 
virtual ~generic_function_node ()
 
void collect_nodes (typename expression_node< T >::noderef_list_t &node_delete_list)
 
std::size_t node_depth () const
 
virtual bool init_branches ()
 
bool operator< (const generic_function_node< T, GenericFunction > &fn) const
 
T value () const
 
expression_node< T >::node_type type () const
 
bool valid () const
 
- Public Member Functions inherited from exprtk::details::expression_node< T >
virtual ~expression_node ()
 
virtual expression_node< T > * branch (const std::size_t &index=0) const
 
- Public Member Functions inherited from exprtk::details::node_collector_interface< expression_node< T > >
virtual ~node_collector_interface ()
 
virtual void collect_nodes (noderef_list_t &)
 
- Public Member Functions inherited from exprtk::details::node_depth_base< expression_node< T > >
 node_depth_base ()
 
virtual ~node_depth_base ()
 
std::size_t compute_node_depth (const expression_node< T > *const &node) const
 
std::size_t compute_node_depth (const nb_pair_t &branch) const
 
std::size_t compute_node_depth (const nb_pair_t(&branch)[N]) const
 
std::size_t compute_node_depth (const BranchType &n0, const BranchType &n1) const
 
std::size_t compute_node_depth (const BranchType &n0, const BranchType &n1, const BranchType &n2) const
 
std::size_t compute_node_depth (const BranchType &n0, const BranchType &n1, const BranchType &n2, const BranchType &n3) const
 
std::size_t compute_node_depth (const Sequence< node_ptr_t, Allocator > &branch_list) const
 
std::size_t compute_node_depth (const Sequence< nb_pair_t, Allocator > &branch_list) const
 
std::size_t max_node_depth (const BranchType &n0, const BranchType &n1) const
 
std::size_t max_node_depth (const BranchType &n0, const BranchType &n1, const BranchType &n2) const
 
std::size_t max_node_depth (const BranchType &n0, const BranchType &n1, const BranchType &n2, const BranchType &n3) const
 
void collect (node_ptr_t const &node, const bool deletable, NodeSequence &delete_node_list) const
 
void collect (const nb_pair_t &branch, NodeSequence &delete_node_list) const
 
void collect (expression_node< T > *&node, NodeSequence &delete_node_list) const
 
void collect (const nb_pair_t(&branch)[N], NodeSequence &delete_node_list) const
 
void collect (const Sequence< nb_pair_t, Allocator > &branch, NodeSequence &delete_node_list) const
 
void collect (const Sequence< node_ptr_t, Allocator > &branch_list, NodeSequence &delete_node_list) const
 
void collect (const Sequence< node_ptr_t, AllocatorT > &branch_list, const Sequence< Boolean, AllocatorB > &branch_deletable_list, NodeSequence &delete_node_list) const
 

Protected Member Functions

virtual bool populate_value_list () const
 

Protected Attributes

GenericFunctionfunction_
 
typestore_list_t typestore_list_
 

Private Attributes

std::vector< expression_ptrarg_list_
 
std::vector< branch_tbranch_
 
std::vector< vecview_tvv_list_
 
tmp_vs_t expr_as_vec1_store_
 
range_list_t range_list_
 
std::vector< std::size_t > range_param_list_
 

Additional Inherited Members

- Public Attributes inherited from exprtk::details::node_depth_base< expression_node< T > >
bool depth_set
 
std::size_t depth
 

Detailed Description

template<typename T, typename GenericFunction>
class exprtk::details::generic_function_node< T, GenericFunction >

Definition at line 15025 of file exprtk.hpp.

Member Typedef Documentation

◆ branch_t

Definition at line 15039 of file exprtk.hpp.

◆ expression_ptr

Definition at line 15030 of file exprtk.hpp.

◆ range_data_type_t

Definition at line 15036 of file exprtk.hpp.

◆ range_interface_t

Definition at line 15035 of file exprtk.hpp.

◆ range_list_t

Definition at line 15045 of file exprtk.hpp.

◆ range_t

Definition at line 15037 of file exprtk.hpp.

◆ tmp_vs_t

Definition at line 15043 of file exprtk.hpp.

◆ type_store_t

Definition at line 15029 of file exprtk.hpp.

◆ typestore_list_t

Definition at line 15044 of file exprtk.hpp.

◆ variable_node_ptr_t

Definition at line 15033 of file exprtk.hpp.

◆ variable_node_t

Definition at line 15031 of file exprtk.hpp.

◆ vector_node_ptr_t

Definition at line 15034 of file exprtk.hpp.

◆ vector_node_t

Definition at line 15032 of file exprtk.hpp.

◆ vecview_t

Definition at line 15041 of file exprtk.hpp.

◆ vh_t

Definition at line 15040 of file exprtk.hpp.

Constructor & Destructor Documentation

◆ generic_function_node()

exprtk::details::generic_function_node< T, GenericFunction >::generic_function_node ( const std::vector< expression_ptr > &  arg_list,
GenericFunction func = reinterpret_cast<GenericFunction*>(0) 
)
inlineexplicit

Definition at line 15047 of file exprtk.hpp.

15049 : function_(func)
15051 {}
std::vector< expression_ptr > arg_list_
Definition exprtk.hpp:15268
bool match_impl(const Iterator pattern_begin, const Iterator pattern_end, const Iterator data_begin, const Iterator data_end, const typename std::iterator_traits< Iterator >::value_type &zero_or_more, const typename std::iterator_traits< Iterator >::value_type &exactly_one)
Definition exprtk.hpp:605

◆ ~generic_function_node()

Definition at line 15053 of file exprtk.hpp.

15054 {
15055 for (std::size_t i = 0; i < vv_list_.size(); ++i)
15056 {
15057 vecview_t& vv = vv_list_[i];
15058 if (vv)
15059 {
15060 if (typestore_list_[i].vec_data)
15061 {
15062 vv->remove_ref(&typestore_list_[i].vec_data);
15063 }
15064
15065 vv->remove_size_ref(&typestore_list_[i].size);
15066 typestore_list_[i].vec_data = 0;
15067 }
15068 }
15069 }
std::vector< vecview_t > vv_list_
Definition exprtk.hpp:15270

References exprtk::details::match_impl(), exprtk::vector_view< T >::remove_ref(), exprtk::details::generic_function_node< T, GenericFunction >::typestore_list_, and exprtk::details::generic_function_node< T, GenericFunction >::vv_list_.

Here is the call graph for this function:

Member Function Documentation

◆ collect_nodes()

Definition at line 15071 of file exprtk.hpp.

15072 {
15074 }
std::vector< branch_t > branch_
Definition exprtk.hpp:15269
void collect(node_ptr_t const &node, const bool deletable, NodeSequence &delete_node_list) const
Definition exprtk.hpp:6337

References exprtk::details::generic_function_node< T, GenericFunction >::branch_, exprtk::details::node_depth_base< expression_node< T > >::collect(), and exprtk::details::match_impl().

Here is the call graph for this function:

◆ init_branches()

Definition at line 15081 of file exprtk.hpp.

15082 {
15083 expr_as_vec1_store_.resize(arg_list_.size(), T(0) );
15084 typestore_list_ .resize(arg_list_.size(), type_store_t() );
15085 range_list_ .resize(arg_list_.size(), range_data_type_t());
15086 branch_ .resize(arg_list_.size(), branch_t(reinterpret_cast<expression_ptr>(0),false));
15087 vv_list_ .resize(arg_list_.size(), vecview_t(0));
15088
15089 for (std::size_t i = 0; i < arg_list_.size(); ++i)
15090 {
15092
15093 if (0 == arg_list_[i])
15094 return false;
15095 else if (is_ivector_node(arg_list_[i]))
15096 {
15097 vector_interface<T>* vi = reinterpret_cast<vector_interface<T>*>(0);
15098
15099 if (0 == (vi = dynamic_cast<vector_interface<T>*>(arg_list_[i])))
15100 return false;
15101
15102 ts.size = vi->size();
15103 ts.data = vi->vds().data();
15105 ts.ivec = vi;
15106
15107 if (
15108 vi->vec()->vec_holder().rebaseable() &&
15109 vi->vec()->vec_holder().rebaseable_instance()
15110 )
15111 {
15112 vv_list_[i] = vi->vec()->vec_holder().rebaseable_instance();
15113 vv_list_[i]->set_size_ref(&ts.size);
15114
15116 {
15117 vv_list_[i]->set_ref(&ts.vec_data);
15118 }
15119 }
15120 }
15121 #ifndef exprtk_disable_string_capabilities
15123 {
15124 string_base_node<T>* sbn = reinterpret_cast<string_base_node<T>*>(0);
15125
15126 if (0 == (sbn = dynamic_cast<string_base_node<T>*>(arg_list_[i])))
15127 return false;
15128
15129 ts.size = sbn->size();
15130 ts.data = reinterpret_cast<void*>(const_cast<char_ptr>(sbn->base()));
15132
15133 range_list_[i].data = ts.data;
15134 range_list_[i].size = ts.size;
15135 range_list_[i].type_size = sizeof(char);
15136 range_list_[i].str_node = sbn;
15137
15138 range_interface_t* ri = reinterpret_cast<range_interface_t*>(0);
15139
15140 if (0 == (ri = dynamic_cast<range_interface_t*>(arg_list_[i])))
15141 return false;
15142
15143 const range_t& rp = ri->range_ref();
15144
15145 if (
15146 rp.const_range() &&
15148 )
15149 {
15150 ts.size = rp.const_size();
15151 ts.data = static_cast<char_ptr>(ts.data) + rp.n0_c.second;
15152 range_list_[i].range = reinterpret_cast<range_t*>(0);
15153 }
15154 else
15155 {
15156 range_list_[i].range = &(ri->range_ref());
15157 range_param_list_.push_back(i);
15158 }
15159 }
15160 #endif
15161 else if (is_variable_node(arg_list_[i]))
15162 {
15164
15165 if (0 == (var = dynamic_cast<variable_node_ptr_t>(arg_list_[i])))
15166 return false;
15167
15168 ts.size = 1;
15169 ts.data = &var->ref();
15171 }
15172 else
15173 {
15174 ts.size = 1;
15175 ts.data = reinterpret_cast<void*>(&expr_as_vec1_store_[i]);
15177 }
15178
15179 branch_[i] = std::make_pair(arg_list_[i],branch_deletable(arg_list_[i]));
15180 }
15181
15182 return true;
15183 }
range_interface< T > range_interface_t
Definition exprtk.hpp:15035
std::pair< expression_ptr, bool > branch_t
Definition exprtk.hpp:15039
range_data_type< T > range_data_type_t
Definition exprtk.hpp:15036
range_interface< T >::range_t range_t
Definition exprtk.hpp:15037
std::vector< std::size_t > range_param_list_
Definition exprtk.hpp:15273
expression_node< T > * expression_ptr
Definition exprtk.hpp:15030
bool is_ivector_node(const expression_node< T > *node)
Definition exprtk.hpp:5883
bool branch_deletable(const expression_node< T > *node)
Definition exprtk.hpp:5997
bool is_const_string_range_node(const expression_node< T > *node)
Definition exprtk.hpp:19136
bool amalgamated_vecop(const expression_node< T > *node)
Definition exprtk.hpp:5908
bool is_variable_node(const expression_node< T > *node)
Definition exprtk.hpp:5806
bool is_generally_string_node(const expression_node< T > *node)
Definition exprtk.hpp:19184
char_t * char_ptr
Definition exprtk.hpp:95
std::size_t const_size() const
Definition exprtk.hpp:8567

References exprtk::details::amalgamated_vecop(), exprtk::details::generic_function_node< T, GenericFunction >::arg_list_, exprtk::details::generic_function_node< T, GenericFunction >::branch_, exprtk::details::branch_deletable(), exprtk::details::range_pack< T >::const_size(), exprtk::type_store< T >::e_scalar, exprtk::type_store< T >::e_string, exprtk::type_store< T >::e_vector, exprtk::details::generic_function_node< T, GenericFunction >::expr_as_vec1_store_, exprtk::details::is_const_string_range_node(), exprtk::details::is_generally_string_node(), exprtk::details::is_ivector_node(), exprtk::details::is_variable_node(), exprtk::details::match_impl(), exprtk::details::generic_function_node< T, GenericFunction >::range_list_, exprtk::details::generic_function_node< T, GenericFunction >::range_param_list_, exprtk::details::variable_node< T >::ref(), exprtk::details::string_base_node< T >::size(), exprtk::details::vector_interface< T >::size(), exprtk::details::generic_function_node< T, GenericFunction >::typestore_list_, and exprtk::details::generic_function_node< T, GenericFunction >::vv_list_.

Here is the call graph for this function:

◆ node_depth()

std::size_t exprtk::details::generic_function_node< T, GenericFunction >::node_depth ( ) const
inlinevirtual

Reimplemented from exprtk::details::node_depth_base< expression_node< T > >.

Definition at line 15076 of file exprtk.hpp.

15077 {
15079 }
std::size_t compute_node_depth(const expression_node< T > *const &node) const
Definition exprtk.hpp:6189

References exprtk::details::generic_function_node< T, GenericFunction >::branch_, and exprtk::details::node_depth_base< expression_node< T > >::compute_node_depth().

Here is the call graph for this function:

◆ operator<()

Definition at line 15185 of file exprtk.hpp.

15186 {
15187 return this < (&fn);
15188 }

References exprtk::details::match_impl().

Here is the call graph for this function:

◆ populate_value_list()

virtual bool exprtk::details::generic_function_node< T, GenericFunction >::populate_value_list ( ) const
inlineprotectedvirtual

Definition at line 15214 of file exprtk.hpp.

15215 {
15216 assert(branch_.size() == typestore_list_.size());
15217
15218 for (std::size_t i = 0; i < branch_.size(); ++i)
15219 {
15220 expr_as_vec1_store_[i] = branch_[i].first->value();
15221 }
15222
15223 if (!range_param_list_.empty())
15224 {
15225 assert(range_param_list_.size() <= branch_.size());
15226
15227 for (std::size_t i = 0; i < range_param_list_.size(); ++i)
15228 {
15229 const std::size_t index = range_param_list_[i];
15231
15232 const range_t& rp = (*rdt.range);
15233 std::size_t r0 = 0;
15234 std::size_t r1 = 0;
15235
15236 const std::size_t data_size =
15237 #ifndef exprtk_disable_string_capabilities
15238 rdt.str_node ? rdt.str_node->size() : rdt.size;
15239 #else
15240 rdt.size;
15241 #endif
15242
15243 if (!rp(r0, r1, data_size))
15244 {
15245 return false;
15246 }
15247
15249
15250 ts.size = rp.cache_size();
15251 #ifndef exprtk_disable_string_capabilities
15252 if (ts.type == type_store_t::e_string)
15253 ts.data = const_cast<char_ptr>(rdt.str_node->base()) + rp.cache.first;
15254 else
15255 #endif
15256 ts.data = static_cast<char_ptr>(rdt.data) + (rp.cache.first * rdt.type_size);
15257 }
15258 }
15259
15260 return true;
15261 }
std::size_t cache_size() const
Definition exprtk.hpp:8572

References exprtk::details::generic_function_node< T, GenericFunction >::branch_, exprtk::type_store< T >::e_string, exprtk::details::generic_function_node< T, GenericFunction >::expr_as_vec1_store_, exprtk::details::match_impl(), exprtk::details::generic_function_node< T, GenericFunction >::range_list_, exprtk::details::generic_function_node< T, GenericFunction >::range_param_list_, exprtk::type_store< T >::size, and exprtk::details::generic_function_node< T, GenericFunction >::typestore_list_.

Referenced by exprtk::details::generic_function_node< T, GenericFunction >::value(), exprtk::details::multimode_genfunction_node< T, GenericFunction >::value(), and exprtk::details::return_node< T >::value().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ type()

◆ valid()

Reimplemented from exprtk::details::expression_node< T >.

Reimplemented in exprtk::details::string_function_node< T, StringFunction >, and exprtk::details::return_node< T >.

Definition at line 15207 of file exprtk.hpp.

15208 {
15209 return function_;
15210 }

References exprtk::details::generic_function_node< T, GenericFunction >::function_.

Referenced by exprtk::details::multimode_genfunction_node< T, GenericFunction >::value().

Here is the caller graph for this function:

◆ value()

Reimplemented from exprtk::details::expression_node< T >.

Reimplemented in exprtk::details::string_function_node< T, StringFunction >, exprtk::details::multimode_genfunction_node< T, GenericFunction >, exprtk::details::multimode_strfunction_node< T, StringFunction >, and exprtk::details::return_node< T >.

Definition at line 15190 of file exprtk.hpp.

15191 {
15192 if (populate_value_list())
15193 {
15194 typedef typename GenericFunction::parameter_list_t parameter_list_t;
15195
15196 return (*function_)(parameter_list_t(typestore_list_));
15197 }
15198
15199 return std::numeric_limits<T>::quiet_NaN();
15200 }
virtual bool populate_value_list() const
Definition exprtk.hpp:15214

References exprtk::details::generic_function_node< T, GenericFunction >::function_, exprtk::details::generic_function_node< T, GenericFunction >::populate_value_list(), and exprtk::details::generic_function_node< T, GenericFunction >::typestore_list_.

Here is the call graph for this function:

Member Data Documentation

◆ arg_list_

◆ branch_

◆ expr_as_vec1_store_

◆ function_

◆ range_list_

◆ range_param_list_

std::vector<std::size_t> exprtk::details::generic_function_node< T, GenericFunction >::range_param_list_
private

◆ typestore_list_

◆ vv_list_


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