libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
moEventList.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moEventList.h
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28 
29 *******************************************************************************/
30 
31 #include "moValue.h"
32 #include "moLock.h"
33 
34 #ifndef __MOEVENTO_H
35 #define __MOEVENTO_H
36 
38 
42 {
50 };
51 
53 
57 public:
58 
61 
62  MOint deviceid; //esto vuela
63  MOint devicecode;//esto puede q quede
69 
71  moEvent();
73  moEvent(MOint did, MOint cod, MOint val0 = 0, MOint val1 = 0, MOint val2 = 0, MOint val3 = 0, MOpointer ptr=0);
75  moEvent(MOint did, MOint cod, MOint val0, MOpointer ptr );
77  virtual ~moEvent();
78 
80 
81  virtual const moText& ToJSON();
82 };
83 
84 #define MO_MESSAGE 0xFABC05
85 #define MO_DATAMESSAGE 0xFABFAB
86 
88 
98 
99  public:
100  moMessage();
101  moMessage(const moMessage& src) : moEvent() {
102  (*this) = src;
103  }
104  moMessage& operator=(const moMessage& src);
105 
106  moMessage( MOint m_MoldeoIdDest, MOint m_MoldeoIdSrc, const moData& data );
107  moMessage( MOint m_MoldeoIdDest, MOint m_InletIdDest, MOint m_MoldeoIdSrc, const moData& data );
108  moMessage( MOint p_MoldeoIdDest, MOint m_InletIdDest, moMoldeoObjectType p_TypeDest, MOint p_MoldeoIdSrc, moMoldeoObjectType p_TypeSrc, const moData& p_data );
109  moMessage( MOint p_MoldeoIdDest, MOint m_InletIdDest, moMoldeoObjectType p_TypeDest, moText p_NameDest, MOint p_MoldeoIdSrc, moMoldeoObjectType p_TypeSrc, moText p_NameSrc, const moData& p_data );
110  virtual ~moMessage();
111 
113 
118 
123 
124  virtual const moText& ToJSON();
125 };
126 
128 
129 
130 
132 
140 
141 public:
142 
144 
147 
148  moEventList();
149  virtual ~moEventList();
150 
151 
152  MOboolean Init();
153  void Add( moMessage* p_Message );
154  void Add( moEvent* p_Event );
155  void Add(MOint did, MOint cod, MOint val0 = 0, MOint val1 = 0, MOint val2 = 0, MOint val3 = 0, MOpointer ptr=0);
156  void Add(MOint did, MOint cod, MOint val0, MOpointer ptr );
157  MOboolean Delete(moEvent *ev);
158  MOboolean Delete(moMessage *ev);
159  MOboolean Finish();
160 
161 };
162 
163 // moEventPacket class **************************************************
165 
172 {
173 public:
174  moEventPacket(float p_sendInterval, int p_maxEventNum);
175  ~moEventPacket();
176 
177  void ClearPacket();
178  bool AddEvent(moEvent *e);
179  bool ReadyToSend();
180 
181  int GetNumEvents() { return num_events; }
182  int GetPacketSize() { return num_events * sizeof(moEventStruct); }
183  moEventStruct* GetPacket() { return buffer_events; }
184  moEventStruct GetEvent(int i) { return buffer_events[i]; }
185 private:
186  float sendInterval;
187  int maxEventNum;
188 
189  float time0;
190 
191  moEventStruct* buffer_events;
192  void* pointer;
193  moEventStruct empty_event;
194  int num_events;
195  bool packet_full;
196 };
197 
198 moDeclareExportedDynamicArray( moEventPacket*, moEventPacketArray );
199 
200 #endif
moMoldeoObjectType
Tipos de objetos en Moldeo.
Definition: moTypes.h:525
moEvent * next
Definition: moEventList.h:60
MOint m_InletIdDest
Definition: moEventList.h:115
moEvent * First
Definition: moEventList.h:145
MOint m_MoldeoIdSrc
Definition: moEventList.h:119
virtual const moText & ToJSON()
Clase Evento.
Definition: moEventList.h:56
MOint m_MoldeoIdDest
Definition: moEventList.h:114
virtual MOboolean Finish()
Finaliza el objeto, libera recursos.
Definition: moAbstract.cpp:147
Definition: moLock.h:50
MOint deviceid
Definition: moEventList.h:62
MOpointer pointer
Definition: moEventList.h:68
moEventStruct * GetPacket()
Definition: moEventList.h:183
moMessage(const moMessage &src)
Definition: moEventList.h:101
#define MOboolean
Definition: moTypes.h:385
moText JSON
Definition: moEventList.h:79
Clase Mensaje.
Definition: moEventList.h:97
moText m_NameSrc
Definition: moEventList.h:122
Clase base abstracta de donde deben derivar los objetos [virtual pura].
Definition: moAbstract.h:191
virtual MOboolean Init()
Inicializa el objeto.
Definition: moAbstract.cpp:141
moEvent * previous
Definition: moEventList.h:59
moText m_NameDest
Definition: moEventList.h:117
int GetPacketSize()
Definition: moEventList.h:182
MOint reservedvalue0
Definition: moEventList.h:46
#define LIBMOLDEO_API
Definition: moTypes.h:180
moMoldeoObjectType m_TypeDest
Definition: moEventList.h:116
MOint reservedvalue1
Definition: moEventList.h:47
Lista de eventos.
Definition: moEventList.h:139
clase de para manejar textos
Definition: moText.h:75
MOint reservedvalue1
Definition: moEventList.h:65
MOint reservedvalue2
Definition: moEventList.h:48
MOint devicecode
Definition: moEventList.h:45
int GetNumEvents()
Definition: moEventList.h:181
#define MOint
Definition: moTypes.h:388
Estructura base de un evento.
Definition: moEventList.h:41
MOint reservedvalue0
Definition: moEventList.h:64
MOint reservedvalue3
Definition: moEventList.h:67
MOint devicecode
Definition: moEventList.h:63
MOint reservedvalue3
Definition: moEventList.h:49
MOint deviceid
Definition: moEventList.h:44
moMatrix3 & operator=(const moMatrix3 &rkM)
moLock m_lock
Definition: moEventList.h:143
moDeclareExportedDynamicArray(moMessage, moMessages)
Paquete de eventos.
Definition: moEventList.h:171
moData m_Data
Definition: moEventList.h:112
moEventStruct GetEvent(int i)
Definition: moEventList.h:184
moMoldeoObjectType m_TypeSrc
Definition: moEventList.h:121
#define MOpointer
Definition: moTypes.h:409
moEvent * Last
Definition: moEventList.h:146
MOint reservedvalue2
Definition: moEventList.h:66
MOint m_OutletIdSrc
Definition: moEventList.h:120