ECF 1.5
Cos.cpp
1#include "../ECF_base.h"
2#include "Cos.h"
3#include <cmath>
4
5namespace Tree {
6namespace Primitives {
7
8Cos::Cos(void)
9{
10 nArguments_ = 1;
11 name_ = "cos";
12 complementName_ = "sin";
13}
14
15
16Cos::~Cos(void)
17{ }
18
19
20void Cos::execute(void* result, Tree &tree)
21{
22 double& arg = *(double*)result;
23 getNextArgument(&arg, tree);
24 // radians as argument
25 arg = cos(arg);
26}
27
28}
29}
void execute(void *result, Tree &tree)
Execute the primitive.
Definition: Cos.cpp:20
void getNextArgument(void *result, Tree &tree)
Execute next child node's primitive (execute next subtree).
Definition: Primitive.cpp:71
Tree class - implements genotype as a tree.
Definition: Tree_c.h:29