aboutsummaryrefslogtreecommitdiff
path: root/src/Utils/NodeTypes.cpp
blob: b11b079960f7d4a3dfc86dde0d5d31ab36029062 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <HyperNeat/Utils/NodeTypes.hpp>

namespace hyperneat
{
    String
    nodeToString(NodeType type)
    {
        switch (type) {
            case NodeType::SIGMOID:
                return "\"sigmoid\"";

            case NodeType::GAUSSIAN:
                return "\"gaussian\"";

            case NodeType::SINE:
                return "\"sine\"";

            case NodeType::ABSOLUTE:
                return "\"absolute\"";

            default:
                return "\"nullType\"";
        }
    }

    NodeType
    stringToNode(const String& str)
    {
        if (str == "\"sigmoid\"") {
            return NodeType::SIGMOID;
        } else if (str == "\"gaussian\"") {
            return NodeType::GAUSSIAN;
        } else if (str == "\"sine\"") {
            return NodeType::SINE;
        } else if (str == "\"absolute\"") {
            return NodeType::ABSOLUTE;
        } else {
            return NodeType::NULL_TYPE;
        }
    }
}