/******************************************************************************* * CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps * * version 0.1 * * Copyright (C) 2009, IGG Team, LSIIT, University of Strasbourg * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by the * * Free Software Foundation; either version 2.1 of the License, or (at your * * option) any later version. * * * * This library is distributed in the hope that it will be useful, but WITHOUT * * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * * for more details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with this library; if not, write to the Free Software Foundation, * * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * * * Web site: https://iggservis.u-strasbg.fr/CGoGN/ * * Contact information: cgogn@unistra.fr * * * *******************************************************************************/ namespace CGoGN { template AttributeHandler::AttributeHandler(GenericMap* m, AttributeMultiVector* amv): m_map(m) { m_attrib = amv ; } template AttributeHandler::AttributeHandler(const AttributeHandler& ta): m_map(ta.m_map), m_attrib(ta.m_attrib) {} template inline void AttributeHandler::operator=(const AttributeHandler& ta) { m_map = ta.m_map ; m_attrib = ta.m_attrib ; } template AttributeHandler::~AttributeHandler() {} template GenericMap* AttributeHandler::map() const { return m_map ; } template AttributeMultiVector* AttributeHandler::getDataVector() const { return m_attrib ; } template unsigned int AttributeHandler::getOrbit() const { return m_attrib->getOrbit() ; } template unsigned int AttributeHandler::getIndex() const { return m_attrib->getIndex() ; } template const std::string& AttributeHandler::name() const { return m_attrib->getName() ; } template bool AttributeHandler::isValid() const { return (m_attrib->getIndex() != AttributeContainer::UNKNOWN && m_map != NULL && m_attrib != NULL) ; } template inline T& AttributeHandler::operator[](Dart d) { assert(isValid() || !"Invalid AttributeHandler") ; unsigned int orbit = m_attrib->getOrbit() ; unsigned int a = m_map->getEmbedding(d, orbit) ; if (a == EMBNULL) a = m_map->embedNewCell(orbit, d); return m_attrib->operator[](a); } template inline const T& AttributeHandler::operator[](Dart d) const { assert(isValid() || !"Invalid AttributeHandler") ; unsigned int a = m_map->getEmbedding(d, m_attrib->getOrbit()) ; return m_attrib->operator[](a) ; } template inline T& AttributeHandler::operator[](unsigned int a) { assert(isValid() || !"Invalid AttributeHandler") ; return m_attrib->operator[](a); } template inline const T& AttributeHandler::operator[](unsigned int a) const { assert(isValid() || !"Invalid AttributeHandler") ; return m_attrib->operator[](a); } template inline unsigned int AttributeHandler::insert(const T& elt) { assert(isValid() || !"Invalid AttributeHandler") ; unsigned int idx = m_map->getAttributeContainer(m_attrib->getOrbit()).insertLine(); m_attrib->operator[](idx) = elt; return idx; } template inline unsigned int AttributeHandler::newElt() { assert(isValid() || !"Invalid AttributeHandler") ; unsigned int idx = m_map->getAttributeContainer(m_attrib->getOrbit()).insertLine(); return idx; } template inline unsigned int AttributeHandler::begin() const { assert(isValid() || !"Invalid AttributeHandler") ; return m_map->getAttributeContainer(m_attrib->getOrbit()).begin(); } template inline unsigned int AttributeHandler::end() const { assert(isValid() || !"Invalid AttributeHandler") ; return m_map->getAttributeContainer(m_attrib->getOrbit()).end(); } template inline void AttributeHandler::next(unsigned int& iter) const { assert(isValid() || !"Invalid AttributeHandler") ; m_map->getAttributeContainer(m_attrib->getOrbit()).next(iter); } } //namespace CGoGN