MetaAttribute.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2006-2011, SRI International (R)
00003  *
00004  * This program is free software: you can redistribute it and/or modify
00005  * it under the terms of the GNU Lesser General Public License as published by
00006  * the Free Software Foundation, either version 3 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #include <map>
00019 
00020 #include <OpenKarto/MetaAttribute.h>
00021 
00022 namespace karto
00023 {
00024 
00028 
00029   struct MetaAttributePrivate
00030   {
00031     typedef std::map< karto::String, Any > Attributes;
00032     Attributes m_Attributes;
00033   };
00034 
00038 
00039   MetaAttribute::MetaAttribute()
00040     : m_pPrivate(new MetaAttributePrivate())
00041   {
00042   }
00043 
00044   MetaAttribute::~MetaAttribute()
00045   {
00046     delete m_pPrivate;
00047   }
00048 
00049   kt_bool MetaAttribute::HasAttribute(const karto::String& rId) const
00050   {
00051     return m_pPrivate->m_Attributes.find(rId) != m_pPrivate->m_Attributes.end();
00052   }
00053 
00054   const Any& MetaAttribute::GetAttribute(const karto::String& rId) const
00055   {
00056     MetaAttributePrivate::Attributes::const_iterator iter = m_pPrivate->m_Attributes.find(rId);
00057     if (iter != m_pPrivate->m_Attributes.end())
00058     {
00059       return iter->second;
00060     }
00061 
00062     return Any::Empty;
00063   }
00064 
00065   void MetaAttribute::AddAttribute(const karto::String& rId, const Any& rValue) const
00066   {
00067     m_pPrivate->m_Attributes[rId] = rValue;
00068   }
00069 
00070 }


nav2d_karto
Author(s): Sebastian Kasperski
autogenerated on Sun Apr 2 2017 04:05:23