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 14854 of file exprtk.hpp.

Member Typedef Documentation

◆ branch_t

Definition at line 14868 of file exprtk.hpp.

◆ expression_ptr

Definition at line 14859 of file exprtk.hpp.

◆ range_data_type_t

Definition at line 14865 of file exprtk.hpp.

◆ range_interface_t

Definition at line 14864 of file exprtk.hpp.

◆ range_list_t

Definition at line 14874 of file exprtk.hpp.

◆ range_t

Definition at line 14866 of file exprtk.hpp.

◆ tmp_vs_t

Definition at line 14872 of file exprtk.hpp.

◆ type_store_t

Definition at line 14858 of file exprtk.hpp.

◆ typestore_list_t

Definition at line 14873 of file exprtk.hpp.

◆ variable_node_ptr_t

Definition at line 14862 of file exprtk.hpp.

◆ variable_node_t

Definition at line 14860 of file exprtk.hpp.

◆ vector_node_ptr_t

Definition at line 14863 of file exprtk.hpp.

◆ vector_node_t

Definition at line 14861 of file exprtk.hpp.

◆ vecview_t

Definition at line 14870 of file exprtk.hpp.

◆ vh_t

Definition at line 14869 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 14876 of file exprtk.hpp.

14878 : function_(func)
14880 {}
std::vector< expression_ptr > arg_list_
Definition exprtk.hpp:15084
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:598

◆ ~generic_function_node()

Definition at line 14882 of file exprtk.hpp.

14883 {
14884 for (std::size_t i = 0; i < vv_list_.size(); ++i)
14885 {
14886 vecview_t& vv = vv_list_[i];
14887 if (vv && typestore_list_[i].vec_data)
14888 {
14889 vv->remove_ref(&typestore_list_[i].vec_data);
14890 typestore_list_[i].vec_data = 0;
14891 }
14892 }
14893 }
std::vector< vecview_t > vv_list_
Definition exprtk.hpp:15086

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 14895 of file exprtk.hpp.

14896 {
14898 }
std::vector< branch_t > branch_
Definition exprtk.hpp:15085
void collect(node_ptr_t const &node, const bool deletable, NodeSequence &delete_node_list) const
Definition exprtk.hpp:6192

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 14905 of file exprtk.hpp.

14906 {
14907 expr_as_vec1_store_.resize(arg_list_.size(), T(0) );
14908 typestore_list_ .resize(arg_list_.size(), type_store_t() );
14909 range_list_ .resize(arg_list_.size(), range_data_type_t());
14910 branch_ .resize(arg_list_.size(), branch_t(reinterpret_cast<expression_ptr>(0),false));
14911 vv_list_ .resize(arg_list_.size(), vecview_t(0));
14912
14913 for (std::size_t i = 0; i < arg_list_.size(); ++i)
14914 {
14916
14917 if (0 == arg_list_[i])
14918 return false;
14919 else if (is_ivector_node(arg_list_[i]))
14920 {
14921 vector_interface<T>* vi = reinterpret_cast<vector_interface<T>*>(0);
14922
14923 if (0 == (vi = dynamic_cast<vector_interface<T>*>(arg_list_[i])))
14924 return false;
14925
14926 ts.size = vi->size();
14927 ts.data = vi->vds().data();
14929
14930 if (
14931 vi->vec()->vec_holder().rebaseable() &&
14932 vi->vec()->vec_holder().rebaseable_instance()
14933 )
14934 {
14935 vv_list_[i] = vi->vec()->vec_holder().rebaseable_instance();
14936 vv_list_[i]->set_ref(&ts.vec_data);
14937 }
14938 }
14939 #ifndef exprtk_disable_string_capabilities
14941 {
14942 string_base_node<T>* sbn = reinterpret_cast<string_base_node<T>*>(0);
14943
14944 if (0 == (sbn = dynamic_cast<string_base_node<T>*>(arg_list_[i])))
14945 return false;
14946
14947 ts.size = sbn->size();
14948 ts.data = reinterpret_cast<void*>(const_cast<char_ptr>(sbn->base()));
14950
14951 range_list_[i].data = ts.data;
14952 range_list_[i].size = ts.size;
14953 range_list_[i].type_size = sizeof(char);
14954 range_list_[i].str_node = sbn;
14955
14956 range_interface_t* ri = reinterpret_cast<range_interface_t*>(0);
14957
14958 if (0 == (ri = dynamic_cast<range_interface_t*>(arg_list_[i])))
14959 return false;
14960
14961 const range_t& rp = ri->range_ref();
14962
14963 if (
14964 rp.const_range() &&
14966 )
14967 {
14968 ts.size = rp.const_size();
14969 ts.data = static_cast<char_ptr>(ts.data) + rp.n0_c.second;
14970 range_list_[i].range = reinterpret_cast<range_t*>(0);
14971 }
14972 else
14973 {
14974 range_list_[i].range = &(ri->range_ref());
14975 range_param_list_.push_back(i);
14976 }
14977 }
14978 #endif
14979 else if (is_variable_node(arg_list_[i]))
14980 {
14982
14983 if (0 == (var = dynamic_cast<variable_node_ptr_t>(arg_list_[i])))
14984 return false;
14985
14986 ts.size = 1;
14987 ts.data = &var->ref();
14989 }
14990 else
14991 {
14992 ts.size = 1;
14993 ts.data = reinterpret_cast<void*>(&expr_as_vec1_store_[i]);
14995 }
14996
14997 branch_[i] = std::make_pair(arg_list_[i],branch_deletable(arg_list_[i]));
14998 }
14999
15000 return true;
15001 }
range_interface< T > range_interface_t
Definition exprtk.hpp:14864
std::pair< expression_ptr, bool > branch_t
Definition exprtk.hpp:14868
range_data_type< T > range_data_type_t
Definition exprtk.hpp:14865
range_interface< T >::range_t range_t
Definition exprtk.hpp:14866
std::vector< std::size_t > range_param_list_
Definition exprtk.hpp:15089
expression_node< T > * expression_ptr
Definition exprtk.hpp:14859
bool is_ivector_node(const expression_node< T > *node)
Definition exprtk.hpp:5756
bool branch_deletable(const expression_node< T > *node)
Definition exprtk.hpp:5852
bool is_const_string_range_node(const expression_node< T > *node)
Definition exprtk.hpp:18937
bool is_variable_node(const expression_node< T > *node)
Definition exprtk.hpp:5679
bool is_generally_string_node(const expression_node< T > *node)
Definition exprtk.hpp:18985
char_t * char_ptr
Definition exprtk.hpp:95
std::size_t const_size() const
Definition exprtk.hpp:8400

