diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2014-11-21 20:55:18 +0100 |
---|---|---|
committer | Andreas Stöckel <andreas@somweyr.de> | 2014-11-21 20:55:18 +0100 |
commit | 37fadceb4b2e060844bd1c68f22eb71ce362249d (patch) | |
tree | 22226d2ffa543403313bb1113a4b1347ff39425d /src/core/Node.hpp | |
parent | e21f7f1a6d6cc0ac56ef3a5585f66269275a9133 (diff) |
renamed add and deleteManaged functions, improved NodeVector and NodeMap classes
Diffstat (limited to 'src/core/Node.hpp')
-rw-r--r-- | src/core/Node.hpp | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/src/core/Node.hpp b/src/core/Node.hpp index f32beb7..b7d050d 100644 --- a/src/core/Node.hpp +++ b/src/core/Node.hpp @@ -25,7 +25,8 @@ #include <vector> #include <unordered_set> -#include <core/Managed.hpp> +#include "Managed.hpp" +#include "ManagedContainers.hpp" namespace ousia { @@ -226,12 +227,12 @@ public: * filter tests whether the given node meets the requirements for inclusion * in the result list. * - * @param node is the node which should be tested. + * @param managed is the managed which should be tested. * @param data is user-defined data passed to the filter. * @return true if the node should be included in the result set, false * otherwise. */ - using Filter = bool (*)(Handle<Node> node, void *data); + using Filter = bool (*)(Handle<Managed> managed, void *data); /** * Hash functional used to convert pairs of nodes and int to hashes which @@ -510,6 +511,35 @@ public: */ bool triggerEvent(Event &event, bool fromChild = false); }; + +template <class T, class Collection> +class NodeGenericList : public ManagedGenericList<T, Collection> { +protected: + // TODO: Override addElement, deleteElement once this is necessary +public: + using ManagedGenericList<T, Collection>::ManagedGenericList; +}; + +template <class K, class T, class Collection> +class NodeGenericMap : public ManagedGenericMap<K, T, Collection> { +protected: + // TODO: Override addElement, deleteElement once this is necessary +public: + using ManagedGenericMap<K, T, std::vector<Owned<T>>>::ManagedGenericMap; +}; + +template <class T> +class NodeVector : public NodeGenericList<T, std::vector<Owned<T>>> { +public: + using NodeGenericList<T, std::vector<Owned<T>>>::NodeGenericList; +}; + +template <class K, class T> +class NodeMap : public NodeGenericMap<K, T, std::map<K, Owned<T>>> { +public: + using NodeGenericMap<K, T, std::map<K, Owned<T>>>::NodeGenericMap; +}; + } #endif /* _OUSIA_NODE_HPP_ */ |