GridIndexLookup.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 <OpenKarto/GridIndexLookup.h>
00019 
00020 namespace karto
00021 {
00022 
00023   LookupArray::LookupArray()
00024     : m_pArray(NULL)
00025     , m_Capacity(0)
00026     , m_Size(0)
00027   {
00028   }
00029 
00030   LookupArray::~LookupArray()
00031   {
00032     assert(m_pArray != NULL);
00033 
00034     delete[] m_pArray;
00035     m_pArray = NULL;
00036   }
00037 
00038   void LookupArray::Clear()
00039   {
00040     memset(m_pArray, 0, sizeof(kt_int32s) * m_Capacity);
00041   }
00042 
00043   kt_int32u LookupArray::GetSize() const
00044   {
00045     return m_Size;
00046   }
00047 
00048   void LookupArray::SetSize(kt_int32u size)
00049   {
00050     assert(size != 0);
00051 
00052     if (size > m_Capacity)
00053     {
00054       if (m_pArray != NULL)
00055       {
00056         delete [] m_pArray;
00057       }
00058       m_Capacity = size;
00059       m_pArray = new kt_int32s[m_Capacity];
00060     }
00061 
00062     m_Size = size;
00063   }
00064 
00065 }


nav2d_karto
Author(s): Sebastian Kasperski
autogenerated on Mon Oct 6 2014 02:44:17