ECF 1.5
Mul.h
1#ifndef Mul_h
2#define Mul_h
3#include "Primitive.h"
4
5namespace Tree {
6namespace Primitives {
7
12template <class T>
13class MulT : public Primitive
14{
15public:
16 MulT(void);
17 void execute(void* result, Tree& tree);
18 ~MulT(void);
19};
20typedef MulT<double> Mul;
21
22
23template <class T>
24MulT<T>::MulT(void)
25{
26 nArguments_ = 2;
27 name_ = "*";
28 complementName_ = "/";
29}
30
31
32template <class T>
33MulT<T>::~MulT(void)
34{ }
35
36
37template <class T>
38void MulT<T>::execute(void* result, Tree &tree)
39{
40 T first, second;
41 T& mul = *(T*)result;
42 getNextArgument(&first, tree);
43 getNextArgument(&second, tree);
44 mul = first * second;
45}
46
47}
48}
49
50#endif
Mul function primitive (Tree genotype)
Definition: Mul.h:14
void execute(void *result, Tree &tree)
Execute the primitive.
Definition: Mul.h:38
Base primitive class (Tree genotype).
Definition: Primitive.h:37
Tree class - implements genotype as a tree.
Definition: Tree_c.h:29