diff options
| author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-04-12 02:50:18 +0200 | 
|---|---|---|
| committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2016-04-25 22:24:15 +0200 | 
| commit | c7cb92f43f97ef5558eee0d7be6f18192134f3ec (patch) | |
| tree | 6475300d3f1ad862a7d4e4514084770e33ce2775 | |
| parent | c917381e5eb5700326d2389ffe0874565fc970ac (diff) | |
Replace NodeVector by ManagedVector where NodeVector functionality is not needed. Reduces calls to "Manager.registerEvent" to <10% of original value
| -rw-r--r-- | src/core/model/Document.cpp | 9 | ||||
| -rw-r--r-- | src/core/model/Ontology.cpp | 48 | ||||
| -rw-r--r-- | src/core/model/Ontology.hpp | 17 | ||||
| -rw-r--r-- | src/core/parser/ParserContext.cpp | 2 | ||||
| -rw-r--r-- | src/core/parser/ParserContext.hpp | 2 | ||||
| -rw-r--r-- | src/core/parser/ParserScope.cpp | 14 | ||||
| -rw-r--r-- | src/core/parser/ParserScope.hpp | 19 | ||||
| -rw-r--r-- | src/core/parser/stack/DocumentHandler.cpp | 8 | ||||
| -rw-r--r-- | src/core/resource/ResourceManager.cpp | 12 | ||||
| -rw-r--r-- | src/core/resource/ResourceManager.hpp | 4 | ||||
| -rw-r--r-- | src/plugins/xml/XmlOutput.cpp | 4 | ||||
| -rw-r--r-- | test/core/model/OntologyTest.cpp | 18 | 
12 files changed, 82 insertions, 75 deletions
| diff --git a/src/core/model/Document.cpp b/src/core/model/Document.cpp index 894330b..411a755 100644 --- a/src/core/model/Document.cpp +++ b/src/core/model/Document.cpp @@ -93,7 +93,8 @@ bool DocumentEntity::doValidate(Logger &logger) const  	 * gather all fields of superclasses as well, that have not been  	 * overridden in the subclasses.  	 */ -	NodeVector<FieldDescriptor> fieldDescs = descriptor->getFieldDescriptors(); +	ManagedVector<FieldDescriptor> fieldDescs = +	    descriptor->getFieldDescriptors();  	// iterate over every field  	for (unsigned int f = 0; f < fields.size(); f++) {  		// we have a special check for primitive fields. @@ -137,9 +138,9 @@ bool DocumentEntity::doValidate(Logger &logger) const  		std::unordered_set<StructuredClass *> childClasses;  		{ -			NodeVector<StructuredClass> tmp = +			ManagedVector<StructuredClass> tmp =  			    fieldDescs[f]->getChildrenWithSubclasses(); -			for (auto s : tmp) { +			for (const auto &s : tmp) {  				childClasses.insert(s.get());  			}  		} @@ -999,4 +1000,4 @@ const Rtti AnnotationEntity =          .parent(&Node)          .composedOf({&StructuredEntity, &DocumentPrimitive, &Anchor});  } -}
\ No newline at end of file +} diff --git a/src/core/model/Ontology.cpp b/src/core/model/Ontology.cpp index d63c5e7..89710d3 100644 --- a/src/core/model/Ontology.cpp +++ b/src/core/model/Ontology.cpp @@ -67,7 +67,7 @@ static NodeVector<Node> pathTo(const Node *start, Logger &logger,  	if (start->isa(&RttiTypes::Descriptor)) {  		const Descriptor *desc = static_cast<const Descriptor *>(start);  		// initially put every field descriptor on the queue. -		NodeVector<FieldDescriptor> fields = desc->getFieldDescriptors(); +		ManagedVector<FieldDescriptor> fields = desc->getFieldDescriptors();  		for (auto fd : fields) {  			if (fd == target) { @@ -115,7 +115,7 @@ static NodeVector<Node> pathTo(const Node *start, Logger &logger,  			    static_cast<const StructuredClass *>(current->node);  			// look through all fields. -			NodeVector<FieldDescriptor> fields = strct->getFieldDescriptors(); +			ManagedVector<FieldDescriptor> fields = strct->getFieldDescriptors();  			for (auto fd : fields) {  				// if we found our target, break off the search in this branch.  				if (fd == target) { @@ -182,9 +182,9 @@ struct CollectState {   * TODO: @Benjmin Documentation!   */  template <typename F> -static NodeVector<Node> collect(const Node *start, F match) +static ManagedVector<Node> collect(const Node *start, F match)  { -	NodeVector<Node> res; +	ManagedVector<Node> res;  	// Queue and set for breadth-first search of the document graph  	std::queue<CollectState> q; @@ -205,7 +205,7 @@ static NodeVector<Node> collect(const Node *start, F match)  			Rooted<Descriptor> strct{static_cast<Descriptor *>(state.n)};  			// look through all fields. -			NodeVector<FieldDescriptor> fields = strct->getFieldDescriptors(); +			ManagedVector<FieldDescriptor> fields = strct->getFieldDescriptors();  			for (auto fd : fields) {  				// Store all matching items  				if (match(fd, state.depth)) { @@ -403,7 +403,7 @@ bool FieldDescriptor::doValidate(Logger &logger) const  static void gatherSubclasses(      std::unordered_set<const StructuredClass *> &visited, -    NodeVector<StructuredClass> &res, Handle<StructuredClass> strct) +    ManagedVector<StructuredClass> &res, Handle<StructuredClass> strct)  {  	// this check is to prevent cycles.  	if (!visited.insert(strct.get()).second) { @@ -419,10 +419,11 @@ static void gatherSubclasses(  	}  } -NodeVector<StructuredClass> FieldDescriptor::getChildrenWithSubclasses() const +ManagedVector<StructuredClass> FieldDescriptor::getChildrenWithSubclasses() +    const  {  	std::unordered_set<const StructuredClass *> visited; -	NodeVector<StructuredClass> res; +	ManagedVector<StructuredClass> res;  	for (auto c : children) {  		res.push_back(c);  		gatherSubclasses(visited, res, c); @@ -455,10 +456,11 @@ NodeVector<Node> FieldDescriptor::pathTo(Handle<FieldDescriptor> field,  	bool success = false;  	return ousia::pathTo(this, logger, field, success);  } -NodeVector<FieldDescriptor> FieldDescriptor::getDefaultFields() const + +ManagedVector<FieldDescriptor> FieldDescriptor::getDefaultFields() const  {  	// TODO: In principle a cast would be nicer here, but for now we copy. -	NodeVector<Node> nodes = collect(this, [](Handle<Node> n, size_t depth) { +	ManagedVector<Node> nodes = collect(this, [](Handle<Node> n, size_t depth) {  		if (!n->isa(&RttiTypes::FieldDescriptor)) {  			return false;  		} @@ -466,7 +468,7 @@ NodeVector<FieldDescriptor> FieldDescriptor::getDefaultFields() const  		return f->getFieldType() == FieldDescriptor::FieldType::TREE &&  		       f->isPrimitive();  	}); -	NodeVector<FieldDescriptor> res; +	ManagedVector<FieldDescriptor> res;  	for (auto n : nodes) {  		res.push_back(n.cast<FieldDescriptor>());  	} @@ -584,10 +586,10 @@ std::pair<NodeVector<Node>, bool> Descriptor::pathTo(  	return std::make_pair(path, success);  } -NodeVector<FieldDescriptor> Descriptor::getDefaultFields() const +ManagedVector<FieldDescriptor> Descriptor::getDefaultFields() const  {  	// TODO: In principle a cast would be nicer here, but for now we copy. -	NodeVector<Node> nodes = collect(this, [](Handle<Node> n, size_t depth) { +	ManagedVector<Node> nodes = collect(this, [](Handle<Node> n, size_t depth) {  		if (!n->isa(&RttiTypes::FieldDescriptor)) {  			return false;  		} @@ -595,7 +597,7 @@ NodeVector<FieldDescriptor> Descriptor::getDefaultFields() const  		return f->getFieldType() == FieldDescriptor::FieldType::TREE &&  		       f->isPrimitive();  	}); -	NodeVector<FieldDescriptor> res; +	ManagedVector<FieldDescriptor> res;  	for (auto n : nodes) {  		res.push_back(n.cast<FieldDescriptor>());  	} @@ -605,7 +607,7 @@ NodeVector<FieldDescriptor> Descriptor::getDefaultFields() const  NodeVector<StructuredClass> Descriptor::getPermittedChildren() const  {  	// TODO: In principle a cast would be nicer here, but for now we copy. -	NodeVector<Node> nodes = collect(this, [](Handle<Node> n, size_t depth) { +	ManagedVector<Node> nodes = collect(this, [](Handle<Node> n, size_t depth) {  		return n->isa(&RttiTypes::StructuredClass);  	});  	NodeVector<StructuredClass> res; @@ -615,7 +617,7 @@ NodeVector<StructuredClass> Descriptor::getPermittedChildren() const  	return res;  } -static ssize_t getFieldDescriptorIndex(const NodeVector<FieldDescriptor> &fds, +static ssize_t getFieldDescriptorIndex(const ManagedVector<FieldDescriptor> &fds,                                         const std::string &name)  {  	if (fds.empty()) { @@ -644,7 +646,7 @@ static ssize_t getFieldDescriptorIndex(const NodeVector<FieldDescriptor> &fds,  ssize_t Descriptor::getFieldDescriptorIndex(const std::string &name) const  { -	NodeVector<FieldDescriptor> fds = getFieldDescriptors(); +	ManagedVector<FieldDescriptor> fds = getFieldDescriptors();  	return ousia::getFieldDescriptorIndex(fds, name);  } @@ -663,7 +665,7 @@ ssize_t Descriptor::getFieldDescriptorIndex(Handle<FieldDescriptor> fd) const  Rooted<FieldDescriptor> Descriptor::getFieldDescriptor(      const std::string &name) const  { -	NodeVector<FieldDescriptor> fds = getFieldDescriptors(); +	ManagedVector<FieldDescriptor> fds = getFieldDescriptors();  	ssize_t idx = ousia::getFieldDescriptorIndex(fds, name);  	if (idx != -1) {  		return fds[idx]; @@ -673,7 +675,7 @@ Rooted<FieldDescriptor> Descriptor::getFieldDescriptor(  Rooted<FieldDescriptor> Descriptor::getFieldDescriptor(size_t idx) const  { -	NodeVector<FieldDescriptor> fds = getFieldDescriptors(); +	ManagedVector<FieldDescriptor> fds = getFieldDescriptors();  	if (idx < fds.size()) {  		return fds[idx];  	} @@ -925,7 +927,7 @@ void StructuredClass::removeSubclass(Handle<StructuredClass> sc, Logger &logger)  }  Rooted<FieldDescriptor> StructuredClass::gatherFieldDescriptors( -    NodeVector<FieldDescriptor> ¤t, +    ManagedVector<FieldDescriptor> ¤t,      std::unordered_set<const StructuredClass *> &visited,      std::set<std::string> &overriddenFields, bool hasTREE) const  { @@ -934,7 +936,7 @@ Rooted<FieldDescriptor> StructuredClass::gatherFieldDescriptors(  		return nullptr;  	}  	Rooted<FieldDescriptor> mainField; -	NodeVector<FieldDescriptor> tmp; +	ManagedVector<FieldDescriptor> tmp;  	// first gather the non-overridden fields.  	for (auto f : Descriptor::getFieldDescriptors()) {  		if (overriddenFields.insert(f->getName()).second) { @@ -965,10 +967,10 @@ Rooted<FieldDescriptor> StructuredClass::gatherFieldDescriptors(  	return mainField;  } -NodeVector<FieldDescriptor> StructuredClass::getFieldDescriptors() const +ManagedVector<FieldDescriptor> StructuredClass::getFieldDescriptors() const  {  	// in this case we return a NodeVector of Rooted entries without owner. -	NodeVector<FieldDescriptor> vec; +	ManagedVector<FieldDescriptor> vec;  	std::unordered_set<const StructuredClass *> visited;  	std::set<std::string> overriddenFields;  	Rooted<FieldDescriptor> mainField = 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<StructuredClass> getChildrenWithSubclasses() const; +	ManagedVector<StructuredClass> 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<FieldDescriptor> getDefaultFields() const; +	ManagedVector<FieldDescriptor> 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<FieldDescriptor> getFieldDescriptors() const +	virtual ManagedVector<FieldDescriptor> getFieldDescriptors() const  	{ -		return fieldDescriptors; +		return ManagedVector<FieldDescriptor>(const_cast<Descriptor*>(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<FieldDescriptor> getDefaultFields() const; +	ManagedVector<FieldDescriptor> getDefaultFields() const;  	/**  	 * Returns a vector of all StructuredClasses that are allowed as children @@ -1035,7 +1036,7 @@ private:  	 * Helper method for getFieldDescriptors.  	 */  	Rooted<FieldDescriptor> gatherFieldDescriptors( -	    NodeVector<FieldDescriptor> ¤t, +	    ManagedVector<FieldDescriptor> ¤t,  	    std::unordered_set<const StructuredClass *> &visited,  	    std::set<std::string> &overriddenFields, bool hasTREE) const; @@ -1170,7 +1171,7 @@ public:  	 *  	 * @return a NodeVector of all FieldDescriptors of this StructuredClass.  	 */ -	NodeVector<FieldDescriptor> getFieldDescriptors() const override; +	ManagedVector<FieldDescriptor> 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_ */ diff --git a/src/core/parser/ParserContext.cpp b/src/core/parser/ParserContext.cpp index 14b02df..7177126 100644 --- a/src/core/parser/ParserContext.cpp +++ b/src/core/parser/ParserContext.cpp @@ -47,7 +47,7 @@ Rooted<Node> ParserContext::import(const std::string &path,  	return resourceManager.import(*this, path, mimetype, rel, supportedTypes);  } -NodeVector<Node> ParserContext::include(const std::string &path, +ManagedVector<Node> ParserContext::include(const std::string &path,                                      const std::string mimetype,                                      const std::string rel,                                      const RttiSet &supportedTypes) diff --git a/src/core/parser/ParserContext.hpp b/src/core/parser/ParserContext.hpp index 1b889b1..369ce3c 100644 --- a/src/core/parser/ParserContext.hpp +++ b/src/core/parser/ParserContext.hpp @@ -139,7 +139,7 @@ public:  	 * @return the parsed nodes or an empty list if something goes wrong (or  	 * there were indeed no objects to be parsed).  	 */ -	NodeVector<Node> include(const std::string &path, +	ManagedVector<Node> include(const std::string &path,  	                         const std::string mimetype, const std::string rel,  	                         const RttiSet &supportedTypes); diff --git a/src/core/parser/ParserScope.cpp b/src/core/parser/ParserScope.cpp index 4b0f376..0be8a22 100644 --- a/src/core/parser/ParserScope.cpp +++ b/src/core/parser/ParserScope.cpp @@ -36,7 +36,8 @@ namespace ousia {  ParserScopeBase::ParserScopeBase() {} -ParserScopeBase::ParserScopeBase(const NodeVector<Node> &nodes) : nodes(nodes) +ParserScopeBase::ParserScopeBase(const ManagedVector<Node> &nodes) +    : nodes(nodes)  {  } @@ -74,7 +75,7 @@ Rooted<Node> ParserScopeBase::getRoot() const { return nodes.front(); }  Rooted<Node> ParserScopeBase::getLeaf() const { return nodes.back(); } -const NodeVector<Node> &ParserScopeBase::getStack() const { return nodes; } +const ManagedVector<Node> &ParserScopeBase::getStack() const { return nodes; }  std::vector<Rtti const *> ParserScopeBase::getStackTypeSignature() const  { @@ -118,7 +119,7 @@ Rooted<Node> ParserScopeBase::selectOrThrow(RttiSet types, int maxDepth)  /* Class DeferredResolution */ -DeferredResolution::DeferredResolution(const NodeVector<Node> &nodes, +DeferredResolution::DeferredResolution(const ManagedVector<Node> &nodes,                                         const std::vector<std::string> &path,                                         const Rtti *type,                                         ResolutionResultCallback resultCallback, @@ -169,7 +170,7 @@ void DeferredResolution::fail(Logger &logger)  /* Class ParserScope */ -ParserScope::ParserScope(const NodeVector<Node> &nodes, +ParserScope::ParserScope(const ManagedVector<Node> &nodes,                           const std::vector<ParserFlagDescriptor> &flags)      : ParserScopeBase(nodes), flags(flags), topLevelDepth(nodes.size())  { @@ -261,7 +262,10 @@ void ParserScope::pop(Logger &logger)  #endif  } -NodeVector<Node> ParserScope::getTopLevelNodes() const { return topLevelNodes; } +ManagedVector<Node> ParserScope::getTopLevelNodes() const +{ +	return topLevelNodes; +}  void ParserScope::setFlag(ParserFlag flag, bool value)  { diff --git a/src/core/parser/ParserScope.hpp b/src/core/parser/ParserScope.hpp index 0a1e90b..85b5d8b 100644 --- a/src/core/parser/ParserScope.hpp +++ b/src/core/parser/ParserScope.hpp @@ -74,7 +74,7 @@ protected:  	 * List containing all nodes currently on the scope, with the newest nodes  	 * being pushed to the back of the list.  	 */ -	NodeVector<Node> nodes; +	ManagedVector<Node> nodes;  public:  	/** @@ -84,13 +84,12 @@ public:  	/**  	 * Creates a new instance of the ParserScopeBase class, copying the the -	 *given -	 * nodes as initial start value of the node stack. This could for example -	 * be initialized with the path of a node. +	 * given nodes as initial start value of the node stack. This could for +	 * example be initialized with the path of a node.  	 *  	 * @param nodes is a node vector containing the current node stack.  	 */ -	ParserScopeBase(const NodeVector<Node> &nodes); +	ParserScopeBase(const ManagedVector<Node> &nodes);  	/**  	 * Tries to resolve a node for the given type and path for all nodes that @@ -118,7 +117,7 @@ public:  	 *  	 * @return a const reference at the internal node stack.  	 */ -	const NodeVector<Node> &getStack() const; +	const ManagedVector<Node> &getStack() const;  	/**  	 * Returns a list containing the Rtti type of each Node that is currently @@ -247,7 +246,7 @@ public:  	 * the desired element has indeed been found.  	 * @param owner is the node for which the resolution takes place.  	 */ -	DeferredResolution(const NodeVector<Node> &nodes, +	DeferredResolution(const ManagedVector<Node> &nodes,  	                   const std::vector<std::string> &path, const Rtti *type,  	                   ResolutionResultCallback resultCallback,  	                   Handle<Node> owner); @@ -376,12 +375,12 @@ private:  	 * List of a all nodes that have been pushed onto the scope at the top level  	 * depth.  	 */ -	NodeVector<Node> topLevelNodes; +	ManagedVector<Node> topLevelNodes;  	/**  	 * Private constructor used to create a ParserScope fork.  	 */ -	ParserScope(const NodeVector<Node> &nodes, +	ParserScope(const ManagedVector<Node> &nodes,  	            const std::vector<ParserFlagDescriptor> &flags);  public: @@ -450,7 +449,7 @@ public:  	 *  	 * @return a node vector containing the top-level nodes.  	 */ -	NodeVector<Node> getTopLevelNodes() const; +	ManagedVector<Node> getTopLevelNodes() const;  	/**  	 * Sets a parser flag for the current stack depth. diff --git a/src/core/parser/stack/DocumentHandler.cpp b/src/core/parser/stack/DocumentHandler.cpp index ce5d8a2..e6af615 100644 --- a/src/core/parser/stack/DocumentHandler.cpp +++ b/src/core/parser/stack/DocumentHandler.cpp @@ -144,7 +144,7 @@ void DocumentChildHandler::pushScopeTokens()  	// Fetch the current scope stack and search the first non-transparent field  	// or structure -	const NodeVector<Node> &stack = scope().getStack(); +	const ManagedVector<Node> &stack = scope().getStack();  	for (auto sit = stack.crbegin(); sit != stack.crend(); sit++) {  		Rooted<Node> nd = *sit; @@ -586,7 +586,7 @@ bool DocumentChildHandler::startToken(Handle<Node> node)  EndTokenResult DocumentChildHandler::endToken(Handle<Node> node, size_t maxStackDepth)  {  	// Fetch the current scope stack -	const NodeVector<Node> &stack = scope().getStack(); +	const ManagedVector<Node> &stack = scope().getStack();  	bool found = false;            // true once the given node has been found  	bool repeat = false; @@ -686,7 +686,7 @@ bool DocumentChildHandler::fieldStart(bool &isDefault, size_t fieldIdx)  	preamble(parentNode, dummy, parent); -	NodeVector<FieldDescriptor> fields = +	ManagedVector<FieldDescriptor> fields =  	    parent->getDescriptor()->getFieldDescriptors();  	if (isDefault) { @@ -780,7 +780,7 @@ bool DocumentChildHandler::data()  	// Search through all permitted default fields of the parent class that  	// allow primitive content at this point and could be constructed via  	// transparent intermediate entities. -	NodeVector<FieldDescriptor> defaultFields = field->getDefaultFields(); +	ManagedVector<FieldDescriptor> defaultFields = field->getDefaultFields();  	// Try to parse the data using the type specified by the respective field.  	// If that does not work we proceed to the next possible field. diff --git a/src/core/resource/ResourceManager.cpp b/src/core/resource/ResourceManager.cpp index cc53e0a..ea6e075 100644 --- a/src/core/resource/ResourceManager.cpp +++ b/src/core/resource/ResourceManager.cpp @@ -89,7 +89,7 @@ public:  	bool isSuccess() { return success; }  }; -NodeVector<Node> ResourceManager::parse( +ManagedVector<Node> ResourceManager::parse(      ParserContext &ctx, const std::string &path, const std::string &mimetype,      const std::string &rel, const RttiSet &supportedTypes, ParseMode mode)  { @@ -105,11 +105,11 @@ NodeVector<Node> ResourceManager::parse(  	Resource resource;  	if (!req.deduce(registry, logger) ||  	    !req.locate(registry, logger, resource)) { -		return NodeVector<Node>{}; +		return ManagedVector<Node>{};  	}  	// initialize the output vector. -	NodeVector<Node> parsedNodes; +	ManagedVector<Node> parsedNodes;  	// Allocate a new SourceId handle for this Resource  	bool newResource = false; @@ -208,7 +208,7 @@ NodeVector<Node> ResourceManager::parse(  		catch (LoggableException ex) {  			// Log the exception and return nullptr  			logger.log(ex); -			return NodeVector<Node>{}; +			return ManagedVector<Node>{};  		}  	} @@ -235,7 +235,7 @@ Rooted<Node> ResourceManager::import(ParserContext &ctx,                                       const std::string &rel,                                       const RttiSet &supportedTypes)  { -	NodeVector<Node> res = +	ManagedVector<Node> res =  	    parse(ctx, path, mimetype, rel, supportedTypes, ParseMode::IMPORT);  	if (res.size() == 1U) {  		return res[0]; @@ -243,7 +243,7 @@ Rooted<Node> ResourceManager::import(ParserContext &ctx,  	return nullptr;  } -NodeVector<Node> ResourceManager::include(ParserContext &ctx, +ManagedVector<Node> ResourceManager::include(ParserContext &ctx,                                            const std::string &path,                                            const std::string &mimetype,                                            const std::string &rel, diff --git a/src/core/resource/ResourceManager.hpp b/src/core/resource/ResourceManager.hpp index 186ce42..67a650d 100644 --- a/src/core/resource/ResourceManager.hpp +++ b/src/core/resource/ResourceManager.hpp @@ -136,7 +136,7 @@ private:  	 * @param mode describes whether the file should be included or imported.  	 * @return the parsed nodes or an empty list if something went wrong.  	 */ -	NodeVector<Node> parse(ParserContext &ctx, const std::string &path, +	ManagedVector<Node> parse(ParserContext &ctx, const std::string &path,  	                       const std::string &mimetype, const std::string &rel,  	                       const RttiSet &supportedTypes, ParseMode mode); @@ -196,7 +196,7 @@ public:  	 * checked, not the actual result.  	 * @return the parsed nodes or an empty list if something went wrong.  	 */ -	NodeVector<Node> include(ParserContext &ctx, const std::string &path, +	ManagedVector<Node> include(ParserContext &ctx, const std::string &path,  	                         const std::string &mimetype,  	                         const std::string &rel,  	                         const RttiSet &supportedTypes); diff --git a/src/plugins/xml/XmlOutput.cpp b/src/plugins/xml/XmlOutput.cpp index 516fc22..5713f29 100644 --- a/src/plugins/xml/XmlOutput.cpp +++ b/src/plugins/xml/XmlOutput.cpp @@ -656,7 +656,7 @@ void transformChildren(DocumentEntity *parentEntity, Handle<Element> parent,                         TransformParams &P)  { -	NodeVector<FieldDescriptor> fieldDescs = +	ManagedVector<FieldDescriptor> fieldDescs =  	    parentEntity->getDescriptor()->getFieldDescriptors();  	for (size_t f = 0; f < fieldDescs.size(); f++) { @@ -787,4 +787,4 @@ Rooted<Text> transformPrimitive(Handle<Element> parent, Handle<Type> type,  	return text;  }  } -}
\ No newline at end of file +} diff --git a/test/core/model/OntologyTest.cpp b/test/core/model/OntologyTest.cpp index ad9299b..11657d0 100644 --- a/test/core/model/OntologyTest.cpp +++ b/test/core/model/OntologyTest.cpp @@ -142,23 +142,23 @@ TEST(StructuredClass, getFieldDescriptors)  	// check all FieldDescriptors  	{ -		NodeVector<FieldDescriptor> fds = A->getFieldDescriptors(); -		ASSERT_EQ(3, fds.size()); +		ManagedVector<FieldDescriptor> fds = A->getFieldDescriptors(); +		ASSERT_EQ(3U, fds.size());  		ASSERT_EQ(A_a, fds[0]);  		ASSERT_EQ(A_b, fds[1]);  		ASSERT_EQ(A_main, fds[2]);  	}  	{ -		NodeVector<FieldDescriptor> fds = B->getFieldDescriptors(); -		ASSERT_EQ(4, fds.size()); +		ManagedVector<FieldDescriptor> fds = B->getFieldDescriptors(); +		ASSERT_EQ(4U, fds.size());  		ASSERT_EQ(A_a, fds[0]);  		ASSERT_EQ(B_b, fds[1]);  		ASSERT_EQ(B_c, fds[2]);  		ASSERT_EQ(B_main, fds[3]);  	}  	{ -		NodeVector<FieldDescriptor> fds = C->getFieldDescriptors(); -		ASSERT_EQ(4, fds.size()); +		ManagedVector<FieldDescriptor> fds = C->getFieldDescriptors(); +		ASSERT_EQ(4U, fds.size());  		ASSERT_EQ(B_b, fds[0]);  		ASSERT_EQ(B_c, fds[1]);  		// superclass fields come before subclass fields (except for the TREE @@ -182,8 +182,8 @@ TEST(StructuredClass, getFieldDescriptorsCycles)  	    A, sys->getStringType(), logger, false, "a");  	ASSERT_FALSE(ontology->validate(logger));  	// if we call getFieldDescriptors that should still return a valid result. -	NodeVector<FieldDescriptor> fds = A->getFieldDescriptors(); -	ASSERT_EQ(1, fds.size()); +	ManagedVector<FieldDescriptor> fds = A->getFieldDescriptors(); +	ASSERT_EQ(1U, fds.size());  	ASSERT_EQ(A_a, fds[0]);  } @@ -453,7 +453,7 @@ TEST(Descriptor, getDefaultFieldsCycles)  	 * Now try to get the default fields of A. This should not lead to cycles  	 * if we correctly note all already visited nodes.  	 */ -	NodeVector<FieldDescriptor> defaultFields = A->getDefaultFields(); +	ManagedVector<FieldDescriptor> defaultFields = A->getDefaultFields();  	ASSERT_EQ(1U, defaultFields.size());  	ASSERT_EQ(A_field, defaultFields[0]);  } | 
