From c7cb92f43f97ef5558eee0d7be6f18192134f3ec Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sun, 12 Apr 2015 02:50:18 +0200 Subject: Replace NodeVector by ManagedVector where NodeVector functionality is not needed. Reduces calls to "Manager.registerEvent" to <10% of original value --- src/core/model/Ontology.hpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/core/model/Ontology.hpp') diff --git a/src/core/model/Ontology.hpp b/src/core/model/Ontology.hpp index 3ef3b65..2533b9d 100644 --- a/src/core/model/Ontology.hpp +++ b/src/core/model/Ontology.hpp @@ -300,7 +300,7 @@ public: * the Structure Tree of instances of this field including subclasses of * children, which are allowed directly. */ - NodeVector getChildrenWithSubclasses() const; + ManagedVector getChildrenWithSubclasses() const; /** * Adds a StructuredClass whose instances shall be allowed as children in @@ -449,7 +449,7 @@ public: * @return a vector of all TREE fields that are allowed as structure tree * children of an instance of this Descriptor. */ - NodeVector getDefaultFields() const; + ManagedVector getDefaultFields() const; /** * Returns the name of this FieldDescriptor or the default field name @@ -643,9 +643,10 @@ public: * * @return the NodeVector of all FieldDescriptors of this Descriptor. */ - virtual NodeVector getFieldDescriptors() const + virtual ManagedVector getFieldDescriptors() const { - return fieldDescriptors; + return ManagedVector(const_cast(this), fieldDescriptors.begin(), + fieldDescriptors.end()); } /** @@ -856,7 +857,7 @@ public: * @return a vector of all TREE fields that are allowed as structure tree * children of an instance of this Descriptor. */ - NodeVector getDefaultFields() const; + ManagedVector getDefaultFields() const; /** * Returns a vector of all StructuredClasses that are allowed as children @@ -1035,7 +1036,7 @@ private: * Helper method for getFieldDescriptors. */ Rooted gatherFieldDescriptors( - NodeVector ¤t, + ManagedVector ¤t, std::unordered_set &visited, std::set &overriddenFields, bool hasTREE) const; @@ -1170,7 +1171,7 @@ public: * * @return a NodeVector of all FieldDescriptors of this StructuredClass. */ - NodeVector getFieldDescriptors() const override; + ManagedVector getFieldDescriptors() const override; bool isTransparent() const { return transparent; } @@ -1483,4 +1484,4 @@ extern const Rtti Ontology; } } -#endif /* _OUSIA_MODEL_ONTOLOGY_HPP_ */ \ No newline at end of file +#endif /* _OUSIA_MODEL_ONTOLOGY_HPP_ */ -- cgit v1.2.3