Kamil Dudka

RRV - Radiosity Renderer and Visualizer (C++, OpenGL)

File detail

Name:DownloadEntitySet.h [Download]
Location: rrv > src
Size:2.8 KB
Last modification:2009-10-21 22:58

Source code

 * Copyright (C) 2007 TODO
 * This file is part of rrv (Radiosity Renderer and Visualizer).
 * rrv is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 * rrv is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with rrv.  If not, see <http://www.gnu.org/licenses/>.
 * @file EntitySet.h
 * @brief Class EntitySet - container of Entity objects.
 * @author xdudka00, xfilak01
 * @date 2007-11-17
#include "Entity.h"
#include <vector>
#	ifndef NDEBUG
#		include <iostream>
# 	include "PatchSequenceEnumerator.h"
#	endif
	class PatchRandomAccessEnumerator;
	class TriangleSetExt;
 * @brief Container of Entity objects.
class EntitySet {
		 * @brief Add @b copy @b of entity to container.
		 * @note There is no need to keep Entity object in memory outside this class.
		 * @param entity Pointer to entity to copy to container.
		void add(Entity *entity);
		 * @copydoc Entity::divide(float)
		void divide(float size);
		 * @brief Create enumerator for all patches maintained indirectly by EntitySet.
		 * @return Return instance of PatchSequenceEnumerator allocated on the heap.
		PatchSequenceEnumerator* createPatchSequenceEnumerator();
		 * @brief Return current count of entities stored in container.
		 * @return Return current count of entities stored in container.
		size_t count();
		 * @brief Access entity using its index.
		 * @param index Index of entity - must be in range <0, count()-1>.
		 * @return Return reference to desired entity.
		Entity& operator[] (unsigned index);
		 * @brief @copydoc Entity::computeVertexColors()
		TriangleSetExt* computeVertexColors();
		typedef std::vector<Entity> TContainer;
		TContainer container_;
#ifndef NDEBUG
 * @brief Dump all maintained patches to output stream in human readable format.
 * @note This function will not be built if NDEBUG macro is defined.
 * @param out Output stream to write to.
 * @param entitySet Reference to EnitytSet object to dump.
 * @return Return output stream given as parameter.
inline std::ostream& operator<< (std::ostream &out, EntitySet &entitySet) {
	PatchSequenceEnumerator *pe= entitySet.createPatchSequenceEnumerator();
	Triangle *t;
	while (0!= (t= pe->nextPatch()))
		out << *t;
	delete pe;
	return out;
#endif // ENTITYSET_H