Blender  V2.59
SG_IObject.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: SG_IObject.cpp 35175 2011-02-25 13:39:04Z jesterking $
00003  * ***** BEGIN GPL LICENSE BLOCK *****
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software Foundation,
00017  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018  *
00019  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00020  * All rights reserved.
00021  *
00022  * The Original Code is: all of this file.
00023  *
00024  * Contributor(s): none yet.
00025  *
00026  * ***** END GPL LICENSE BLOCK *****
00027  */
00028 
00034 #include "SG_IObject.h"
00035 #include "SG_Controller.h"
00036 
00037 SG_Stage gSG_Stage = SG_STAGE_UNKNOWN;
00038 
00039 SG_IObject::
00040 SG_IObject(
00041         void* clientobj,
00042         void* clientinfo,
00043         SG_Callbacks& callbacks
00044 ): 
00045         SG_QList(),
00046         m_SGclientObject(clientobj),
00047         m_SGclientInfo(clientinfo)
00048 {
00049         m_callbacks = callbacks;
00050 }
00051 
00052 SG_IObject::
00053 SG_IObject(
00054         const SG_IObject &other
00055 ) :
00056         SG_QList(),
00057         m_SGclientObject(other.m_SGclientObject),
00058         m_SGclientInfo(other.m_SGclientInfo),
00059         m_callbacks(other.m_callbacks) 
00060 {
00061         //nothing to do
00062 }
00063 
00064         void 
00065 SG_IObject::
00066 AddSGController(
00067         SG_Controller* cont
00068 ){
00069         m_SGcontrollers.push_back(cont);
00070 }
00071 
00072         void                            
00073 SG_IObject::
00074 RemoveAllControllers(
00075 ) { 
00076         m_SGcontrollers.clear(); 
00077 }
00078 
00079 void SG_IObject::SetControllerTime(double time)
00080 {
00081         SGControllerList::iterator contit;
00082         for (contit = m_SGcontrollers.begin();contit!=m_SGcontrollers.end();++contit)
00083         {
00084                 (*contit)->SetSimulatedTime(time);
00085         }
00086 }
00087 
00089 
00090 
00091 SG_IObject::
00092 ~SG_IObject()
00093 {
00094         SGControllerList::iterator contit;
00095 
00096         for (contit = m_SGcontrollers.begin();contit!=m_SGcontrollers.end();++contit)
00097         {
00098                 delete (*contit);
00099         }
00100 }