MetaClass.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 <vector>
00019 
00020 #include <OpenKarto/MetaClass.h>
00021 
00022 namespace karto
00023 {
00024 
00028 
00029   struct MetaArgsPrivate
00030   {
00031     std::vector<Any> m_Arguments;
00032   };
00033 
00034   MetaArguments::MetaArguments()
00035     : m_pPrivate(new MetaArgsPrivate)
00036   {
00037   }
00038 
00039   MetaArguments::MetaArguments(const Any& a0)
00040     : m_pPrivate(new MetaArgsPrivate)
00041   {
00042     m_pPrivate->m_Arguments.push_back(a0);
00043   }
00044 
00045   MetaArguments::MetaArguments(const Any& a0, const Any& a1)
00046     : m_pPrivate(new MetaArgsPrivate)
00047   {
00048     m_pPrivate->m_Arguments.push_back(a0);
00049     m_pPrivate->m_Arguments.push_back(a1);
00050   }
00051 
00052   MetaArguments::MetaArguments(const Any& a0, const Any& a1, const Any& a2)
00053     : m_pPrivate(new MetaArgsPrivate)
00054   {
00055     m_pPrivate->m_Arguments.push_back(a0);
00056     m_pPrivate->m_Arguments.push_back(a1);
00057     m_pPrivate->m_Arguments.push_back(a2);
00058   }
00059 
00060   MetaArguments::MetaArguments(const Any& a0, const Any& a1, const Any& a2, const Any& a3)
00061     : m_pPrivate(new MetaArgsPrivate)
00062   {
00063     m_pPrivate->m_Arguments.push_back(a0);
00064     m_pPrivate->m_Arguments.push_back(a1);
00065     m_pPrivate->m_Arguments.push_back(a2);
00066     m_pPrivate->m_Arguments.push_back(a3);
00067   }
00068 
00069   MetaArguments::MetaArguments(const Any& a0, const Any& a1, const Any& a2, const Any& a3, const Any& a4)
00070     : m_pPrivate(new MetaArgsPrivate)
00071   {
00072     m_pPrivate->m_Arguments.push_back(a0);
00073     m_pPrivate->m_Arguments.push_back(a1);
00074     m_pPrivate->m_Arguments.push_back(a2);
00075     m_pPrivate->m_Arguments.push_back(a3);
00076     m_pPrivate->m_Arguments.push_back(a4);
00077   }
00078 
00079   MetaArguments::~MetaArguments()
00080   {
00081     delete m_pPrivate;
00082   }
00083 
00084   kt_size_t MetaArguments::GetCount() const
00085   {
00086     return m_pPrivate->m_Arguments.size();
00087   }
00088 
00089   const Any& MetaArguments::operator[](kt_size_t index)  const
00090   {
00091     assert(index >= 0 && index < GetCount());
00092     return m_pPrivate->m_Arguments[index];
00093   }
00094 
00098 
00099   MetaClass::MetaClass(const karto::String& rName)
00100     : m_Name(rName)
00101   {
00102   }
00103 
00104   MetaClass::~MetaClass()
00105   {
00106   }
00107 
00108   const karto::String& MetaClass::GetName() const
00109   {
00110     return m_Name;
00111   }
00112 
00113   kt_size_t MetaClass::GetBaseSize() const
00114   {
00115     return m_BaseClasses.Size();
00116   }
00117 
00118   const MetaClass& MetaClass::GetBase(kt_size_t index) const
00119   {
00120     if (index >= m_BaseClasses.Size())
00121     {
00122       assert(false);
00123       throw karto::Exception("MetaClass::GetBase() - Index out of range");
00124     }
00125 
00126     return *m_BaseClasses[index];
00127   }
00128 
00129   bool MetaClass::operator==(const MetaClass& rOther) const
00130   {
00131     return m_Name == rOther.m_Name;
00132   }
00133 
00134   bool MetaClass::operator!=(const MetaClass& rOther) const
00135   {
00136     return m_Name != rOther.m_Name;
00137   }
00138 
00142 
00143 }


nav2d_karto
Author(s): Sebastian Kasperski
autogenerated on Thu Aug 27 2015 14:07:25