K3dGameData.cpp

Go to the documentation of this file.
00001 
00013 /***************************************************************************
00014  *   Copyright (C) 2007 by Jan Koci   *
00015  *   honza.koci@email.cz   *
00016  *   http://kengine.sourceforge.net/tutorial/
00017  *                                                                         *
00018  *   This program is free software; you can redistribute it and/or modify  *
00019  *   it under the terms of the GNU General Public License as published by  *
00020  *   the Free Software Foundation; either version 2 of the License, or     *
00021  *   (at your option) any later version.                                   *
00022  *                                                                         *
00023  *   This program is distributed in the hope that it will be useful,       *
00024  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00025  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00026  *   GNU General Public License for more details.                          *
00027  *                                                                         *
00028  *   You should have received a copy of the GNU General Public License     *
00029  *   along with this program; if not, write to the                         *
00030  *   Free Software Foundation, Inc.,                                       *
00031  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00032  ***************************************************************************/
00033 
00034 #include "K3dGameData.h"
00035 
00036 
00037 K3dAddress::K3dAddress()
00038 {
00039 }
00040 
00041 K3dAddress::~K3dAddress()
00042 {
00043         DeleteAddressArray();
00044 }
00045 
00046 void K3dAddress::ShowAddressArray()
00047 {
00048         cout << "Number of addresses = " << m_tAddressArray.size() << endl;
00049         for(size_t i=0; i<m_tAddressArray.size(); i++)
00050         {
00051                 cout << "Address " << i << " = "  << m_tAddressArray[i] << endl;
00052         }
00053 }
00054 
00057 void K3dAddress::AddAddress(void* _pAddress)
00058 {
00059         m_tAddressArray.push_back(_pAddress);
00060 }
00061 
00064 void *K3dAddress::GetAddress(const int _iId)
00065 {
00066         if(!( (0 <= _iId) && (_iId < (int)m_tAddressArray.size()) ))
00067         {
00068                 cerr << "void *K3dAddress::GetAddress(const int _iId) -- Error - Invalid memory address array index" << endl;
00069                 return NULL;
00070         }
00071         return m_tAddressArray[_iId];
00072 }
00073 
00075 int K3dAddress::GetNumAddresses()
00076 {
00077         return (int)m_tAddressArray.size();
00078 }
00079 
00083 bool K3dAddress::FindAddress(void* _pAddress)
00084 {
00085         m_it = find(m_tAddressArray.begin(), m_tAddressArray.end(), _pAddress);
00086         if(m_it != m_tAddressArray.end())
00087         {
00088                 return true;
00089         }
00090         return false;
00091 }
00092 
00096 void K3dAddress::DeleteAddress(void* _pAddress)
00097 {
00098         m_it = find(m_tAddressArray.begin(), m_tAddressArray.end(), _pAddress);
00099         if(m_it != m_tAddressArray.end())
00100         {
00101                 m_tAddressArray.erase(m_it);
00102         }
00103         else
00104         {
00105                 cerr <<  "K3dAddress::DeleteAddress() -- The map key _pAddress doesn't exists " << endl;
00106         }
00107 }
00108 
00110 void K3dAddress::DeleteAddressArray()
00111 {
00112         m_tAddressArray.clear();
00113 } 
00114 
00115 K3dGameData::K3dGameData(void)
00116 {
00117 }
00118 
00119 K3dGameData::~K3dGameData(void)
00120 {
00121 }
00122 

Generated on Thu Aug 16 23:53:28 2007 for K3dEngine by  doxygen 1.5.0