summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-02 23:36:02 +0100
committerAndreas Stöckel <andreas@somweyr.de>2015-01-02 23:36:02 +0100
commitfffca72cfd8fdf1350dbe4bf8a5408f6088bf5b4 (patch)
tree2551dcb8e09111d6ddbeae4022ff155e68649bd4 /src/core
parent45f891fe0368efead661240fef872d006db34d05 (diff)
Using Index per default in NodeVector and NodeMap, added Unit test
Diffstat (limited to 'src/core')
-rw-r--r--src/core/model/Node.cpp7
-rw-r--r--src/core/model/Node.hpp11
2 files changed, 12 insertions, 6 deletions
diff --git a/src/core/model/Node.cpp b/src/core/model/Node.cpp
index fa6a3a2..e149596 100644
--- a/src/core/model/Node.cpp
+++ b/src/core/model/Node.cpp
@@ -16,6 +16,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <core/common/Exceptions.hpp>
+
#include "Node.hpp"
namespace ousia {
@@ -90,8 +92,8 @@ int Node::resolve(std::vector<Rooted<Managed>> &res,
}
std::vector<Rooted<Managed>> Node::resolve(const std::vector<std::string> &path,
- Filter filter = nullptr,
- void *filterData = nullptr)
+ Filter filter = nullptr,
+ void *filterData = nullptr)
{
std::vector<Rooted<Managed>> res;
VisitorSet visited;
@@ -102,5 +104,4 @@ std::vector<Rooted<Managed>> Node::resolve(const std::vector<std::string> &path,
/* RTTI type registrations */
const Rtti<Node> RttiTypes::Node{"Node"};
-
}
diff --git a/src/core/model/Node.hpp b/src/core/model/Node.hpp
index cca33f7..a637b56 100644
--- a/src/core/model/Node.hpp
+++ b/src/core/model/Node.hpp
@@ -29,6 +29,8 @@
#include <core/managed/Managed.hpp>
#include <core/managed/ManagedContainer.hpp>
+#include "Index.hpp"
+
namespace ousia {
/**
@@ -292,7 +294,7 @@ public:
// TODO: Use a different listener here for updating name maps
-template <class T, class Listener = DefaultListener<Handle<T>>>
+template <class T, class Listener = Index>
class NodeVector
: public ManagedGenericList<T, std::vector<Handle<T>>,
ListAccessor<Handle<T>>, Listener> {
@@ -300,10 +302,11 @@ public:
using Base = ManagedGenericList<T, std::vector<Handle<T>>,
ListAccessor<Handle<T>>, Listener>;
using Base::ManagedGenericList;
+
+ Index& getIndex() { return this->listener;}
};
-template <class K, class T,
- class Listener = DefaultListener<std::pair<K, Handle<T>>>>
+template <class K, class T, class Listener = Index>
class NodeMap
: public ManagedGenericMap<K, T, std::map<K, Handle<T>>,
MapAccessor<std::pair<K, Handle<T>>>, Listener> {
@@ -312,6 +315,8 @@ public:
ManagedGenericMap<K, T, std::map<K, Handle<T>>,
MapAccessor<std::pair<K, Handle<T>>>, Listener>;
using Base::ManagedGenericMap;
+
+ Index& getIndex() { return this->listener;}
};
namespace RttiTypes {