ECF 1.5
CartesianGene.h
1#ifndef ECF_CARTESIAN_CARTESIANGENE_H
2#define ECF_CARTESIAN_CARTESIANGENE_H
3#include <vector>
4#include <iostream>
5namespace cartesian{
6 typedef unsigned int uint;
9 CartesianGene(uint value_, const std::vector<uint>& inputConnections_, bool isOutput_ = false) :
10 value(value_), inputConnections(inputConnections_), isOutput(isOutput_) {};
11 //value is ID of a function if CartesianGene is not an output node
12 //If it is, value is index of a node (inside Cartesian) whose output
13 //is forwarded to value.
14 //Suggestion: Replace with union;
15 uint value;
16 std::vector<uint> inputConnections;
17 bool isOutput;
18 friend std::ostream& operator<<(std::ostream& out, const CartesianGene& cg) {
19 out << cg.value << ' ';
20 if(!cg.isOutput) {
21 for(uint i = 0; i < cg.inputConnections.size(); i++) {
22 out << cg.inputConnections[i] << ' ';
23 }
24 }
25 return out;
26 }
27 };
28}
29#endif //ECF_CARTESIAN_CARTESIANGENE_H