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
moTimeManager.cpp
Ir a la documentación de este archivo.
1 /*******************************************************************************
2 
3  moTimeManager.cpp
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 #include "moTimeManager.h"
33 
34 
35 //===========================================
36 //
37 // moTimeManager
38 //
39 //===========================================
40 
41 MOuint
43 
44  return moGetTicks();
45 
46 }
47 
51  SetName("Time Manager");
52 }
53 
55 
56 }
57 
59  m_Timers.Init( 0, NULL );
60  return true;
61 }
62 
64  return true;
65 }
66 
68  moTimer* newtimer = new moTimer();
69  m_Timers.Add( newtimer );
70  return newtimer;
71 }
72 
73 void moTimeManager::AddTimer( moTimer* pTimer ) {
74  m_Timers.Add( pTimer );
75 
76 }
77 
79 
80  for( MOuint i=0; i<m_Timers.Count(); i++ ) {
82  moTimer* pTimer = m_Timers[i];
83 
84  if (pTimer) {
85 
86  pTimer->Fix();
87 
88  }
89 
90  }
91 
92 }
93 
94 void moTimeManager::SetDuration( MOulong p_timecode ) {
95 
96  moSetDuration( p_timecode );
97  FixTimers();
98 
99 }
100 
101 
102 void moTimeManager::ClearByObjectId( long p_objectid ) {
103 
104  int max = m_Timers.Count();
105 
106  for( int i=0; i<max; i++ ) {
108  moTimer* pTimer = m_Timers[i];
109 
110  if ( pTimer && pTimer->GetObjectId()==p_objectid ) {
111 
112  m_Timers.Remove(i);
113  max--;
114 
115  }
116 
117  }
118 
119 
120 }
121 
122 
123 void moTimeManager::ClearByTimerId( long p_timerid ) {
124 
125  int max = m_Timers.Count();
126 
127  for( int i=0; i<max; i++ ) {
129  moTimer* pTimer = m_Timers[i];
130 
131  if ( pTimer && pTimer->GetTimerId()==p_timerid ) {
132 
133  m_Timers.Remove(i);
134  max--;
135 
136  }
137 
138  }
139 
140 }
141 
142 void moTimeManager::FixByObjectId( long p_objectid ) {
143 
144  int max = m_Timers.Count();
145 
146  for( int i=0; i<max; i++ ) {
148  moTimer* pTimer = m_Timers[i];
149 
150  if ( pTimer && pTimer->GetObjectId()==p_objectid ) {
151 
152  pTimer->Fix();
153 
154  }
155 
156  }
157 
158 }
159 
#define MOulong
Definition: moTypes.h:392
void SetName(const moText &p_name)
virtual ~moTimeManager()
Destructor.
void ClearByObjectId(long p_objectid)
Elimina los temporizadores asociados a cierto identificador de un objeto.
#define MOboolean
Definition: moTypes.h:385
void SetDuration(MOulong p_timecode)
modifica los temporizadores para adecuarse al cambio ocurrido en el temporizador absoluto...
void FixTimers()
agrega un temporizador para ser manipulado
void SetResourceType(moResourceType p_restype)
virtual MOboolean Finish()
Finalización.
moTimers m_Timers
Devuelve el puntero al temporizador global.
static MOuint GetTicks()
Devuelve los milisegundos del reloj de la máquina.
Dispositivo de entrada/salida, típicamente, interfaces humanas de IO y datos ( teclado, mouse, tableta, tcp, udp, serial )
Definition: moTypes.h:532
moTypes MOint moText moParamIndex moParamReference int iRow int int i int i
Definition: all_f.js:18
void Fix()
Corrige el reloj.
Definition: moTimer.cpp:262
void moSetDuration(MOulong p_timecode)
Fija el valor del reloj del temporizador global.
Definition: moTimer.cpp:128
void ClearByTimerId(long p_timerid)
Elimina los temporizadores por su identificador interno.
a max
Definition: jquery.js:72
void AddTimer(moTimer *pTimer)
Agrega un nuevo temporizador (relativo)
moTimeManager()
Constructor.
virtual MOboolean Init()
Inicialización.
Clase para el control de un temporizador (relativo) con identificación.
Definition: moTimer.h:321
#define MOuint
Definition: moTypes.h:387
void FixByObjectId(long p_objectid)
Corrige los temporizadores por el identificador del objeto asociado.
long GetTimerId()
Devuelve el valor del identificador interno del temporizador.
Definition: moTimer.h:381
long GetObjectId()
Devuelve el valor del identificador interno del objeto asociado.
Definition: moTimer.h:399
moTimer * NewTimer()
Crea un nuevo temporizador (relativo)
void SetType(moMoldeoObjectType p_type)
MOulong moGetTicks()
Devuelve en milisegundos el valor del reloj de Moldeo.
Definition: moTimer.cpp:138