ECF 1.5
Public Member Functions | List of all members
cartesian::Sin< Container, Result > Class Template Reference
Inheritance diagram for cartesian::Sin< 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::Sin< Container, Result >

Definition at line 6 of file Sin.h.

Constructor & Destructor Documentation

◆ Sin()

template<typename Container , typename Result >
cartesian::Sin< Container, Result >::Sin ( void  )

Definition at line 14 of file Sin.h.

◆ ~Sin()

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

Definition at line 9 of file Sin.h.

Member Function Documentation

◆ evaluate()

template<typename Container , typename Result >
void cartesian::Sin< 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 21 of file Sin.h.


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