libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo es el conjunto de objetos y funciones, que permiten ejecutar las operaciones básicas de la plataforma Moldeo, y que compone su núcleo.
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Amigas 'defines' Grupos Páginas
moMoldeoObject.h
Ir a la documentación de este archivo.
1 /*******************************************************************************
2 
3  moMoldeoObject.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 
32 #ifndef __MO_MOLDEOOBJECT_H__
33 #define __MO_MOLDEOOBJECT_H__
34 
35 #include "moTypes.h"
36 #include "moText.h"
37 #include "moAbstract.h"
38 #include "moScript.h"
39 #include "moEventList.h"
40 #include "moConfig.h"
41 #include "moArray.h"
42 #include "moConnectors.h"
43 
44 #define MO_INLET_NAME 0
45 #define MO_INLET_TYPE 1
46 
47 #define MO_OUTLET_NAME 0
48 #define MO_OUTLET_TYPE 1
49 #define MO_OUTLET_INLETS_OFFSET 2
50 
51 #define MO_IODEVICE_KEYBOARD 0
52 #define MO_IODEVICE_MOUSE 1
53 #define MO_IODEVICE_MIDI 2
54 #define MO_IODEVICE_MIXER 3
55 #define MO_IODEVICE_JOYSTICK 4
56 #define MO_IODEVICE_NET_TCP_IN 5
57 #define MO_IODEVICE_NET_UDP_IN 6
58 #define MO_IODEVICE_NET_TCP_OUT 7
59 #define MO_IODEVICE_NET_UDP_OUT 8
60 #define MO_IODEVICE_LIVE 9
61 #define MO_IODEVICE_TRACKER 10
62 
63 #define MO_IODEVICE_TABLET 11
64 #define MO_IODEVICE_TOUCH 12
65 #define MO_IODEVICE_CONSOLE 20
66 #define MO_IODEVICE_ANY -1
67 
70 #define MO_MOLDEOOBJECTS_OFFSET_ID 100
71 #define MO_MOLDEOSCENEOBJECTS_OFFSET_ID 10000
73 
74 #define MO_MOLDEOOBJECT_UNDEFINED_ID -1
75 
76 #define RenderMan() m_pResourceManager->GetRenderMan()
77 #define TextureMan() m_pResourceManager->GetTextureMan()
78 #define DataMan() m_pResourceManager->GetDataMan()
79 #define VideoMan() m_pResourceManager->GetVideoMan()
80 #define SoundMan() m_pResourceManager->GetSoundMan()
81 #define GLMan() m_pResourceManager->GetGLMan()
82 
83 
84 class moResourceManager;
85 
87 
95 
96  public:
97 
101  moMobIndex() { m_paramindex = -1; m_valueindex = -1; }
102 
103  moMobIndex( const moMobIndex &src) {
104  (*this) = src;
105  }
106 
112  moMobIndex( MOint p_paramindex, MOint p_valueindex ) {
113  m_paramindex = p_paramindex; m_valueindex = p_valueindex;
114  }
115 
117  m_paramindex = src.m_paramindex;
118  m_valueindex = src.m_valueindex;
119  return(*this);
120  }
121 
122  void SetParamIndex( MOint p_paramindex) { m_paramindex = p_paramindex;}
123 
124  void SetValueIndex( MOint p_valueindex ) { m_valueindex = p_valueindex; }
125 
126  virtual ~moMobIndex() {}
127 
131  MOint GetParamIndex() const { return m_paramindex; }
132 
136  MOint GetValueIndex() const { return m_valueindex; }
137 
138  private:
139  MOint m_paramindex;
140  MOint m_valueindex;
141 
142 };
143 
145 
164 {
165  public:
166 
168  moMobDefinition();
169  moMobDefinition(const moMobDefinition& mb);
170 
172 
181  moMobDefinition( const moText& p_name,
182  const moText& p_configname,
183  moMoldeoObjectType p_type,
184  const moText& p_labelname,
185  MOint p_moldeoid = -1,
186  const moMobIndex& p_MobIndex = moMobIndex(-1,-1) ) {
187  m_Name = p_name;
188  m_ConfigName = p_configname;
189  m_Type = p_type;
190  m_MoldeoLabelName = p_labelname;
191  m_MoldeoId = p_moldeoid;
192  m_MobIndex = p_MobIndex;
193  m_MoldeoFatherId = -1;
194  m_MoldeoFatherLabelName = "";
195  m_Activate = true;
196  m_KeyName = "";
197  }
198 
200  virtual ~moMobDefinition();
201 
204 
206  inline bool IsValid() const {
207  bool result;
208  result = ( m_Type != MO_OBJECT_UNDEFINED
209  && m_MoldeoId!=-1
210  /*
211  && m_MobIndex.GetParamIndex()!=-1
212  && m_MobIndex.GetValueIndex()!=-1
213  */ );
214  return result;
215  }
216 
218  const moText& GetName() const;
219 
221  void SetName( const moText& p_name );
222 
224  const moText& GetConfigName() const;
225 
227  void SetConfigName( const moText& p_configname );
228 
230  moMoldeoObjectType GetType() const;
231 
233  moMoldeoObjectType GetStrToType( const moText& p_Str = moText("default") ) const;
234 
236  moText GetTypeStr() const;
237 
239  static moText GetTypeToClass( moMoldeoObjectType p_Type = MO_OBJECT_UNDEFINED );
240 
242  static moText GetTypeToName( moMoldeoObjectType p_Type = MO_OBJECT_UNDEFINED );
243 
245  void SetType( moMoldeoObjectType p_type );
246 
248  const moMobIndex& GetMobIndex() const;
249 
251  void SetLabelName( const moText& p_labelname );
253  const moText& GetLabelName() const;
254 
256 
259  void SetMoldeoId( MOint p_moldeoid );
260 
262 
265  MOint GetMoldeoId() const;
266 
268 
272  return m_MoldeoFatherId;
273  }
274 
276 
279  void SetMoldeoFatherId( MOint p_moldeoid ) {
280  m_MoldeoFatherId = p_moldeoid;
281  }
282 
284  void SetFatherLabelName( const moText& p_labelname );
286  const moText& GetFatherLabelName() const {
287  return m_MoldeoFatherLabelName;
288  }
289 
291  void SetKeyName( const moText& p_keyname );
293  const moText& GetKeyName() const {
294  return m_KeyName;
295  }
296 
297 
299 
302  const moText& GetDescription() const {
303  return m_Description;
304  }
305 
307 
310  void SetDescription( const moText& p_Description );
311 
312  void SetConsoleParamIndex( MOint p_paramindex );
313 
314  void SetConsoleValueIndex(MOint p_valueindex);
315 
316 
318 
321  bool GetActivate() const {
322  return m_Activate;
323  }
324 
326 
329  void SetActivate( bool p_activate );
330 
331 
332  const moText& ToJSON();
333 
334  protected:
335 
338 
341 
346 
348 
352 };
353 
354 /*doesnt work with GCC 4.7.1*/
356 
357 
359 
360  public:
361 
362  moMobState();
363  virtual ~moMobState();
364  moMobState( const moMobState& p_MobState );
365  moMobState& operator = ( const moMobState& src);
366 
367  void Activate();
368  void Deactivate();
369 
370  bool Activated() const;
371 
372  void Select();
373  void Unselect();
374 
375  bool Selected() const;
376  const moText& ToJSON();
377 
378  protected:
382 
383 };
384 
385 
387 
410 {
411  public:
415  moMoldeoObject();
416 
423  virtual ~moMoldeoObject();
424 
428  virtual MOboolean Init();
429 
433  virtual MOboolean Init( moResourceManager* p_pResources );
434 
438  virtual MOboolean Finish();
439 
440 
447  virtual MOboolean CreateConnectors();
448 
453  virtual MOboolean UpdateConnectors();
454 
455 
460  virtual MOboolean RefreshValue( moParam& param, int value_index );
461 
466  virtual MOboolean ResolveValue( moParam& param, int value_index, bool p_refresh=false );
467 
468 
473  virtual void Update( moEventList* p_EventList );//checks p_EventList for events/messages
474 
479  void SetResourceManager( moResourceManager* p_pResourceManager );//set the pointer to the resource manager for this object
480 
484  moResourceManager* GetResourceManager();//return pointer to the resource manager of this object
485 
489  MOint GetId() const;
490 
494  void SetId( MOint p_id );
495 
499  moMoldeoObjectType GetType() const;
500 
504  void SetType( moMoldeoObjectType p_type );
505 
509  void SetName( const moText& p_name ) { m_MobDefinition.SetName(p_name); }
510 
514  void SetLabelName( const moText& p_labelname ) { m_MobDefinition.SetLabelName(p_labelname); }
515 
519  void SetKeyName( const moText& p_keyname ) { m_MobDefinition.SetKeyName(p_keyname); }
520 
521  const moText& GetKeyName() const { return m_MobDefinition.GetKeyName(); }
522 
526  const moText& GetName() const { return m_MobDefinition.GetName(); }
527 
531  const moText& GetLabelName() const { return m_MobDefinition.GetLabelName(); }
532 
536  moConfig* GetConfig() { return &m_Config; }
537 
541  void SyncConnections();
542 
546  virtual int Save( const moText& p_save_filename = moText("") );
547 
551  void SetConfigName( const moText& p_configname );
552 
556  const moText& GetConfigName() const { return m_MobDefinition.GetConfigName(); }
557 
559 
562  const moText& GetDescription() const {
563  return m_MobDefinition.GetDescription();
564  }
565 
566 
568 
571  void SetDescription( const moText& p_Description ) {
572  m_MobDefinition.SetDescription(p_Description);
573 
574  }
575 
577  return m_MobDefinition;
578  }
579 
580  void SetMobDefinition( const moMobDefinition& p_MobDef ) {
581  m_MobDefinition = p_MobDef;
582  }
583 
584 
589  virtual moConfigDefinition * GetDefinition( moConfigDefinition *p_configdefinition = NULL );//retreive the parameters definition of the Moldeo Object
590 
594  moOutlets* GetOutlets();
595 
599  moInlets* GetInlets();
600 
605  MOint GetInletIndex( moText p_connector_name ) const;
606 
611  MOint GetOutletIndex( moText p_connector_name ) const;
612 
616  virtual void RegisterFunctions();
617 
621  virtual int ScriptCalling(moLuaVirtualMachine& vm, int iFunctionNumber);
622 
626  virtual void HandleReturns(moLuaVirtualMachine& vm, const char *strFunc);
627 
628 
632  virtual const moMobState& GetState() const;
633 
637  virtual bool SetState( const moMobState& p_MobState );
638 
639 
640  virtual void Activate();
641 
642  virtual void Deactivate();
643 
644  virtual bool Activated() const;
645 
646  virtual void Select();
647 
648  virtual void Unselect();
649 
650  virtual bool Selected() const;
651 
653  m_MobDefinition.SetConsoleParamIndex(p_paramindex);
654 
655  }
656 
657  virtual void SetConsoleValueIndex(MOint p_valueindex) {
658  m_MobDefinition.SetConsoleValueIndex(p_valueindex);
659  }
660 
661  virtual const moText& ToJSON();
662 
663  protected:
664 
666 
668  virtual void LoadDefinition();
669 
671  virtual void ScriptExeInit();
672  virtual void ScriptExeRun();
673  virtual void ScriptExeUpdate();
674  virtual void ScriptExeFinish();
675 
676  void SetScript( const moText& p_script );
677 
678 
680 
681 
684 
687 
690 
693 
695  moOutlets m_Outlets;
696 
698  moInlets m_Inlets;
699 
704 
706 
708 
709  protected:
710 
711 
717  int luaPushDebugString(moLuaVirtualMachine& vm);
719 
721  int luaGetResourceManager(moLuaVirtualMachine& vm);
722 
724  int luaSetPreconf(moLuaVirtualMachine& vm);
726  int luaGetPreconf(moLuaVirtualMachine& vm);
727 
729  int luaGetParamIndex(moLuaVirtualMachine& vm);
730 
732  int luaGetCurrentValue(moLuaVirtualMachine& vm);
734  int luaSetCurrentValue(moLuaVirtualMachine& vm);
736  int luaGetValuesCount(moLuaVirtualMachine& vm);
737 
739  int luaGetInletIndex(moLuaVirtualMachine& vm);
741  int luaGetInletData(moLuaVirtualMachine& vm);
743  int luaSetInletData(moLuaVirtualMachine& vm);
744 
745 #ifdef USE_TUIO
746  int luaGetTuioSystem(moLuaVirtualMachine& vm);
750  int luaGetTuioCursorCount(moLuaVirtualMachine& vm);
751  int luaGetTuioCursor(moLuaVirtualMachine& vm);
752  int luaGetTuioObjectCount(moLuaVirtualMachine& vm);
753  int luaGetTuioObject(moLuaVirtualMachine& vm);
754 #endif
755 
756  int luaGetTrackerSystemData(moLuaVirtualMachine& vm);
757  int luaGetTrackerFeaturesCount(moLuaVirtualMachine& vm);
758  int luaGetTrackerValidFeatures(moLuaVirtualMachine& vm);
759  int luaGetTrackerFeature(moLuaVirtualMachine& vm);
760  int luaGetTrackerVariance(moLuaVirtualMachine& vm);
761  int luaGetTrackerBarycenter(moLuaVirtualMachine& vm);
762  int luaGetTrackerAcceleration(moLuaVirtualMachine& vm);
763  int luaGetTrackerVelocity(moLuaVirtualMachine& vm);
764  int luaGetTrackerZone(moLuaVirtualMachine& vm);
765 
766  int luaGetTrackerHistory(moLuaVirtualMachine& vm);
767  int luaStartTrackerHistory(moLuaVirtualMachine& vm);
768  int luaPauseTrackerHistory(moLuaVirtualMachine& vm);
769  int luaContinueTrackerHistory(moLuaVirtualMachine& vm);
770  int luaStopTrackerHistory(moLuaVirtualMachine& vm);
772  int luaGetHistoryRecord(moLuaVirtualMachine& vm);
773  int luaGetHistoryBarycenter(moLuaVirtualMachine& vm);
775  int luaGetHistoryVariance(moLuaVirtualMachine& vm);
777  int luaGetHistoryBounding(moLuaVirtualMachine& vm);
779  int luaGetHistoryAverage(moLuaVirtualMachine& vm);
781  int luaGetHistoryMinMax(moLuaVirtualMachine& vm);
782 
786 };
787 
789 
790 #include "moResourceManager.h"
791 
792 #endif
793 
794 
MOswitch m_Activated
moText m_FullJSON
activo al iniciar el proyecto
MOint GetParamIndex() const
moTypes MOint p_paramindex
Definition: all_f.js:18
moMoldeoObjectType
Tipos de objetos en Moldeo.
Definition: moTypes.h:525
moText m_MoldeoLabelName
Identificador de objeto Moldeo.
bool IsValid() const
Objeto válido.
moOutlets m_Outlets
Conectores de salida, Arreglo de moOutlet's.
moMoldeoObjectType m_Type
Etiqueta o Identificador de texto de este objeto.
const moText & GetLabelName() const
void SetName(const moText &p_name)
Conector Inlet, conector que recibe datos.
Definition: moConnectors.h:374
virtual MOboolean Finish()
Finaliza el objeto, libera recursos.
Definition: moAbstract.cpp:147
const moText & GetDescription() const
Devuelve al descripción del objeto.
#define MOboolean
Definition: moTypes.h:385
bool m_Activate
nombre de la tecla que activa el objeto
const moText & GetDescription() const
Devuelve al descripción del objeto.
const moText & GetName() const
moText m_Description
Nombre del archivo de configuración.
virtual void SetConsoleValueIndex(MOint p_valueindex)
moMobIndex(MOint p_paramindex, MOint p_valueindex)
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
#define MOswitch
Definition: moTypes.h:386
moInlets m_Inlets
Conectores de entrada, Arreglo de moInlet's.
#define LIBMOLDEO_API
Definition: moTypes.h:180
definición de todos los parámetros a encontrar o a crear dentro del moConfig
Definition: moConfig.h:57
moInlet * InletScreenHeight
Lista de eventos.
Definition: moEventList.h:139
clase de para manejar textos
Definition: moText.h:75
moInlet * InletPreconfig
moResourceManager * m_pResourceManager
Puntero al administrador de recursos.
void SetParamIndex(MOint p_paramindex)
Clase Base Descriptiva de un Objeto Moldeo.
moText m_ConfigName
Nombre del objeto (relativo a la clase)
void SetMoldeoFatherId(MOint p_moldeoid)
Fija el identificador del padre de este objeto.
moText0 moText
Definition: moText.h:291
const moMobDefinition & GetMobDefinition() const
moConfig m_Config
Configuración de parámetros del objeto.
moMobState m_MobState
Moldeo Object State.
#define MOint
Definition: moTypes.h:388
MOint GetMoldeoFatherId() const
Devuelve el identificador del padre de este objeto.
MOswitch m_Selected
moInlet * InletTimeabs
void SetDescription(const moText &p_Description)
Fija la descripción de este objeto.
virtual int ScriptCalling(moLuaVirtualMachine &vm, int iFunctionNumber)=0
Clase Base para Objetos Moldeo ( moEffect, moIODevice, moResource, moConsole )
MOboolean m_bConnectorsLoaded
moDeclareExportedDynamicArray(moMoldeoObject *, moMoldeoObjects)
LIBMOLDEO_API moMoldeoObjectType moGetStrType(const moText &p_Str)
Administrador de recursos.
void SetKeyName(const moText &p_keyname)
void SetLabelName(const moText &p_labelname)
moConfig * GetConfig()
moInlet * InletScreenWidth
moText m_MoldeoFatherLabelName
void SetValueIndex(MOint p_valueindex)
moMobDefinition m_MobDefinition
Definición del objeto.
moMatrix3 & operator=(const moMatrix3 &rkM)
const moText & GetConfigName() const
moMobDefinition(const moText &p_name, const moText &p_configname, moMoldeoObjectType p_type, const moText &p_labelname, MOint p_moldeoid=-1, const moMobIndex &p_MobIndex=moMobIndex(-1,-1))
Constructor.
virtual void SetConsoleParamIndex(MOint p_paramindex)
MOint GetValueIndex() const
void SetMobDefinition(const moMobDefinition &p_MobDef)
const moText & GetKeyName() const
Devuelve la etiqueta del padre de este objeto.
const moText & GetKeyName() const
moMobIndex m_MobIndex
Descripción del objeto.
const moText & GetFatherLabelName() const
Devuelve la etiqueta del padre de este objeto.
moText m_Name
Tipo de Objeto.
bool GetActivate() const
Devuelve el modo de activación al inicio del proyecto.
virtual ~moMobIndex()
moText m_KeyName
Índice referente al archivo de configuración que describe a este objeto.
moMobIndex(const moMobIndex &src)
virtual void HandleReturns(moLuaVirtualMachine &vm, const char *strFunc)=0
moText m_FullJSON
almacena la configuración de los parámetros de un objeto en un archivo XML
Definition: moConfig.h:193
Indice referente a la descripción del objeto en un archivo de configuración.