Blender V2.61 - r43446

KX_NetworkMessageSensor.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (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 General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00032 #ifndef __KX_NETWORKMESSAGE_SENSOR_H
00033 #define __KX_NETWORKMESSAGE_SENSOR_H
00034 
00035 #include "SCA_ISensor.h"
00036 
00037 class KX_NetworkEventManager;
00038 class NG_NetworkScene;
00039 
00040 class KX_NetworkMessageSensor : public SCA_ISensor
00041 {
00042     // note: Py_Header MUST BE the first listed here
00043     Py_Header
00044     NG_NetworkScene        *m_NetworkScene;
00045 
00046     // The subject we filter on.
00047     STR_String m_subject;
00048 
00049     // The number of messages caught since the last frame.
00050     int m_frame_message_count;
00051 
00052     bool m_IsUp;
00053 
00054     class CListValue* m_BodyList;
00055     class CListValue* m_SubjectList;
00056 public:
00057     KX_NetworkMessageSensor(
00058         KX_NetworkEventManager* eventmgr,   // our eventmanager
00059         NG_NetworkScene *NetworkScene,      // our scene
00060         SCA_IObject* gameobj,               // the sensor controlling object
00061         const STR_String &subject
00062     );
00063     virtual ~KX_NetworkMessageSensor();
00064 
00065     virtual CValue* GetReplica();
00066     virtual bool Evaluate();
00067     virtual bool IsPositiveTrigger();
00068     virtual void Init();
00069     void EndFrame();
00070     
00071     virtual void Replace_NetworkScene(NG_NetworkScene *val)
00072     {
00073         m_NetworkScene= val;
00074     };
00075 
00076 #ifdef WITH_PYTHON
00077 
00078     /* ------------------------------------------------------------- */
00079     /* Python interface -------------------------------------------- */
00080     /* ------------------------------------------------------------- */
00081 
00082     /* attributes */
00083     static PyObject*    pyattr_get_bodies(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); 
00084     static PyObject*    pyattr_get_subjects(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
00085 
00086 #endif // WITH_PYTHON
00087 
00088 };
00089 
00090 #endif //__KX_NETWORKMESSAGE_SENSOR_H
00091