ECF 1.5
Public Member Functions | List of all members
cartesian::Div< Container, Result > Class Template Reference
Inheritance diagram for cartesian::Div< Container, Result >:
cartesian::Function< Container, Result >

Public Member Functions

void evaluate (Container &container, Result &result)
 
- Public Member Functions inherited from cartesian::Function< Container, Result >
 Function (uint numArgs)
 
virtual void evaluate (Container &container, Result &result)=0
 
std::string getName ()
 
uint getNumOfArgs ()
 

Additional Inherited Members

- Protected Attributes inherited from cartesian::Function< Container, Result >
std::string name_
 
uint numOfArgs_
 

Detailed Description

template<typename Container, typename Result>
class cartesian::Div< Container, Result >

Definition at line 7 of file Div.h.

Constructor & Destructor Documentation

◆ Div()

template<typename Container , typename Result >
cartesian::Div< Container, Result >::Div

Definition at line 15 of file Div.h.

◆ ~Div()

template<typename Container , typename Result >
cartesian::Div< Container, Result >::~Div ( )
inline

Definition at line 10 of file Div.h.

Member Function Documentation

◆ evaluate()

template<typename Container , typename Result >
void cartesian::Div< Container, Result >::evaluate ( Container &  container,
Result &  result 
)
virtual

Evaluate function could be done in a better way. What it does is it takes inputs to a function node as first argument and result as a second argument.

Problem arises because of the following: 1.) Passed input should support an operation which is performed(+, -, *, /, sqrt, max, min). This is not a problem for built-in types, but does create a problem for user-defined types or aggregate-types.

2.) Assuming that input is given as a collection or any stl container, strictly speaking all support needed for first argument is to be able to iterate over it.

For general usage, abstract function evaluate could be defined as: virtual void evaluate(voidP inputs, void* result) = 0;

However this would require that concrete functions (derived classes of Function) know in what to cast voidP and void*. This could be achieved using class templates. Still, user would have to know in what to cast inputs.

I opted for a solution of making base-class a template class, and arguments of evaluate function container and a result.

Solution I like the most (once C++ 2020 is supported by compilers) is to use concepts, and scrape inheritance completely.

Implements cartesian::Function< Container, Result >.

Definition at line 22 of file Div.h.


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