References 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 14900 of file exprtk.hpp.

14901 {
14903 }
std::size_t compute_node_depth(const expression_node< T > *const &node) const
Definition exprtk.hpp:6044

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 15003 of file exprtk.hpp.

15004 {
15005 return this < (&fn);
15006 }

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 15032 of file exprtk.hpp.

15033 {
15034 for (std::size_t i = 0; i < branch_.size(); ++i)
15035 {
15036 expr_as_vec1_store_[i] = branch_[i].first->value();
15037 }
15038
15039 if (!range_param_list_.empty())
15040 {
15041 assert(range_param_list_.size() <= branch_.size());
15042
15043 for (std::size_t i = 0; i < range_param_list_.size(); ++i)
15044 {
15045 const std::size_t index = range_param_list_[i];
15047
15048 const range_t& rp = (*rdt.range);
15049 std::size_t r0 = 0;
15050 std::size_t r1 = 0;
15051
15052 const std::size_t data_size =
15053 #ifndef exprtk_disable_string_capabilities
15054 rdt.str_node ? rdt.str_node->size() : rdt.size;
15055 #else
15056 rdt.size;
15057 #endif
15058
15059 if (!rp(r0, r1, data_size))
15060 {
15061 return false;
15062 }
15063
15065
15066 ts.size = rp.cache_size();
15067 #ifndef exprtk_disable_string_capabilities
15068 if (ts.type == type_store_t::e_string)
15069 ts.data = const_cast<char_ptr>(rdt.str_node->base()) + rp.cache.first;
15070 else
15071 #endif
15072 ts.data = static_cast<char_ptr>(rdt.data) + (rp.cache.first * rdt.type_size);
15073 }
15074 }
15075
15076 return true;
15077 }
std::size_t cache_size() const
Definition exprtk.hpp:8405

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 15025 of file exprtk.hpp.

15026 {
15027 return function_;
15028 }

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 15008 of file exprtk.hpp.

15009 {
15010 if (populate_value_list())
15011 {
15012 typedef typename GenericFunction::parameter_list_t parameter_list_t;
15013
15014 return (*function_)(parameter_list_t(typestore_list_));
15015 }
15016
15017 return std::numeric_limits<T>::quiet_NaN();
15018 }
virtual bool populate_value_list() const
Definition exprtk.hpp:15032

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: