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
moConfig.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moConfig.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 #include "moTypes.h"
32 #include <tinyxml.h>
33 
34 #include "moConfig.h"
35 
36 #include "moFileManager.h"
37 #include "moFontManager.h"
38 #include "moTextureManager.h"
39 #include "mo3dModelManager.h"
40 #include "moSoundManager.h"
41 #include "moDebugManager.h"
42 
43 moFont* moConfig::m_pFont = new moFont();
44 moMathFunction* moConfig::m_pFun = new moParserFunction();
45 moTextureBuffer* moConfig::m_pTextureBuffer = new moTextureBuffer();
46 moSceneNode* moConfig::m_pModel = new moSceneNode();
47 moVector2d* moConfig::m_pVector2d = new moVector2d();
48 moVector2i* moConfig::m_pVector2i = new moVector2i();
49 moVector3d* moConfig::m_pVector3d = new moVector3d();
50 moVector3i* moConfig::m_pVector3i = new moVector3i();
51 moVector4d* moConfig::m_pVector4d = new moVector4d();
52 moVector4i* moConfig::m_pVector4i = new moVector4i();
53 moDataMessage* moConfig::m_pMessage = new moDataMessage();
54 moDataMessages* moConfig::m_pMessages = new moDataMessages();
55 moSound* moConfig::m_pSound = new moSound();
56 moTexture* moConfig::m_pTexture = new moTexture();
57 
58 //================================================================
59 // moConfigDefinition
60 //================================================================
61 
63 
64 }
65 
67 }
68 
71  (*this) = p_src;
72 }
73 
77 
78  (moAbstract)(*this) = (moAbstract) p_src;
79  m_ParamDefinitions = p_src.m_ParamDefinitions;
80  m_ParamIndexes = p_src.m_ParamIndexes;
81  m_ObjectName = p_src.m_ObjectName;
82  m_ObjectClass = p_src.m_ObjectClass;
83  m_FullJSON = p_src.m_FullJSON;
84 
85  return (*this);
86 }
87 
88 bool
90  for( MOuint i = 0; i < m_ParamDefinitions.Count(); i++ ) {
91  moParamDefinition pdef = m_ParamDefinitions[i];
92  if ( pdef.GetName() == p_name )
93  return true;
94  }
95  return false;
96 }
97 
98 const moParamDefinition&
100 
101  MOuint i = 0;
102 
103  for( i = 0; i < m_ParamDefinitions.Count(); i++ ) {
104  moParamDefinition& pdef( m_ParamDefinitions[i] );
105  if ( pdef.GetName() == p_param_name )
106  return m_ParamDefinitions[i];
107  }
108 
109  return m_ParamDefinitions.Get(-1);
110 }
111 
112 
113 bool
115 
116  bool founded;
117  moParamDefinition pdef;
118 
119  founded = false;
120 
121  for( MOuint i = 0; i < m_ParamDefinitions.Count(); i++ ) {
122  pdef = m_ParamDefinitions[i];
123  if ( pdef.GetName() == p_name ) {
124  founded = true;
125  break;
126  }
127  }
128 
129  if (founded) {
130  pdef.SetIndex( p_index );
131  m_ParamIndexes.Add( p_index );
132  }
133 
134  return founded;
135 }
136 
137 
138 void
139 moConfigDefinition::Add( const moText& p_name, moParamType p_type, int p_index, const moValue& p_defaultvalue, const moText& p_OptionsStr ) {
140 
141  if ( Exists(p_name) ) {
142  MODebug2->Error( p_name + " already defined in " + m_ObjectName );
143  return;
144  }
145 
146  moParamDefinition pdef( p_name, p_type );
147 
148  pdef.SetIndex( p_index );
149 
150  if (p_type!=MO_PARAM_MOLDEO_OBJECT)
151  pdef.SetDefault( p_defaultvalue );
152 
153  pdef.SetOptions(p_OptionsStr);
154 
155  //IF TYPE IS COLOR > sub 0: RED, 1: GREEN, 2: BLUE, 3: ALPHA
156  if (p_type==MO_PARAM_COLOR) {
159  vd.SetCodeName( "RED" );
160  pdef.GetDefaultValue().GetSubValue((int)MO_RED).SetValueDefinition(vd);
161 
163  vd.SetCodeName( "GREEN" );
164  pdef.GetDefaultValue().GetSubValue((int)MO_GREEN).SetValueDefinition(vd);
165 
167  vd.SetCodeName( "BLUE" );
168  pdef.GetDefaultValue().GetSubValue((int)MO_BLUE).SetValueDefinition(vd);
169 
171  vd.SetCodeName( "ALPHA" );
172  pdef.GetDefaultValue().GetSubValue((int)MO_ALPHA).SetValueDefinition(vd);
173 
174  /*
175  p_defaultvalue.GetSubValue(MO_GREEN).GetValueDefinition().SetCodeName( "GREEN" );
176  p_defaultvalue.GetSubValue(MO_BLUE).GetValueDefinition().SetCodeName( "BLUE" );
177  p_defaultvalue.GetSubValue(MO_ALPHA).GetValueDefinition().SetCodeName( "ALPHA" );
178  */
179  }
180 
181  if (p_type==MO_PARAM_FONT) {
182  //p_defaultvalue.GetSubValue(0).GetValueDefinition().SetCodeName( "RED" );
183  }
184 
185  m_ParamDefinitions.Add( pdef );
186 
187  m_ParamIndexes.Add( p_index );
188 }
189 
190 /*
191 void
192 moConfigDefinition::Add( moText p_name, moParamType p_type , MOint p_index) {
193 
194  if ( Exists(p_name) ) {
195  MODebug2->Error( p_name + " already defined in " + m_ObjectName );
196  return;
197  }
198 
199  moParamDefinition pdef( p_name, p_type );
200 
201  pdef.SetIndex( p_index );
202 
203  m_ParamDefinitions.Add( pdef );
204 
205  ATENCION!!!! si p_index no coincide con el indice real de la entrada d el array de m_ParamIndexes....
206  entonces no funcionará.... hay que evitar este problema....
207  sobre todo y tambien si no se llama en el orden correcto.
208 
209  soluciones:
210 
211  Espera que las sucesivas llamadas se hagan correctamente.
212  Si el siguiente indice no coincide...
213 
214 
215 
216 
217  m_ParamIndexes.Add( p_index );
218 
219 }
220 */
221 
222 bool
223 moConfigDefinition::SetParamIndex( int defined_array_index, moParamIndex paramindex ) {
224 
225  if (defined_array_index==-1) {
226  MODebug2->Error("moConfigDefinition::SetParamIndex in [" + m_ObjectName + "] > defined array entry index is -1 (undefined).");
227  return false;
228  }
229 
230  if ( ! ( 0 <= defined_array_index && defined_array_index < (int)m_ParamIndexes.Count()) ) {
231  /*MODebug2->Message( moText("WARNING!! moConfigDefinition::SetParamIndex[" + m_ObjectName + "] > defined array entry index not in range : ")
232  + IntToStr(defined_array_index)
233  + moText(" Max Indexes : ")
234  + IntToStr(m_ParamIndexes.Count()) );*/
235  MODebug2->Warning( moText("Extra parameters must be defined at the end of config file. \"") + m_ObjectName + moText("\""));
236  MODebug2->Message( this->ToJSON() );
237  return false;
238  }
239 
240  if (paramindex.index==MO_PARAM_NOT_FOUND) {
241  MODebug2->Error( moText("moConfigDefinition::SetParamIndex[" + m_ObjectName + "] > moParamIndex undefined : ")
242  + IntToStr(paramindex.index) );
243  return false;
244  }
245 
246  m_ParamIndexes.Set( defined_array_index , paramindex );
247  return true;
248 
249 }
250 
251 const moText&
253 
254  moText fieldSeparation = ",";
255 
256  m_FullJSON = "{";
257  m_FullJSON+= "'objectname': '" + this->m_ObjectName + "'";
258  m_FullJSON+= fieldSeparation + "'objectclass': '" + this->m_ObjectClass + "'";
259  m_FullJSON+= "}";
260 
261  return m_FullJSON;
262 }
263 
264 //================================================================
265 // moConfig ( XML Config )
266 //================================================================
267 
268 
270  m_CurrentParam = -1;
271  m_ConfigLoaded = false;
272  m_PreconfActual = -1;
273 }
274 
276 
277 }
278 
280 
281  return m_ConfigLoaded;
282 
283 }
284 
285 void
287 
288  if ( GetConfigDefinition()!=NULL) {
289 
290  for( MOuint i = 0; i < GetConfigDefinition()->GetParamDefinitions()->Count(); i++ ) {
291 
293 
294  int pidx = (MOint)GetParamIndex( pdef.GetName() );
295  if (pidx>-1) {
296  if (!GetConfigDefinition()->SetParamIndex( (int)pdef.GetIndex(), moParamIndex(pidx))) {
297  moDebugManager::Message( "moConfig::Indexation > <mo"+GetObjectClass()+"::"+GetObjectName()+"> Parameter \"" + moText(pdef.GetName()) + moText("\" warning. Bad indexation could cause errors."));
298  }
299  } else moDebugManager::Error( "moConfig::Indexation > <mo"+GetObjectClass()+"::"+GetObjectName()+"> > Parameter \"" + moText(pdef.GetName()) + moText("\" not found."));
300  }
301  }
302 }
303 
304 void
306 
309  for( MOuint j=0; j< m_ConfigDefinition.GetParamDefinitions()->Count(); j++ ) {
310  moParamDefinitions* pd = m_ConfigDefinition.GetParamDefinitions();
311  if (pd) {
312 
313  moParamDefinition pDef = pd->Get(j);
314 
315  moText paramDefName = pDef.GetName();
316  moParamType paramDefType = pDef.GetType();
317 
318  int real_idx = GetParamIndex( paramDefName );
319 
320  if (real_idx==-1) {
321 
322  CreateParam( pDef );
323 
324  } else {
325 
327  moParam& pParamLoaded( GetParam(real_idx) );
328 
329  if ( pParamLoaded.GetParamDefinition().GetType() != paramDefType ) {
331  pParamLoaded.FixType( paramDefType );
332 
333  }
335  if (pDef.GetOptions().Count()!=pParamLoaded.GetParamDefinition().GetOptions().Count()) {
336  pParamLoaded.FixOptions( pDef.GetOptions() );
337  }
338  }
339  }
340  }
341 
342 
344  for( MOuint i=0; i< m_Params.Count(); i++ ) {
345 
346  moParam& param(m_Params[i]);
347 
348  for( MOuint j=0; j< m_ConfigDefinition.GetParamDefinitions()->Count(); j++ ) {
349 
350  moParamDefinitions* pd = m_ConfigDefinition.GetParamDefinitions();
351  moParamDefinition pDef = pd->Get(j);
352 
353 
354  if (pd) {
355  if ( param.GetParamDefinition().GetName() == pDef.GetName() ) {
356  pDef.SetIndex(i);
357  pd->Set( j, pDef );
358  break;
359  }
360  }
361  }
362  param.GetParamDefinition().SetIndex(i);
363  }
364 
366  //for( MOuint i=0; i< m_Params.Count(); i++ ) {
367 
368  //moParam& param(m_Params[i]);
369 
370  for( MOuint j=0; j< m_ConfigDefinition.GetParamDefinitions()->Count(); j++ ) {
371 
372  moParamDefinitions* pd = m_ConfigDefinition.GetParamDefinitions();
373  moParamDefinition pDef = pd->Get(j);
374  int pdefindex = pDef.GetIndex();
375 
376  if (pDef.GetName()=="color") {
377  //break here
378  pDef.GetTypeStr();
379  }
380 
381  moParam& param( m_Params[pdefindex] );
382  //moValue defaultValue = param.GetParamDefinition().GetDefaultValue();
383  moValue defaultValue = pDef.GetDefaultValue();
384 
385  for( MOuint k=0; k< param.GetValuesCount(); k++ ) {
386  for( MOuint l=0; l< param.GetValue(k).GetSubValueCount(); l++ ) {
387  moValueBase &vb( param.GetValue(k).GetSubValue(l) );
388  moValueBase &dfvb( defaultValue.GetSubValue(l) );
389  //compare vb.
390  moValueDefinition vd = vb.GetValueDefinition();
391  moValueDefinition dfvd = dfvb.GetValueDefinition();
392  if(vd.GetCodeName()!=dfvd.GetCodeName())
393  vd.SetCodeName( dfvd.GetCodeName() );
394  vb.SetValueDefinition( vd );
395 
396  }
397  }
398  }
399 
400 }
401 
402 int moConfig::LoadConfig( moText p_filename ) {
403 
404  TiXmlDocument m_XMLDocument;
405  TiXmlEncoding xencoding = TIXML_ENCODING_LEGACY;
406 
407  UnloadConfig();
408 
409  //p_filename = p_filename.Replace("\\","//");
410  //p_filename = p_filename.Replace("\\\\","//");
411  p_filename.Replace("\\","/");
412 
413  if (!moFileManager::FileExists(p_filename)) {
414  moDebugManager::Error( "moConfig::LoadConfig > Error " + p_filename + " doesn't exists." );
415  }
416 
417  cout << "XML DOM about to load..." << endl;
418 
419  if (m_XMLDocument.LoadFile( (char *) p_filename, xencoding )) {
420 
421  //parse the xml for params...
422  cout << "XML DOM loaded" << endl;
423 
424  TiXmlHandle docHandle( &m_XMLDocument );
425 
426  TiXmlElement* MOCONFIG = docHandle.FirstChild( "MOCONFIG" ).Element();
427 // FirstChild( "DEFINITION" ).Child( "Child", 1 ).Element();
428  if ( MOCONFIG )
429  {
430  MOCONFIG->QueryIntAttribute( "majorversion", &((int&)m_MajorVersion));
431  MOCONFIG->QueryIntAttribute( "minorversion", &((int&)m_MinorVersion));
432 
433  TiXmlNode* NODEDEFINITION = MOCONFIG->FirstChild( "DEFINITION" );
434  TiXmlElement* DEFINITION = NULL;
435  if (NODEDEFINITION) {
436  DEFINITION = NODEDEFINITION->ToElement();
437  }
438  if (DEFINITION) {
439  moText objectname( (char*)DEFINITION->Attribute( "name" ) );
440  moText objectclass( (char*) DEFINITION->Attribute( "class" ));
441  Set( objectname, objectclass );
442  } else return MO_PARAM_NOT_FOUND;
443 
444  TiXmlNode* NODEUPDATE = MOCONFIG->FirstChild( "UPDATE" );
445  TiXmlElement* UPDATE = NULL;
446  if (NODEUPDATE) {
447  UPDATE = NODEUPDATE->ToElement();
448  if (UPDATE) {
449  moText version = UPDATE->Attribute("");
450  }
451  }
452 
453  TiXmlNode* NODECONFIGPARAMS = MOCONFIG->FirstChild( "CONFIGPARAMS" );
454  TiXmlElement* CONFIGPARAMS = NULL;
455  if (NODECONFIGPARAMS) {
456  CONFIGPARAMS = NODECONFIGPARAMS->ToElement();
457  }
458  if (CONFIGPARAMS) {
459  TiXmlNode* NODEPARAM = CONFIGPARAMS->FirstChild("PARAM");
460  TiXmlElement* PARAM = NULL;
461  if (NODEPARAM) {
462  PARAM = NODEPARAM->ToElement();
463  }
464  while(PARAM) {
465  char* resStr = NULL;
466 
467  moText paramname;
468  resStr = ((char*) PARAM->Attribute( "name"));
469  if (resStr) paramname = resStr;
470 
471  moText paramtype;
472  resStr = ((char*) PARAM->Attribute( "type"));
473  if (resStr) paramtype = resStr;
474 
475  moText paramproperty;
476  resStr = ((char*) PARAM->Attribute( "property"));
477  if (resStr) paramproperty = resStr;
478 
479  moText paramgroup;
480  resStr = ((char*) PARAM->Attribute( "group"));
481  if (resStr) paramgroup = resStr;
482 
483  moText paraminterpolation;
484  resStr = ((char*) PARAM->Attribute( "interpolation"));
485  if (resStr) paraminterpolation = resStr;
486 
487  moText paramduration;
488  resStr = ((char*) PARAM->Attribute( "duration"));
489  if (resStr) paramduration = resStr;
490 
491  moText paramoptions;
492  resStr = ((char*) PARAM->Attribute( "options"));
493  if (resStr) paramoptions = resStr;
494 
495  /*cout << endl << "moConfig::LoadConfig > name: " << paramname << " paraminterpolation: " << paraminterpolation << endl;*/
496  moParamDefinition definition( paramname, paramtype, paramproperty, paramgroup, paraminterpolation, paramduration, paramoptions );
497  moParam xparam( definition );
498 
499  TiXmlElement* VALUE = NULL;
500  TiXmlNode* NODE = PARAM->FirstChild("VAL");
501  if (NODE) {
502  VALUE = NODE->ToElement();
503  }
504  while(VALUE) {
505 
506  TiXmlElement* VALUEDATA = NULL;
507  TiXmlNode* NODEDATA = VALUE->FirstChild("D");
508  if (NODEDATA) VALUEDATA = NODEDATA->ToElement();
509 
510  if (VALUEDATA) {
511  moText valuetype( (char*) VALUEDATA->Attribute("type") );
512  moText valuecodename( (char*) VALUEDATA->Attribute("code") );
513  moText valueattribute( (char*) VALUEDATA->Attribute("attribute") );
514  moText valuemin( (char*) VALUEDATA->Attribute("min") );
515  moText valuemax( (char*) VALUEDATA->Attribute("max") );
516  moText valuedata( (char*) VALUEDATA->GetText() );
517 
518  if (valuetype=="XML") {
519  TiXmlPrinter printer;
520  TiXmlNode* NODEDATAXML = VALUEDATA->FirstChild();
521  if (NODEDATAXML) {
522  NODEDATAXML->Accept( &printer );
523  valuedata = moText( printer.CStr() );
524  }
525  }
526 
527  moValue xvalue( valuedata, valuetype );
528 
529  moValueBase& xvbase( xvalue.GetLastSubValue() );
530 
531  xvbase.SetCodeName( valuecodename );
532  xvbase.SetAttribute( valueattribute );
533  xvbase.SetRange( valuemin, valuemax );
535  // SetSelect ???
536 
537  VALUEDATA = VALUEDATA->NextSiblingElement("D");
538 
539  while( VALUEDATA ) {
540  //.... ;
541  moText subvaluetype( (char*) VALUEDATA->Attribute("type") );
542  moText subvaluecodename( (char*) VALUEDATA->Attribute("code") );
543  moText subvalueattribute( (char*) VALUEDATA->Attribute("attribute") );
544  moText subvaluemin( (char*) VALUEDATA->Attribute("min") );
545  moText subvaluemax( (char*) VALUEDATA->Attribute("max") );
546  moText subvaluedata( (char*) VALUEDATA->GetText() );
547 
548  if (subvaluetype=="XML") {
549  TiXmlPrinter printer;
550  TiXmlNode* NODEDATAXML = VALUEDATA->FirstChild();
551  if (NODEDATAXML) {
552  NODEDATAXML->Accept( &printer );
553  subvaluedata = moText( printer.CStr() );
554  }
555  }
556 
557  xvalue.AddSubValue( subvaluedata, subvaluetype );
558 
559  moValueBase& xxvbase( xvalue.GetLastSubValue() );
560 
561  xxvbase.SetCodeName( subvaluecodename );
562  xxvbase.SetAttribute( subvalueattribute );
563  xxvbase.SetRange( subvaluemin, subvaluemax );
564 
565  VALUEDATA = VALUEDATA->NextSiblingElement("D");
566  }
567 
568  xparam.AddValue( xvalue );
569  }
570  VALUE = VALUE->NextSiblingElement("VAL");
571  }
572 
573  xparam.FirstValue();
574 
575  m_Params.Add( xparam );
576 
577  PARAM = PARAM->NextSiblingElement("PARAM");
578  }
579 
580  }
581 
582  TiXmlNode* PRECONFIGSNODE = MOCONFIG->FirstChild( "PRECONFIGS" );
583  TiXmlElement* PRECONFIGS = NULL;
584  if (PRECONFIGSNODE) {
585  PRECONFIGS = PRECONFIGSNODE->ToElement();
586  }
587  if (PRECONFIGS) {
588 
589  moPreConfig PreConfig;
590 
591  TiXmlNode* PRECONFIGNODE = PRECONFIGS->FirstChild("PRE");
592  TiXmlElement* PRECONFIG = NULL;
593  if (PRECONFIGNODE) {
594  PRECONFIG = PRECONFIGNODE->ToElement();
595  }
596  while(PRECONFIG) {
597 
598  TiXmlElement* PREVALUE = NULL;
599  TiXmlNode* NODE = PRECONFIG->FirstChild("P");
600  //PreConfig.m_ValueIndexes.Empty();
601  PreConfig.m_PreconfIndexes.Empty();
602  PreConfig.m_Name = moText((char*) PRECONFIG->Attribute( "name"));
603 
604  if (NODE) {
605  PREVALUE = NODE->ToElement();
606  }
607  while(PREVALUE) {
608 
609  moPreconfigParamIndex VIndex;
610 
611  moText paramname((char*) PREVALUE->Attribute( "name"));
612  moValue Value( moText((char*) PREVALUE->GetText()) , moText("INT") );
613 
614  VIndex.m_ParamName = paramname;
615  VIndex.m_ParamIndex = GetParamIndex(paramname);
616  VIndex.m_ValueIndex = Value.GetSubValue().Int();
617 
618  PreConfig.m_PreconfIndexes.Add( VIndex );
619  PREVALUE = PREVALUE->NextSiblingElement("P");
620 
621  }
622 
623  m_PreConfigs.Add( PreConfig );
624  PRECONFIG = PRECONFIG->NextSiblingElement("PRE");
625  }
626 
627  }
628 
629  FirstParam();
630  PreConfFirst();
631  m_FileName = p_filename;
632  m_ConfigLoaded = true;
633 
635  FixConfig();
636 
637  return MO_CONFIG_OK;
638 
639 
640  }
641 
642  } else {
643  if (m_XMLDocument.Error()) {
644  moDebugManager::Error( moText("XML ERROR:") + p_filename+moText(" XML error:") + moText(m_XMLDocument.ErrorDesc()) );
645  }
647  }
648  m_ConfigLoaded = false;
649  return -1;
650 }
651 
652 int moConfig::SaveConfig( moText p_filename ) {
653  moText TNodeValue;
654 
655  if (p_filename.Length()==0) {
656  p_filename = this->m_FileName;
657  }
658 
659  cout << "moConfig::SaveConfig > filename is " << p_filename << endl;
660 
661 
662  //chequear si existe el archivo?
663  TiXmlDocument m_XMLDocument( p_filename );
664 
665  TiXmlDeclaration * DECL = new TiXmlDeclaration( "1.0", "ISO-8859-1", "" );
666  m_XMLDocument.LinkEndChild( DECL );
667 
668  TiXmlElement * MOCONFIG = new TiXmlElement( "MOCONFIG" );
669 
670  if ( MOCONFIG )
671  {
672  MOCONFIG->SetAttribute( "majorversion", m_MajorVersion);
673  MOCONFIG->SetAttribute( "minorversion", m_MinorVersion);
674 
675  TiXmlElement* DEFINITION = new TiXmlElement( "DEFINITION" );
676  if (DEFINITION) {
677  DEFINITION->SetAttribute( "name", GetObjectName() );
678  DEFINITION->SetAttribute( "class", GetObjectClass() );
679  }
680  MOCONFIG->LinkEndChild(DEFINITION);
681 
682  TiXmlElement* UPDATE = new TiXmlElement( "UPDATE" );
683  MOCONFIG->LinkEndChild(UPDATE);
684 
685  TiXmlElement* CONFIGPARAMS = new TiXmlElement( "CONFIGPARAMS" );
686  if (CONFIGPARAMS) {
687 
688  for( int p = 0; p< (int)m_Params.Count(); p++ ) {
689 
690  //proximo parámetro
691  moParam& xparam( m_Params[p] );
692  moParamDefinition definition = xparam.GetParamDefinition();
693 
694  TiXmlElement* PARAM = new TiXmlElement( "PARAM" );
695  if (PARAM) {
696 
697  PARAM->SetAttribute( "name" , definition.GetName() );
698  PARAM->SetAttribute( "type" , definition.GetTypeStr() );
699 
700  if (definition.GetProperty().Length()) PARAM->SetAttribute( "property", definition.GetProperty() );
701  if (definition.GetGroup().Length()) PARAM->SetAttribute( "group", definition.GetGroup() );
702  if (definition.GetTypeStr().Length()) PARAM->SetAttribute( "type" , definition.GetTypeStr() );
703  if (definition.GetOptionsStr().Length()) PARAM->SetAttribute( "options" , definition.GetOptionsStr() );
704 
705  if (definition.GetInterpolation().GetFunctionToText()!=moText("none") ) {
706 
707  PARAM->SetAttribute( "interpolation" , definition.GetInterpolation().GetFunctionToText() );
708  PARAM->SetAttribute( "duration" , IntToStr( definition.GetInterpolation().GetDuration() ) );
709 
710  }
711 
712  for( int v = 0; v< (int)xparam.GetValuesCount(); v++ ) {
713 
714  //proximo valor
715  moValue &xvalue( xparam.GetValue(v) );
716 
717  TiXmlElement* VALUE = new TiXmlElement("VAL");
718  if (VALUE) {
719  for( int s = 0; s< (int)xvalue.GetSubValueCount(); s++ ) {
720 
721  //proximo subvalor
722  moValueBase& xvaluedata( xvalue.GetSubValue(s) );
723 
724  TiXmlElement* VALUEDATA = new TiXmlElement("D");
725  if (VALUEDATA) {
726 
727  VALUEDATA->SetAttribute( "type" , xvaluedata.GetTypeStr() );
728 
729  moText valuecodename = xvaluedata.GetValueDefinition().GetCodeName();
730  moText valueattribute = xvaluedata.GetValueDefinition().GetAttribute();
731  MOfloat valuemin, valuemax;
732  xvaluedata.GetRange( &valuemin, &valuemax );
733 
734  if ( valuecodename !=moText("") ) VALUEDATA->SetAttribute( "code" , valuecodename );
735  if ( valueattribute !=moText("") ) VALUEDATA->SetAttribute( "attribute" , valueattribute );
736  if ( valuemin != valuemax ) {
737  VALUEDATA->SetAttribute( "min" , FloatToStr( valuemin ) );
738  VALUEDATA->SetAttribute( "max" , FloatToStr( valuemax ) );
739  }
740  if (xvaluedata.GetTypeStr()=="XML") {
741  TiXmlDocument XMLDoc;
742  TiXmlEncoding xencoding = TIXML_ENCODING_LEGACY;
743  XMLDoc.Parse((const char*) xvaluedata.Text(), 0, xencoding );
744  TiXmlElement* rootKey = XMLDoc.FirstChildElement( "D" );
745  TiXmlNode* XMLC;
746 
747  if (rootKey==NULL) {
748  XMLC = XMLDoc.FirstChild();
749  } else XMLC = rootKey->FirstChild();
750 
752  while(XMLC) {
753  TNodeValue = XMLC->Value();
754  VALUEDATA->InsertEndChild( *XMLC );
755  XMLC = XMLC->NextSibling();
756  }
757  } else {
758  TiXmlText * datatext = new TiXmlText( xvaluedata.ToText() );
759  VALUEDATA->LinkEndChild( datatext );
760  }
761 
762 
763  }
764  VALUE->LinkEndChild( VALUEDATA );
765  }
766  }
767  PARAM->LinkEndChild(VALUE);
768  }
769  }
770  CONFIGPARAMS->LinkEndChild( PARAM );
771  }
772  }
773  MOCONFIG->LinkEndChild( CONFIGPARAMS );
774 
775 
776  TiXmlElement* PRECONFIGS = new TiXmlElement( "PRECONFIGS" );
777  if (PRECONFIGS) {
778 
779  for( int pc=0; pc< (int)m_PreConfigs.Count(); pc++) {
780 
781  moPreConfig& xPreConfig( m_PreConfigs[pc] );
782 
783  TiXmlElement* PRECONFIG = new TiXmlElement("PRE");
784  if (PRECONFIG) {
785 
786  for( int pv=0; pv< (int)xPreConfig.m_PreconfIndexes.Count(); pv++) {
787 
788  moPreconfigParamIndex xPreIndex = xPreConfig[pv];
789 
790  TiXmlElement* PREVALUE = new TiXmlElement("P");
791 
792  if (PREVALUE) {
793 
794 
795  PREVALUE->SetAttribute( "name", GetParam( xPreIndex.m_ParamIndex ).GetParamDefinition().GetName() );
796 
797  TiXmlText * datatext = new TiXmlText( IntToStr(xPreIndex.m_ValueIndex) );
798 
799  if (datatext)
800  PREVALUE->LinkEndChild( datatext );
801 
802  }
803  PRECONFIG->LinkEndChild( PREVALUE );
804  }
805  PRECONFIGS->LinkEndChild( PRECONFIG );
806  }
807  }
808  MOCONFIG->LinkEndChild( PRECONFIGS );
809  }
810  m_XMLDocument.LinkEndChild( MOCONFIG );
811  }
812 
813  cout << "moConfig::SaveConfig > saving file to " << p_filename << endl;
814  if (m_XMLDocument.SaveFile( p_filename )) {
815  cout << "moConfig::SaveConfig > success " << endl;
816  m_FileName = p_filename;
817  return MO_CONFIG_OK;
818  } else {
819  cout << "moConfig::SaveConfig > ERROR " << endl;
820  return -1;
821  }
822 
823 }
824 
825 void
826 moConfig::CreateParam( moParamDefinition& p_ParamDef ) {
827 
828  moParam xparam( p_ParamDef );
829 
832  if ( p_ParamDef.GetDefaultValue().GetSubValueCount()>0
833  &&
834  p_ParamDef.GetDefaultValue().GetSubValue(0).GetTypeStr()!="UNDEFINED" ) {
835  xparam.AddValue( p_ParamDef.GetDefaultValue() );
836  } else {
837  xparam.SetDefaultValue();
838  }
839  m_Params.Add( xparam );
840 
842  moParam& pParam( m_Params[m_Params.Count()-1] );
843  pParam.GetParamDefinition().SetIndex(m_Params.Count()-1);
844  p_ParamDef.SetIndex(m_Params.Count()-1);
845 }
846 
847 MOboolean
848 moConfig::CreateDefault( const moText &p_fullconfigfilename ) {
849 
850  moFile cFile( p_fullconfigfilename );
851 
852  moText pt;
853  pt = p_fullconfigfilename;
854 
856  if (cFile.Exists()) {
857  cout << "moConfig::CreateDefault > file already exists " << pt << endl;
858  return false;
859  }
860 
861  if (this->IsConfigLoaded()) {
862  cout << "moConfig::CreateDefault > config has information already (is loaded) " << endl;
863  return false;
864  }
865 
866  //crea los parámetros en función de las definiciones, con valores por default...
867  moParamDefinitions* pParamDefinitions = NULL;
868 
869  pParamDefinitions = this->GetConfigDefinition()->GetParamDefinitions();
870 
871  if (pParamDefinitions) {
872 
873  this->UnloadConfig();
874 
875  cout << "moConfig::CreateDefault > Loading default ParamDefinition in moConfig : number of params : " << pParamDefinitions->Count() << endl;
876  for(int i=0; i<(int)pParamDefinitions->Count() ; i++) {
877 
878  moParamDefinition pParamDefinition = pParamDefinitions->Get(i);
879 
880  CreateParam( pParamDefinition );
881  }
882 
883  cout << "moConfig::CreateDefault > Saving Config to disk..." << endl;
884  if (SaveConfig( pt )==MO_CONFIG_OK) {
885  cout << "moConfig::CreateDefault > Saved Config Succesfully " << endl;
886  return true;
887  }
888  cout << "moConfig::CreateDefault > Error Saving Config to disk " << endl;
889 
890  }
891 
892  cout << "moConfig::CreateDefault > Errors occured " << endl;
893  return false;
894 
895 }
896 
897 void
899 
900  m_Params.Empty();
901 
902  m_ConfigLoaded = false;
903 
904 }
905 
907 
908  UnloadConfig();
909 
910 }
911 
912 moText
914 /*
915  moText linebr,tab;
916 
917  tab = "\t";
918  linebr = "\n";
919 
920  if (m_ConfigLoaded) {
921 
922  MOuint p,v,s;
923  moText fulltext,indent;
924 
925  fulltext = "<?xml version=\"1.0\" standalone=no>";
926  fulltext+=linebr;
927  fulltext+= "<!-- Console version 0.7 -->";
928  fulltext+=linebr;
929  fulltext+= "<MOCONFIG majorversion=\"1\" minorversion=\"1\">";
930  fulltext+=linebr;
931  fulltext+= "<DEFINITION name=\"objectname\" class=\"classobject\">descripcion</DEFINITION>";
932  fulltext+=linebr;
933  fulltext+="<UPDATE day=\"--/--/2007\" hour=\"00:00:00\">--/--/---- --:--:--</UPDATE>";
934  fulltext+=linebr;
935  fulltext+= "<CONFIGPARAMS>";
936  fulltext+=linebr;
937  for( p=0; p<(MOuint)GetParamsCount(); p++ ) {
938  fulltext+= tab + "<PARAM name=\""+GetParam(p).GetParamDefinition().GetName()+"\" type=\""+GetParam(p).GetParamDefinition().GetTypeStr()+"\">";
939  fulltext+=linebr;
940  for( v=0; v< GetParam(p).GetValuesCount(); v++) {
941  fulltext+= tab + tab +"<VAL>";
942  for( s=0; s< GetParam(p).GetValue(v).GetSubValueCount(); s++) {
943  fulltext+= "<D type=\""+GetParam(p).GetValue(v).GetSubValue(s).GetTypeStr()+"\">";
944  fulltext+= GetParam(p).GetValue(v).GetSubValue(s).Text();
945  fulltext+= "</D>";
946  }
947  fulltext+= "</VAL>";
948  fulltext+=linebr;
949  }
950  fulltext+= tab + "</PARAM>";
951  fulltext+=linebr;
952  }
953  fulltext+= "</CONFIGPARAMS>";
954  fulltext+=linebr;
955  fulltext+= "<PRECONFIGS>";
956  fulltext+=linebr;
957  for( p=0; p<m_PreConfigs.Count(); p++ ) {
958  fulltext+= tab + "<PRE>";
959  for( v=0; v<m_PreConfigs[p].m_ValueIndexes.Count(); v++ ) {
960  fulltext+= "<P name=\""+GetParam(m_PreConfigs[p].m_ValueIndexes[v].m_ParamIndex).GetParamDefinition().GetName()+"\">";
961  fulltext+= IntToStr(m_PreConfigs[p].m_ValueIndexes[v].m_ParamIndex);
962  fulltext+= "</P>";
963  }
964  fulltext+= "</PRE>";
965  fulltext+=linebr;
966 
967  }
968  fulltext+= "</PRECONFIGS>";
969  fulltext+=linebr;
970  return fulltext;
971  }
972 */
973  return moText("unloaded");
974 }
975 
976 moParams&
978 
979  return m_Params;
980 
981 }
982 
983 moParam&
984 moConfig::GetParam( MOint p_paramindex ) {
985  if ( p_paramindex == -1 )
986  return m_Params[m_CurrentParam];
987  else
988  return m_Params[p_paramindex];
989 }
990 
991 moParam&
992 moConfig::GetParam( moText p_paramname ) {
993 
994  for( MOuint i=0; i< m_Params.Count(); i++ ) {
995  if ( m_Params[i].GetParamDefinition().GetName() == p_paramname ) {
996  return m_Params[i];
997  }
998  }
999  return m_Params[-1];
1000 }
1001 
1002 int
1004  return m_Params.Count();
1005 }
1006 
1007 int
1009 
1010  for( MOuint i=0; i< m_Params.Count(); i++ ) {
1011  if ( m_Params[i].GetParamDefinition().GetName() == p_paramname ) {
1012  return i;
1013  }
1014  }
1015  return (-1);
1016 }
1017 
1018 MOuint
1019 moConfig::GetValuesCount( int p_paramindex ) {
1020  return m_Params.Get( p_paramindex ).GetValuesCount();
1021 }
1022 
1023 moValue&
1024 moConfig::GetValue( moText nameparam, int indexvalue ) {
1025 
1026  moParam& param( GetParam( nameparam ));
1027 
1028  return param.GetValue( indexvalue );
1029 }
1030 
1031 moValue&
1032 moConfig::GetValue( int indexparam, int indexvalue ) {
1033 
1034  moParam& param( GetParam( indexparam ));
1035 
1036  return param.GetValue( indexvalue );
1037 
1038 }
1039 
1040 
1041 MOint
1042 moConfig::Int( moParamReference p_paramreference ) {
1043  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1044  if (param.GetData()) return param.GetData()->Int();
1045  return param.GetValue().GetSubValue().Int();
1046 }
1047 
1048 MOint
1049 moConfig::Int( moText p_param_name ) {
1050  moParam& param(GetParam(p_param_name));
1051  if (param.GetData()) return param.GetData()->Int();
1052  return param.GetValue().GetSubValue().Int();
1053 }
1054 
1055 MOdouble
1056 moConfig::Double( moParamReference p_paramreference ) {
1057  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1058  if (param.GetData()) return param.GetData()->Double();
1059  return param.GetValue().GetSubValue().Double();
1060 }
1061 
1062 MOdouble
1063 moConfig::Double( moText p_param_name ) {
1064  moParam& param(GetParam(p_param_name));
1065  if (param.GetData()) return param.GetData()->Double();
1066  return param.GetValue().GetSubValue().Double();
1067 }
1068 
1069 moText
1070 moConfig::Text( moParamReference p_paramreference ) {
1071  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1072  if (param.GetData()) return param.GetData()->Text();
1073  return param.GetValue().GetSubValue().Text();
1074 }
1075 
1076 moText
1077 moConfig::Text( moText p_param_name ) {
1078  moParam& param(GetParam(p_param_name));
1079  if (param.GetData()) return param.GetData()->Text();
1080  return param.GetValue().GetSubValue().Text();
1081 }
1082 
1083 moText
1084 moConfig::Text( int p_param_index ) {
1085  moParam& param(GetParam(p_param_index));
1086  if (param.GetData()) return param.GetData()->Text();
1087  return param.GetValue().GetSubValue().Text();
1088 }
1089 
1090 moVector4d
1092 
1093  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1094  moVector4d full_color(0.0,0.0,0.0,1.0);
1095  double r,g,b,a;
1096  if (param.GetValue().GetSubValueCount()==4) {
1097  r = param.GetValue().GetSubValue(MO_RED).Eval();
1098  g = param.GetValue().GetSubValue(MO_GREEN).Eval();
1099  b = param.GetValue().GetSubValue(MO_BLUE).Eval();
1100  a = param.GetValue().GetSubValue(MO_ALPHA).Eval();
1101  full_color = moVector4d( r, g, b, a);
1102  }
1103  return full_color;
1104 
1105 }
1106 
1107 moVector4d
1108 moConfig::EvalColor( moParamReference p_paramreference, double x, ... ) {
1109 
1110  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1111  moVector4d full_color(0.0,0.0,0.0,1.0);
1112  double r,g,b,a;
1113  if (param.GetValue().GetSubValueCount()==4) {
1114  r = param.GetValue().GetSubValue(MO_RED).Eval( x );
1115  g = param.GetValue().GetSubValue(MO_GREEN).Eval( x );
1116  b = param.GetValue().GetSubValue(MO_BLUE).Eval( x );
1117  a = param.GetValue().GetSubValue(MO_ALPHA).Eval( x );
1118  full_color = moVector4d( r, g, b, a);
1119  }
1120  return full_color;
1121 
1122 }
1123 
1124 MOdouble
1125 moConfig::Eval( moParamReference p_paramreference, double x, ... ) {
1126 
1127  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1128  moData* pdata = param.GetData();
1129  if (pdata) {
1130  return pdata->Eval( x );
1131  }
1132  return 0.0f;
1133 
1134 }
1135 
1136 MOdouble
1137 moConfig::Eval( moText p_param_name , double x, ... ) {
1138 
1139  moParam& param( GetParam(p_param_name) );
1140  moData* pdata = param.GetData();
1141  if (pdata) {
1142  return pdata->Eval( x );
1143  }
1144  return 0.0f;
1145 
1146 }
1147 
1148 MOdouble
1149 moConfig::Eval( moParamReference p_paramreference ) {
1150 
1151  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1152  moData* pdata = param.GetData();
1153  if (pdata) {
1154  return pdata->Eval();
1155  }
1156  return 0.0f;
1157 }
1158 
1159 MOdouble
1160 moConfig::Eval( moText p_param_name ) {
1161 
1162  moParam& param( GetParam(p_param_name) );
1163  moData* pdata = param.GetData();
1164  if (pdata) {
1165  return pdata->Eval();
1166  }
1167  return 0.0f;
1168 
1169 }
1170 
1171 
1172 GLint
1173 moConfig::GetGLId( moParamReference p_paramreference, MOfloat p_cycle, MOfloat p_fade, const moTextFilterParam &p_filterparam ) {
1174  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1175  moData* pdata = param.GetData();
1176  if (pdata) {
1177  return pdata->GetGLId( p_cycle, p_fade, p_filterparam );
1178  }
1179  return 0;
1180 }
1181 
1182 GLint
1183 moConfig::GetGLId( moParamReference p_paramreference, moTempo *p_tempo, MOfloat p_fade, const moTextFilterParam &p_filterparam ) {
1184  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1185  moData* pdata = param.GetData();
1186  if (pdata) {
1187  return pdata->GetGLId( p_tempo, p_fade, p_filterparam );
1188  }
1189  return 0;
1190 }
1191 
1192 GLint
1193 moConfig::GetGLId( moParamReference p_paramreference, MOuint p_i, MOfloat p_fade, const moTextFilterParam &p_filterparam ) {
1194  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1195  moData* pdata = param.GetData();
1196  if (pdata) {
1197  return pdata->GetGLId( p_i, p_fade, p_filterparam );
1198  }
1199  return 0;
1200 }
1201 
1202 GLint
1203 moConfig::GetGLId( moParamReference p_paramreference, MOfloat p_fade, const moTextFilterParam &p_filterparam ) {
1204  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1205  moData* pdata = param.GetData();
1206  if (pdata) {
1207  return pdata->GetGLId( p_fade, p_filterparam );
1208  }
1209  return 0;
1210 }
1211 
1212 
1213 GLint
1214 moConfig::GetGLId( moParamReference p_paramreference, MOfloat p_cycle ) {
1215 
1216  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1217  moData* pdata = param.GetData();
1218  if (pdata) {
1219  moTextFilterParam filterparam;
1220  return pdata->GetGLId( p_cycle, 1.0, filterparam );
1221  }
1222  return 0;
1223 }
1224 
1225 GLint
1226 moConfig::GetGLId( moParamReference p_paramreference, moTempo *p_tempo) {
1227  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1228  moData* pdata = param.GetData();
1229  if (pdata) {
1230  moTextFilterParam filterparam;
1231  return pdata->GetGLId( p_tempo, 1.0, filterparam );
1232  }
1233  return 0;
1234 }
1235 
1236 GLint
1237 moConfig::GetGLId( moParamReference p_paramreference, MOuint p_i ) {
1238  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1239  moData* pdata = param.GetData();
1240  if (pdata) {
1241  moTextFilterParam filterparam;
1242  return pdata->GetGLId( p_i, 1.0, filterparam );
1243  }
1244  return 0;
1245 }
1246 
1247 GLint
1249  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1250  moData* pdata = param.GetData();
1251  if (pdata) {
1252  moTextFilterParam filterparam;
1253  return pdata->GetGLId( 1.0, filterparam );
1254  }
1255  return 0;
1256 }
1257 
1259 moConfig::Fun( moParamReference p_paramreference ) {
1260  if ( p_paramreference.reference == -1 ) {
1262  return *m_pFun;
1263  }
1264  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1265  moData* pdata = param.GetData();
1266  if (pdata) {
1267  moMathFunction* pFun = pdata->Fun();
1268  if (pFun) {
1269  return *pFun;
1270  }
1271  }
1272  return (*m_pFun);
1273 }
1274 
1275 const moFont&
1276 moConfig::Font( moParamReference p_paramreference ) {
1277  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1278  moData* pdata = param.GetData();
1279  if (pdata) {
1280  moFont* pFont = pdata->Font();
1281  if (pFont) {
1282  return *pFont;
1283  }
1284  }
1285  return (*m_pFont);
1286 }
1287 
1288 const moTextureBuffer&
1290 
1291  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1292  moData* pdata = param.GetData();
1293  if (pdata) {
1294  moTextureBuffer* pTextureBuffer = pdata->TextureBuffer();
1295  if (pTextureBuffer) {
1296  return *pTextureBuffer;
1297  }
1298  }
1299  return (*m_pTextureBuffer);
1300 
1301 }
1302 
1303 const moSceneNode&
1304 moConfig::Model( moParamReference p_paramreference ) {
1305 
1306  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1307  moData* pdata = param.GetData();
1308  if (pdata) {
1309  moSceneNode* pModel = pdata->Model();
1310  if (pModel) {
1311  return *pModel;
1312  }
1313  }
1314  return (*m_pModel);
1315 
1316 }
1317 
1318 const moVector2d&
1320 
1321  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1322  moData* pdata = param.GetData();
1323  if (pdata) {
1324  moVector2d* pVector = pdata->Vector2d();
1325  if (pVector) {
1326  return *pVector;
1327  }
1328  }
1329  return (*m_pVector2d);
1330 
1331 }
1332 
1333 const moVector2i&
1335 
1336  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1337  moData* pdata = param.GetData();
1338  if (pdata) {
1339  moVector2i* pVector = pdata->Vector2i();
1340  if (pVector) {
1341  return *pVector;
1342  }
1343  }
1344  return (*m_pVector2i);
1345 
1346 }
1347 
1348 const moVector3d&
1350 
1351  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1352  moData* pdata = param.GetData();
1353  if (pdata) {
1354  moVector3d* pVector = pdata->Vector3d();
1355  if (pVector) {
1356  return *pVector;
1357  }
1358  }
1359  return (*m_pVector3d);
1360 
1361 }
1362 
1363 const moVector3i&
1365 
1366  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1367  moData* pdata = param.GetData();
1368  if (pdata) {
1369  moVector3i* pVector = pdata->Vector3i();
1370  if (pVector) {
1371  return *pVector;
1372  }
1373  }
1374  return (*m_pVector3i);
1375 
1376 }
1377 
1378 const moVector4d&
1380 
1381  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1382  moData* pdata = param.GetData();
1383  if (pdata) {
1384  moVector4d* pVector = pdata->Vector4d();
1385  if (pVector) {
1386  return *pVector;
1387  }
1388  }
1389  return (*m_pVector4d);
1390 
1391 }
1392 
1393 
1394 const moVector4i&
1396 
1397  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1398  moData* pdata = param.GetData();
1399  if (pdata) {
1400  moVector4i* pVector = pdata->Vector4i();
1401  if (pVector) {
1402  return *pVector;
1403  }
1404  }
1405  return (*m_pVector4i);
1406 
1407 }
1408 
1409 const moDataMessage&
1411 
1412  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1413  moData* pdata = param.GetData();
1414  if (pdata) {
1415  moDataMessage* pVector = pdata->Message();
1416  if (pVector) {
1417  return *pVector;
1418  }
1419  }
1420  return (*m_pMessage);
1421 
1422 }
1423 
1424 const moDataMessages&
1426 
1427  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1428  moData* pdata = param.GetData();
1429  if (pdata) {
1430  moDataMessages* pVector = pdata->Messages();
1431  if (pVector) {
1432  return *pVector;
1433  }
1434  }
1435  return (*m_pMessages);
1436 
1437 }
1438 
1439 moSound&
1440 moConfig::Sound( moParamReference p_paramreference ) {
1441 
1442  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1443  moData* pdata = param.GetData();
1444  if (pdata) {
1445  moSound* pVector = pdata->Sound();
1446  if (pVector) {
1447  return *pVector;
1448  }
1449  }
1450  return (*m_pSound);
1451 
1452 }
1453 
1454 const moTexture&
1456 
1457  moParam& param( GetParam( m_ConfigDefinition.ParamIndexes().GetRef(p_paramreference.reference) ));
1458  moData* pdata = param.GetData();
1459  if (pdata) {
1460  moTexture* pTexture = pdata->Texture();
1461  if (pTexture) {
1462  return *pTexture;
1463  }
1464  }
1465  return (*m_pTexture);
1466 
1467 }
1468 
1469 void
1471 p_paramindex, int p_valueindex ) {
1472  m_Params[p_paramindex].SetIndexValue( p_valueindex );
1473 }
1474 
1475 int
1477  return m_Params.Get( p_paramindex ).GetIndexValue();
1478 }
1479 
1480 moValue&
1482  return m_Params[m_CurrentParam].GetValue();
1483 }
1484 
1485 moParam&
1487  return m_Params[m_CurrentParam];
1488 }
1489 
1490 
1491 int
1493  return m_CurrentParam;
1494 }
1495 
1496 bool
1497 moConfig::SetCurrentParamIndex( int p_currentparam ) {
1498  if ( 0<=p_currentparam
1499  && p_currentparam<(int)m_Params.Count()) {
1500  m_CurrentParam = p_currentparam;
1501  return true;
1502  }
1503  return false;
1504 }
1505 
1506 void
1508  if ( m_Params.Count()>0 ) {
1509  m_CurrentParam = 0;
1510  } else m_CurrentParam = -1;
1511 }
1512 
1513 void
1515  if ( m_Params.Count()>0 ) {
1516  if ( m_CurrentParam < ( (MOint)m_Params.Count()-1 ) ) {
1517  m_CurrentParam++;
1518  }
1519  } else m_CurrentParam = -1;
1520 }
1521 
1522 void
1524  if ( m_Params.Count() > 0 ) {
1525  if ( m_CurrentParam > 0 ) {
1526  m_CurrentParam--;
1527  }
1528  } else m_CurrentParam = -1;
1529 }
1530 
1531 bool
1533  if ( m_CurrentParam>=0 ) {
1534  moParam& pParam( m_Params[m_CurrentParam] );
1535  if ( pParam.GetValuesCount() == 0 ) {
1536  return false;
1537  }
1538  pParam.FirstValue();
1539  return true;
1540  }
1541  return false;
1542 }
1543 
1544 bool
1546  if ( m_CurrentParam>=0 ) {
1547  moParam& pParam( m_Params[m_CurrentParam] );
1548  if ( pParam.GetIndexValue() == (int)(pParam.GetValuesCount()-1) ) {
1549  return false;
1550  }
1551  pParam.NextValue();
1552  return true;
1553  }
1554  return false;
1555 }
1556 
1557 bool
1559  if ( m_CurrentParam>=0 ) {
1560  moParam& pParam( m_Params[m_CurrentParam] );
1561  if ( pParam.GetIndexValue() == 0 ) {
1562  return false;
1563  }
1564  pParam.PrevValue();
1565  return true;
1566  }
1567  return false;
1568 }
1569 
1570 
1573 
1574  return &m_ConfigDefinition;
1575 
1576 }
1577 
1578 //PRECONFIGS
1579 
1580 MOint
1582  return m_PreConfigs.Count();
1583 }
1584 
1585 MOint
1587  return m_PreconfActual;
1588 }
1589 
1590 void
1592  if(0<=p_actual && p_actual<(MOint)m_PreConfigs.Count())
1593  {
1594  for( MOuint i=0; i<m_PreConfigs[p_actual].m_PreconfIndexes.Count(); i++) {
1595  moPreconfigParamIndex Val = m_PreConfigs[p_actual][i];
1597  }
1598  m_PreconfActual = p_actual;
1599  }
1600 }
1601 
1602 void
1604  if(m_PreConfigs.Count()>0)
1605  SetCurrentPreConf( 0 );
1606 }
1607 
1608 void
1610  if( m_PreconfActual!=-1 && (m_PreconfActual<((MOint)m_PreConfigs.Count()-1)) )
1611  SetCurrentPreConf( ++m_PreconfActual );
1612 }
1613 
1614 void
1616  if(m_PreconfActual!=-1 && m_PreconfActual>0)
1617  SetCurrentPreConf( --m_PreconfActual );
1618 }
1619 
1620 
1622 void
1623 moConfig::AddValue( int paramindex, moValue& p_value ) {
1624  GetParam( paramindex ).AddValue( p_value );
1625 }
1626 
1628 void
1629 moConfig::InsertValue( int paramindex, int valueindex, moValue& p_value ) {
1630  GetParam( paramindex ).GetValues().Insert( valueindex, p_value );
1631 }
1632 
1634 void
1635 moConfig::SetValue( int paramindex, int valueindex, moValue& p_value ) {
1636  GetParam( paramindex ).GetValue( valueindex ) = p_value;
1637 }
1638 
1640 void
1641 moConfig::DeleteValue( int paramindex, int valueindex ) {
1642 
1643  GetParam( paramindex ).DeleteValue( valueindex );
1644 
1645 }
1646 
1647 
1648 const moPreConfig&
1649 moConfig::GetPreconfig( int valueindex ) {
1650  if (0<=valueindex && valueindex<GetPreConfCount() ) {
1651  return m_PreConfigs.Get( valueindex );
1652  }
1653  return m_PreConfigs.Get(-1);
1654 }
1655 
1656 void
1657 moConfig::AddPreconfig( moPreconfigIndexes& p_preconfindexes ) {
1658  m_PreConfigs.Add( moPreConfig( p_preconfindexes ) );
1659 }
1660 
1661 void
1662 moConfig::AddPreconfig( int preconfig_index) {
1663 
1664  int new_preconfigs = preconfig_index - GetPreConfCount() + 1;
1665 
1666  //MODebug2->Message("moConsole::ProcessMoldeoAPIMessage > Adding Preconfigs: " + IntToStr(valcount) );
1667  //mo->Message("moConfig::AddPreconfig > Adding Preconfigs: " + IntToStr(new_preconfigs) );
1668 
1669  if (new_preconfigs>0) {
1670  int base_index = GetPreConfCount();
1671  int min_index = 0;
1672  for( int sum=0; sum < new_preconfigs ; sum++ ) {
1673 
1674  moPreConfig newPreCfg;
1675 
1678  for( int pi=0; pi < GetParamsCount(); pi++) {
1679  moParam& rParam2( GetParam(pi) );
1680  int nvalues = GetParam(pi).GetValuesCount();
1681  min_index = nvalues - 1;
1682 
1683  if ( nvalues > 1 || ( preconfig_index==0 && rParam2.GetParamDefinition().GetName()!="inlet" && rParam2.GetParamDefinition().GetName()!="outlet" ) ) {
1684 
1685  moPreconfigParamIndex preIndexA;
1686 
1687  preIndexA.m_ParamName = rParam2.GetParamDefinition().GetName();
1688  preIndexA.m_ParamIndex = rParam2.GetParamDefinition().GetIndex();
1689  preIndexA.m_ValueIndex = momin( min_index, base_index+sum );
1690 
1691  newPreCfg.m_PreconfIndexes.Add( preIndexA );
1692 
1693  }
1694  }
1695 
1696  AddPreconfig( newPreCfg.m_PreconfIndexes );
1697  }
1698  }
1699 
1700 }
1701 
1702 
1703 void
1704 moConfig::InsertPreconfig( int valueindex, moPreconfigIndexes& p_preconfindexes ) {
1705  m_PreConfigs.Insert( valueindex, moPreConfig( p_preconfindexes ) );
1706 }
1707 
1708 void
1709 moConfig::SetPreconfig( int valueindex, moPreconfigIndexes& p_preconfindexes ) {
1710  m_PreConfigs.Set( valueindex, moPreConfig( p_preconfindexes ) );
1711 }
1712 
1713 void
1714 moConfig::DeletePreconfig( int valueindex ) {
1715  m_PreConfigs.Remove( valueindex );
1716 }
1717 
1718 const moText&
1720 
1721  moText fieldSeparation = ",";
1722 
1723  m_FullJSON = "{";
1724 
1725  m_FullJSON+= "'configdefinition': " + this->GetConfigDefinition()->ToJSON();
1726  m_FullJSON+= fieldSeparation + "'currentpreconfig':" + IntToStr( this->GetCurrentPreConf() );
1727  m_FullJSON+= fieldSeparation + "'parameters': {";
1728 
1729  fieldSeparation = "";
1730 
1731  for( int p=0; p<(int)m_Params.Count();p++) {
1732  moParam Param = m_Params[p];
1733  if ( Param.GetParamDefinition().GetType()==MO_PARAM_INLET
1734  || Param.GetParamDefinition().GetType()==MO_PARAM_OUTLET ) {
1736  } else {
1737  m_FullJSON+= fieldSeparation + "'" + Param.GetParamDefinition().GetName() + "': " + "{";
1738  m_FullJSON+= "}";
1739  fieldSeparation = ",";
1740  }
1741 
1742  }
1743  m_FullJSON+= "}";
1744 
1745  fieldSeparation = ",";
1746  m_FullJSON+= fieldSeparation + "'preconfigs': [";
1747  fieldSeparation = "";
1748  for( int pre=0; pre<(int)m_PreConfigs.Count();pre++) {
1749  moPreConfig PreConfig = m_PreConfigs[pre];
1750  //m_FullJSON+= fieldSeparation + PreConfig.ToJSON();
1751  m_FullJSON+= fieldSeparation + "{'n': '"+PreConfig.m_Name+"'}";
1752  fieldSeparation = ",";
1753  }
1754  m_FullJSON+= "]";
1755 
1756  m_FullJSON+= "}";
1757  return m_FullJSON;
1758 
1759 }
1760 
1761 
void AddValue(int paramindex, moValue &p_value)
Agrega un valor.
Definition: moConfig.cpp:1623
Valor de un Parámetro.
Definition: moValue.h:501
const moTextureBuffer & TextureBuffer(moParamReference p_paramreference)
Definition: moConfig.cpp:1289
bool FixType(moParamType m_NewType=MO_PARAM_UNDEFINED)
Definition: moParam.cpp:1320
moVector4i * Vector4i()
Definition: moValue.cpp:400
MOdouble Eval()
Definition: moValue.cpp:424
static void Message(moText p_text)
Anuncia un mensaje al usuario además de guardarlo en el log de texto.
moTextArray & GetOptions()
Definition: moParam.h:317
void PreConfNext()
Selecciona el próximo valor de la preconfiguración
Definition: moConfig.cpp:1609
moVector4< MOlong > moVector4i
void SetOptions(const moTextArray &p_options)
Definition: moParam.cpp:586
const moText & GetObjectClass()
Devuelve el nombre de la clase del objeto asociado a este config.
Definition: moConfig.h:228
const moText & ToJSON()
Devuelve la estructura del config en formato JSON.
Definition: moConfig.cpp:1719
#define MO_BLUE
Definition: moTypes.h:443
void Error(moText p_text)
Anuncia y registra un error.
Definition: moAbstract.cpp:79
Tempo, beat, ritmo.
Definition: moTempo.h:44
moMathFunction * Fun()
referencias a clases
Definition: moValue.cpp:417
clase base para una fuente 3d o 2d
Definition: moFontManager.h:63
moParamType
Definition: moParam.h:40
moParams & GetParams()
Devuelve el puntero al arreglo de parámetros.
Definition: moConfig.cpp:977
static bool FileExists(moText filename)
const moVector3d & Vector3d(moParamReference p_paramreference)
Definition: moConfig.cpp:1349
moValueBase & GetSubValue(MOint p_indexsubvalue=0)
Definition: moValue.h:539
MOdouble Eval(moParamReference p_paramreference, double x,...)
Acceso rápido a evaluar la función
Definition: moConfig.cpp:1125
const moVector4i & Vector4i(moParamReference p_paramreference)
Definition: moConfig.cpp:1395
MOint GetCurrentPreConf()
Devuelve el índice de la preconfiguración seleccionada.
Definition: moConfig.cpp:1586
void InsertPreconfig(int valueindex, moPreconfigIndexes &p_preconfindexes)
Inserta una pre-configuración
Definition: moConfig.cpp:1704
moTextureBuffer * TextureBuffer()
Definition: moValue.cpp:479
bool NextValue()
Selecciona el próximo valor del parámetro actual.
Definition: moConfig.cpp:1545
#define MO_CONFIGFILE_NOT_FOUND
Definition: moConfig.h:42
void PrevParam()
Selecciona el parámetro anterior.
Definition: moConfig.cpp:1523
moDatas moDataMessage
Definition: moValue.h:149
LIBMOLDEO_API moText0 FloatToStr(double a)
Definition: moText.cpp:1134
MOdouble Double(moParamReference p_paramreference)
Acceso rápido a un valor double.
Definition: moConfig.cpp:1056
const moText & GetProperty() const
Definition: moParam.h:291
void SetPreconfig(int valueindex, moPreconfigIndexes &p_preconfindexes)
Setea una pre-configuración
Definition: moConfig.cpp:1709
void PreConfFirst()
Selecciona el primer valor de la preconfiguración
Definition: moConfig.cpp:1603
#define MOboolean
Definition: moTypes.h:385
MOlong index
Definition: moParam.h:124
MOint GetIndex() const
Definition: moParam.h:284
static void Error(moText p_text)
Anuncia un error.
const moText & ToJSON()
Devuelve en formato texto la estructura del objeto convertida a JSON.
Definition: moConfig.cpp:252
int GetParamIndex(moText p_paramname)
Devuelve el índice correspondiente al parámetro por nombre.
Definition: moConfig.cpp:1008
const moFont & Font(moParamReference p_paramreference)
Definition: moConfig.cpp:1276
MOint Int(moParamReference p_paramreference)
Acceso rápido a un valor entero.
Definition: moConfig.cpp:1042
virtual ~moConfig()
Destructor.
Definition: moConfig.cpp:275
const moText & GetGroup() const
Definition: moParam.h:299
void Replace(const moText0 &target, const moText0 &replacement)
Definition: moText.cpp:729
const moVector3i & Vector3i(moParamReference p_paramreference)
Definition: moConfig.cpp:1364
void SetCodeName(moText p_codename)
Fija el nombre del código para este valor.
Definition: moValue.cpp:1518
moValue & GetDefaultValue()
Definition: moParam.h:309
const moVector2d & Vector2d(moParamReference p_paramreference)
Definition: moConfig.cpp:1319
void Warning(moText p_text)
Anuncia y registra un llamado de atencion.
Definition: moAbstract.cpp:97
void PreConfPrev()
Selecciona el valor anterior de la preconfiguración
Definition: moConfig.cpp:1615
void AddSubValue(const moText &strvalue, moValueType p_valuetype)
Definition: moValue.cpp:1707
void SetValue(int paramindex, int valueindex, moValue &p_value)
Fija un valor.
Definition: moConfig.cpp:1635
const moValueDefinition & GetValueDefinition() const
Devuelve una referencia a la definición del valor [ nombre de codigo, rango, tipo, índice ]...
Definition: moValue.h:415
void FixConfig()
Corrige el archivo de configuración
Definition: moConfig.cpp:305
void InsertValue(int paramindex, int valueindex, moValue &p_value)
Inserta un valor.
Definition: moConfig.cpp:1629
definición de todos los parámetros a encontrar o a crear dentro del moConfig
Definition: moConfig.h:57
MOboolean Exists()
Definition: moFile.cpp:436
const moText & GetName() const
Definition: moParam.h:266
#define MOfloat
Definition: moTypes.h:403
moDataMessages * Messages()
Definition: moValue.cpp:412
void DeleteValue(int paramindex, int valueindex)
Borra un valor.
Definition: moConfig.cpp:1641
const moDataMessages & Messages(moParamReference p_paramreference)
Definition: moConfig.cpp:1425
clase de para manejar textos
Definition: moText.h:75
MOuint GetValuesCount(int p_paramindex)
Devuelve la cantidad de valores que contiene el parámetro indexado.
Definition: moConfig.cpp:1019
int GetIndexValue() const
Definition: moParam.cpp:1227
moParamIndexes & ParamIndexes()
Devuelve el puntero al arreglo de índices de los parámetros.
Definition: moConfig.h:97
vector of one type
Definition: moParam.h:72
moMathFunction & Fun(moParamReference p_paramreference)
referencias a clases
Definition: moConfig.cpp:1259
void SetCurrentValueIndex(int p_paramindex, int p_valueindex)
Posiciona el puntero de selección del valor del parámetro a la posición indicada.
Definition: moConfig.cpp:1470
bool Exists(moText p_name)
Verifica si el parametro no existe ya.
Definition: moConfig.cpp:89
moText0 moText
Definition: moText.h:291
void NextParam()
Selecciona el próximo parámetro.
Definition: moConfig.cpp:1514
void DeletePreconfig(int valueindex)
Borra una pre-configuración
Definition: moConfig.cpp:1714
int LoadConfig(moText p_filename)
Lee la configuracion de un archivo.
Definition: moConfig.cpp:402
moText GetFullText()
Devuelve el contenido completo de la configuración como texto plano.
Definition: moConfig.cpp:913
#define MOint
Definition: moTypes.h:388
moDataMessage * Message()
Definition: moValue.cpp:407
MOlong GetDuration()
Definition: moParam.cpp:739
moConfigDefinition & operator=(const moConfigDefinition &p_src)
assignment copy operator
Definition: moConfig.cpp:76
clase base para el manejo de una textura
Definition: moTexture.h:78
void DeleteValue(MOint i)
Definition: moParam.cpp:1077
int GetParamsCount()
Devuelve la cantidad de parámetros de la configuracíón.
Definition: moConfig.cpp:1003
#define MO_PARAM_NOT_FOUND
Definition: moConfig.h:41
const moVector4d & Vector4d(moParamReference p_paramreference)
Definition: moConfig.cpp:1379
void PrevValue()
Definition: moParam.cpp:1244
MOboolean CreateDefault(const moText &p_fullconfigfilename)
Devuelve true si pudo crear el archivo de configuración junto con su archivo correspondiente.
Definition: moConfig.cpp:848
int GetCurrentValueIndex(MOint p_paramindex)
Devuelve el índice correspondiente al valor seleccionado del parámetro por índice de parámetro...
Definition: moConfig.cpp:1476
MOuint Length() const
Definition: moText.cpp:347
#define MO_GREEN
Definition: moTypes.h:442
moVector3d * Vector3d()
Definition: moValue.cpp:385
moParamInterpolation & GetInterpolation()
Definition: moParam.h:329
moConfigDefinition * GetConfigDefinition()
Devuelve el puntero al objeto de definición de la configuración
Definition: moConfig.cpp:1572
void Set(moText p_objectname, moText p_objectclass)
Fija el nombre y la clase del objeto a configurar.
Definition: moConfig.h:210
bool FixOptions(moTextArray &m_NewOptions)
Definition: moParam.cpp:1360
GLint GetGLId(MOfloat p_cycle, MOfloat p_fade, const moTextFilterParam &p_filterparam)
Definition: moValue.cpp:956
Clase base de sonido.
MOboolean IsConfigLoaded()
Indica si ha sido cargado con éxito el archivo de configuración
Definition: moConfig.cpp:279
moSceneNode * Model()
Definition: moValue.cpp:487
void DeleteConfig()
Borra la configuracion de parámetros con sus respectivos valores.
Definition: moConfig.cpp:906
moVector3< MOdouble > moVector3d
MOdouble Double() const
Definition: moValue.cpp:859
moValue & GetValue(moText nameparam, int indexvalue=-1)
Devuelve el valor indicado por el nombre del parámetro y el índice del valor.
Definition: moConfig.cpp:1024
moText m_Name
Definition: moPreConfig.h:90
moParamType GetType() const
Definition: moParam.h:277
value type: TXT or LNK
Definition: moParam.h:50
bool PreviousValue()
Selecciona el valor anterior del parámetro actual.
Definition: moConfig.cpp:1558
moConfig()
Constructor.
Definition: moConfig.cpp:269
static moDebug * MODebug2
Clase de impresión de errores para depuración
Definition: moAbstract.h:225
const moVector2i & Vector2i(moParamReference p_paramreference)
Definition: moConfig.cpp:1334
moText GetTypeStr() const
Devuelve el tipo en formato texto.
Definition: moValue.cpp:1503
moVector3i * Vector3i()
Definition: moValue.cpp:390
value type: NUM or FUNCTION
Definition: moParam.h:42
moVector2< MOlong > moVector2i
Definition: moMathVector.h:422
moText Text()
Definition: moValue.cpp:539
const moSceneNode & Model(moParamReference p_paramreference)
Definition: moConfig.cpp:1304
void Indexation()
Indexa los parámetros.
Definition: moConfig.cpp:286
const moDataMessage & Message(moParamReference p_paramreference)
Definition: moConfig.cpp:1410
void SetCurrentPreConf(MOint p_actual)
Posiciona la preconfiguración actual en el índice indicado.
Definition: moConfig.cpp:1591
moValues & GetValues()
Definition: moParam.cpp:1060
moSound & Sound(moParamReference p_paramreference)
Definition: moConfig.cpp:1440
MOlong reference
Definition: moParam.h:98
const moPreConfig & GetPreconfig(int valueindex)
Agrega una pre-configuración
Definition: moConfig.cpp:1649
moVector2i * Vector2i()
Definition: moValue.cpp:380
void AddValue(moValue &value)
Definition: moParam.cpp:1071
moVector2< MOdouble > moVector2d
Definition: moMathVector.h:424
moValue & GetValue(MOint i=-1)
Definition: moParam.cpp:1204
moParam & GetParam(MOint p_paramindex=-1)
Devuelve el parámetro por índice.
Definition: moConfig.cpp:984
moValueBase & GetLastSubValue()
Definition: moValue.h:542
#define MOdouble
Definition: moTypes.h:404
moText GetFunctionToText()
Definition: moParam.cpp:799
void SetIndex(MOint p_index)
Definition: moParam.h:287
bool SetParamIndex(int defined_array_index, moParamIndex paramindex)
Fija el indice del array con el indice del parametro...
Definition: moConfig.cpp:223
moText GetTypeStr() const
Definition: moParam.cpp:386
moConfigDefinition()
constructor
Definition: moConfig.cpp:62
moParamDefinition & GetParamDefinition()
Definition: moParam.cpp:1268
const moTexture & Texture(moParamReference p_paramreference)
Definition: moConfig.cpp:1455
moVector4d * Vector4d()
Definition: moValue.cpp:395
void Add(const moText &p_name, moParamType p_type, int p_index=-1, const moValue &p_defaultvalue=moValue("INVALID", MO_VALUE_UNDEFINED), const moText &p_OptionsStr=moText(""))
Agrega la definición de un parámetro con un valor predeterminado a tomar.
Definition: moConfig.cpp:139
moVector3< MOlong > moVector3i
moText GetCodeName() const
Definition: moValue.cpp:1308
int SaveConfig(moText p_filename=moText(""))
Guarda la configuracion en un archivo físico.
Definition: moConfig.cpp:652
void SetDefault(const moValue &p_defaultvalue)
Definition: moParam.cpp:505
moPreconfigIndexes m_PreconfIndexes
Definition: moPreConfig.h:92
#define MOuint
Definition: moTypes.h:387
LIBMOLDEO_API moText0 IntToStr(int a)
Definition: moText.cpp:1070
moParam & GetCurrentParam()
Devuelve el parámetro actualmente seleccionado.
Definition: moConfig.cpp:1486
void AddPreconfig(moPreconfigIndexes &p_preconfindexes)
Agrega una pre-configuración
Definition: moConfig.cpp:1657
moVector4d EvalColor(moParamReference p_paramreference)
Definition: moConfig.cpp:1091
void SetCodeName(moText p_codename)
Definition: moValue.cpp:1313
moVector4< MOdouble > moVector4d
void FirstValue()
Definition: moParam.cpp:1254
void SetValueDefinition(moValueDefinition &p_valuedefinition)
Fija la definición del valor [ nombre de codigo, rango, tipo, índice ].
Definition: moValue.h:405
const moText & GetObjectName()
Devuelve el nombre del objeto asociado a este config.
Definition: moConfig.h:219
bool SetCurrentParamIndex(int)
Selecciona el parámetro por el índice.
Definition: moConfig.cpp:1497
MOint Int() const
Definition: moValue.cpp:773
bool SetIndex(moText p_name, MOint p_index)
Definition: moConfig.cpp:114
moFont * Font()
Definition: moValue.cpp:474
void FirstParam()
Selecciona el primer parámetro.
Definition: moConfig.cpp:1507
MOuint GetSubValueCount()
Definition: moValue.h:545
moData * GetData()
Definition: moParam.cpp:1286
moSound * Sound()
Definition: moValue.cpp:493
const moParamDefinition & GetParamDefinition(const moText &p_param_name)
Definition: moConfig.cpp:99
moParamDefinitions * GetParamDefinitions()
Devuelve el puntero al arreglo de definciones de parámetros.
Definition: moConfig.h:88
virtual ~moConfigDefinition()
destructor
Definition: moConfig.cpp:66
void NextValue()
Definition: moParam.cpp:1234
MOuint GetValuesCount() const
Definition: moParam.cpp:1065
value type: TXT or LNK
Definition: moParam.h:73
MOint GetPreConfCount()
Devuelve la cantidad de preconfiguraciones definidas.
Definition: moConfig.cpp:1581
moValue & GetCurrentValue()
Devuelve el valor actual del parámetro actual.
Definition: moConfig.cpp:1481
void UnloadConfig()
Elimina todos los parámetros anteriormente cargados.
Definition: moConfig.cpp:898
void Message(moText p_text)
Anuncia un mensaje al usuario además de guardarlo en el log de texto.
Definition: moAbstract.cpp:114
#define MO_CONFIG_OK
Definition: moConfig.h:43
value type: TXT or LNK
Definition: moParam.h:53
moMathFunction
bool FirstValue()
Selecciona el primer valor del parámetro actual.
Definition: moConfig.cpp:1532
const moText & GetOptionsStr()
Definition: moParam.h:321
GLint GetGLId(moParamReference p_paramreference, MOfloat p_cycle, MOfloat p_fade, const moTextFilterParam &p_filterparam)
Acceso rápido a los datos de una textura.
Definition: moConfig.cpp:1173
int GetCurrentParamIndex() const
Devuelve el índice del parámetro actualmente seleccionado.
Definition: moConfig.cpp:1492
moTexture * Texture()
Definition: moValue.cpp:501
moVector2d * Vector2d()
Definition: moValue.cpp:375
#define MO_ALPHA
Definition: moTypes.h:444
moText Text(moParamReference p_paramreference)
Acceso rápido a un valor de texto.
Definition: moConfig.cpp:1070
#define MO_RED
Definition: moTypes.h:441