Skip to content
Snippets Groups Projects
Commit 1e346dd8 authored by Jaime Arias's avatar Jaime Arias
Browse files

move evaluation strategies into their own folder

parent 0531b76e
No related branches found
No related tags found
No related merge requests found
......@@ -3,15 +3,20 @@ cmake_minimum_required(VERSION 3.0.0)
# Attack-Defence Tree Library
set(GATES_FILES
${CMAKE_CURRENT_LIST_DIR}/gates/and.cpp
${CMAKE_CURRENT_LIST_DIR}/gates/nand.cpp
${CMAKE_CURRENT_LIST_DIR}/gates/nor.cpp
${CMAKE_CURRENT_LIST_DIR}/gates/or.cpp
${CMAKE_CURRENT_LIST_DIR}/gates/sor.cpp
${CMAKE_CURRENT_LIST_DIR}/gates/snor.cpp
${CMAKE_CURRENT_LIST_DIR}/gates/sand.cpp
${CMAKE_CURRENT_LIST_DIR}/gates/snand.cpp
)
${CMAKE_CURRENT_LIST_DIR}/gates/and.cpp
${CMAKE_CURRENT_LIST_DIR}/gates/nand.cpp
${CMAKE_CURRENT_LIST_DIR}/gates/nor.cpp
${CMAKE_CURRENT_LIST_DIR}/gates/or.cpp
${CMAKE_CURRENT_LIST_DIR}/gates/sor.cpp
${CMAKE_CURRENT_LIST_DIR}/gates/snor.cpp
${CMAKE_CURRENT_LIST_DIR}/gates/sand.cpp
${CMAKE_CURRENT_LIST_DIR}/gates/snand.cpp
)
add_library(adtree_lib ad_tree.cpp evaluation_strategy.cpp gate.cpp leaf.cpp node_type.cpp parallel_strategy.cpp sequential_strategy.cpp tree_node.cpp ${GATES_FILES})
set(STRATEGIES_FILES
${CMAKE_CURRENT_LIST_DIR}/strategies/sequential_strategy.cpp
${CMAKE_CURRENT_LIST_DIR}/strategies/parallel_strategy.cpp
)
add_library(adtree_lib ad_tree.cpp evaluation_strategy.cpp gate.cpp leaf.cpp node_type.cpp tree_node.cpp ${GATES_FILES} ${STRATEGIES_FILES})
target_include_directories(adtree_lib PUBLIC ${CMAKE_CURRENT_LIST_DIR})
#include "evaluation_strategy.hpp"
Evaluation_strategy::Evaluation_strategy() { }
Evaluation_strategy::~Evaluation_strategy() { }
\ No newline at end of file
Evaluation_strategy::Evaluation_strategy() {}
Evaluation_strategy::~Evaluation_strategy() {}
......@@ -3,12 +3,11 @@
#include "gate.hpp"
class Evaluation_strategy{
public:
Evaluation_strategy();
~Evaluation_strategy();
virtual void eval_strategy() = 0;
class Evaluation_strategy {
public:
Evaluation_strategy();
~Evaluation_strategy();
virtual void eval_strategy() = 0;
};
#endif
\ No newline at end of file
#endif
#include "gate.hpp"
Gate::Gate(NodeType node_type, string goal) : TreeNode(node_type, goal){ }
Gate::~Gate() { }
\ No newline at end of file
Gate::Gate(NodeType node_type, string goal) : TreeNode(node_type, goal) {}
Gate::~Gate() {}
......@@ -3,12 +3,11 @@
#include "tree_node.hpp"
class Gate : public TreeNode{
public:
Gate(NodeType node_type = static_cast<NodeType>(0),
string goal = "");
~Gate();
class Gate : public TreeNode {
public:
// TODO: add strategy of evaluation (parallel, sequential, etc)
Gate(NodeType node_type = NodeType::Attack, string goal = "");
~Gate();
};
#endif
\ No newline at end of file
#endif
#include "parallel_strategy.hpp"
Parallel_strategy::Parallel_strategy() { }
Parallel_strategy::~Parallel_strategy() { }
void Parallel_strategy::eval_strategy(Gate* gate){
for (auto& i : gate->get_children()){
}
}
\ No newline at end of file
#ifndef PARALLEL_STRATEGY_HPP
#define PARALLEL_STRATEGY_HPP
#include "evaluation_strategy.hpp"
class Parallel_strategy: public Evaluation_strategy{
public:
Parallel_strategy();
~Parallel_strategy();
void eval_strategy(Gate* gate);
};
#endif
\ No newline at end of file
#include "sequential_strategy.hpp"
Sequential_strategy::Sequential_strategy() { }
Sequential_strategy::~Sequential_strategy() { }
void Sequential_strategy::eval_strategy(Gate* gate){
for (auto& i : gate->get_children()){
}
}
\ No newline at end of file
#ifndef SEQUENTIAL_STRATEGY_HPP
#define SEQUENTIAL_STRATEGY_HPP
#include "evaluation_strategy.hpp"
class Sequential_strategy: public Evaluation_strategy{
public:
Sequential_strategy();
~Sequential_strategy();
void eval_strategy(Gate* gate);
};
#endif
\ No newline at end of file
......@@ -5,6 +5,6 @@ cmake_minimum_required(VERSION 3.0.0)
project(adtree_tests CXX)
# Add the test files for the ADTree implementation
set(TEST_FILES_ADT node_type.cpp tree_node.cpp leaf.cpp)
set(TEST_FILES_ADT node_type.cpp tree_node.cpp leaf.cpp gate.cpp)
add_test_suite("ADTree" adtree_lib "${TEST_FILES_ADT}")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment