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
moPreConfig.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moPreConfig.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 "moPreConfig.h"
33 
34 #include "moArray.h"
35 moDefineDynamicArray( moPreConfigs )
36 moDefineDynamicArray( moPreconfigIndexes )
37 
38 /*
39  moPreconfigParamIndex::moPreconfigParamIndex() {
40  m_ParamName = "";
41  m_ParamIndex = -1;
42  m_ValueIndex = -1;
43 }
44 */
45 /*
46 moPreconfigParamIndex::~moPreconfigParamIndex() {
47  //nothing
48  m_ParamName = "";
49  m_ParamIndex = -1;
50  m_ValueIndex = -1;
51 }
52 */
53 
59 }
60 
62 {
63  Finish();
64 }
65 
66 
67 
70 
71  //m_ValueIndexes = preconf.m_ValueIndexes;
73  m_Name = preconf.m_Name;
74  return (*this);
75 }
76 
77 moPreConfig::moPreConfig( moPreconfigIndexes& preconfindexes ) {
78  m_PreconfIndexes = preconfindexes;
79  /*
80  m_ValueIndexes.Empty();
81  for( MOuint i=0; i<m_PreconfIndexes.Count(); i++ ) {
82 
83  moValueIndex PIndex;
84  PIndex.m_ParamIndex = m_PreconfIndexes[i].m_ParamIndex;
85  PIndex.m_ValueIndex = m_PreconfIndexes[i].m_ValueIndex;
86 
87  m_ValueIndexes.Add( PIndex );
88  }
89  */
90 }
91 /*
92 moPreConfig::moPreConfig( moValueIndexes& valueindexes ) {
93  m_ValueIndexes = valueindexes;
94  m_PreconfIndexes.Empty();
95  for( MOuint i=0; i<m_PreconfIndexes.Count(); i++ ) {
96 
97  moPreconfigParamIndex PIndex;
98  PIndex.m_ParamIndex = m_ValueIndexes[i].m_ParamIndex;
99  PIndex.m_ValueIndex = m_ValueIndexes[i].m_ValueIndex;
100 
101  m_PreconfIndexes.Add( PIndex );
102  }
103 }
104 */
105 
106 MOboolean
108 
109  return true;
110 }
111 
112 
113 MOboolean
115  //m_ValueIndexes.Empty();
116  m_PreconfIndexes.Empty();
117  return true;
118 }
119 
120 
123  moPreconfigParamIndex vindex;
124  if ( 0<=paramindex && paramindex< (MOint) this->m_PreconfIndexes.Count() ) {
125  vindex = this->m_PreconfIndexes[paramindex];
126  }
127  return vindex;
128 }
129 
130 const moText&
132 
133  moText fieldseparation = ",";
134  m_FullJSON = "{ 'name': '" + m_Name +"'";
135  m_FullJSON+= fieldseparation
136  + "'vidx': {";
137  fieldseparation = "";
138  for( int vi = 0; vi< (int)m_PreconfIndexes.Count(); vi++ ) {
139 
141 
142  m_FullJSON+= fieldseparation
143  + "'" + vindex.m_ParamName + "': {";
144  fieldseparation = ",";
145 
146  m_FullJSON+= "'pid': " + IntToStr(vindex.m_ParamIndex);
147  m_FullJSON+= fieldseparation + "'vid': " + IntToStr(vindex.m_ValueIndex);
148  m_FullJSON+= "}";
149  }
150  m_FullJSON+= "}";
151  m_FullJSON+= "}";
152  return m_FullJSON;
153 }
154 
155 
virtual MOboolean Finish()
#define MOboolean
Definition: moTypes.h:385
clase de para manejar textos
Definition: moText.h:75
moDefineDynamicArray(moPreConfigs) moDefineDynamicArray(moPreconfigIndexes) moPreConfig
Definition: moPreConfig.cpp:35
virtual ~moPreConfig()
Definition: moPreConfig.cpp:61
moPreConfig & operator=(const moPreConfig &preconf)
Definition: moPreConfig.cpp:69
#define MOint
Definition: moTypes.h:388
moText m_Name
Definition: moPreConfig.h:90
virtual MOboolean Init()
const moText & ToJSON()
moPreconfigIndexes m_PreconfIndexes
Definition: moPreConfig.h:92
LIBMOLDEO_API moText0 IntToStr(int a)
Definition: moText.cpp:1070
moPreconfigParamIndex operator[](MOint paramindex)