attribute_map_collection.h

Go to the documentation of this file.
00001 /*
00002     mesh3d
00003     Copyright (C) 2010  Timo Suoranta
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2.1 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 */
00019 
00027 #ifndef MESH3D__ATTRIBUTE_MAP_COLLECTION__H
00028 #define MESH3D__ATTRIBUTE_MAP_COLLECTION__H
00029 
00030 #include "mesh3d/attribute_map.h"
00031 #include "mesh3d/exception.h"
00032 #include <memory>
00033 #include <map>
00034 
00035 namespace mesh3d {
00036 
00038 template<typename Key>
00039 class attribute_map_collection
00040 {
00041 private: 
00042     typedef std::map<std::string, std::tr1::shared_ptr<attribute_map_base<Key> > > map_map;
00043 
00044 public:
00045     typedef typename map_map::const_iterator const_iterator;
00046 
00047     attribute_map_collection();
00048 
00049     void clear();
00050 
00051     size_t size() const;
00052 
00053     template<typename Value>
00054     std::tr1::shared_ptr<attribute_map<Key, Value> > create(std::string const &name);
00055 
00056     void insert(std::string const &name, std::tr1::shared_ptr<attribute_map_base<Key> > const &map);
00057     void remove(std::string const &name);
00058     bool has   (std::string const &name) const;
00059 
00060     std::tr1::shared_ptr<attribute_map_base<Key> > find_any(std::string const &name) const;
00061 
00062     template<typename Value> std::tr1::shared_ptr<attribute_map<Key, Value> > find(std::string const &name) const;
00063     template<typename Value> std::tr1::shared_ptr<attribute_map<Key, Value> > find_or_create(std::string const &name);
00064 
00065     const_iterator begin() const;
00066     const_iterator end  () const;
00067 
00068 private:
00069     map_map m_maps;
00070 };
00071 
00072 }
00073 
00074 #include "attribute_map_collection.inl"
00075 
00076 #endif
00077 
Generated on Sun Apr 11 12:23:08 2010 for RenderStack by  doxygen 1.6.3