aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a03113.html
blob: 8e600dcb887e02142b15cc23b935f4ccc2dc7223 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>NeL: NLLIGO::CPrimitiveConfigurations class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex">  <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a>  | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NLLIGO::CPrimitiveConfigurations Class Reference</h1><code>#include &lt;<a class="el" href="a06204.html">primitive_configuration.h</a>&gt;</code>
<p>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Ligo primitive configuration description.<p>
<dl compact><dt><b>Author:</b></dt><dd>Cyril 'Hulud' Corvazier <p>
Nevrax France </dd></dl>
<dl compact><dt><b>Date:</b></dt><dd>2001 </dd></dl>

<p>

<p>
Definition at line <a class="el" href="a06204.html#l00049">49</a> of file <a class="el" href="a06204.html">primitive_configuration.h</a>.<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03113.html#NLLIGO_1_1CPrimitiveConfigurationsa0">belong</a> (const <a class="el" href="a03123.html">IPrimitive</a> &amp;primitive) const </td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03113.html#NLLIGO_1_1CPrimitiveConfigurationsa1">read</a> (xmlNodePtr configurationNode, const char *<a class="el" href="a04560.html#a1">filename</a>, const char *name, class <a class="el" href="a02756.html">CLigoConfig</a> &amp;config)</td></tr>

<tr><td colspan=2><br><h2>Data Fields</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03337.html">NLMISC::CRGBA</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03113.html#NLLIGO_1_1CPrimitiveConfigurationso0">Color</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector&lt; <a class="el" href="a03114.html">CMatchGroup</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03113.html#NLLIGO_1_1CPrimitiveConfigurationso1">MatchPairs</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>std::string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03113.html#NLLIGO_1_1CPrimitiveConfigurationso2">Name</a></td></tr>

</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="NLLIGO_1_1CPrimitiveConfigurationsa0" doxytag="NLLIGO::CPrimitiveConfigurations::belong" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool CPrimitiveConfigurations::belong </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="a03123.html">IPrimitive</a> &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>primitive</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap> const</td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a06203.html#l00097">97</a> of file <a class="el" href="a06203.html">primitive_configuration.cpp</a>.
<p>
References <a class="el" href="a06195.html#l01102">NLLIGO::IPrimitive::getPropertyByName()</a>, <a class="el" href="a06204.html#l00067">MatchPairs</a>, <a class="el" href="a06204.html#l00063">NLLIGO::CPrimitiveConfigurations::CMatchGroup::Pairs</a>, <a class="el" href="a05586.html#l00536">NLMISC::strlwr()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05646.html#l01132">value</a>.
<p>
<div class="fragment"><pre>00098 {
00099         <span class="comment">// For each match group</span>
00100         <a class="code" href="a04558.html#a15">uint</a> group;
00101         <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> numGroup = <a class="code" href="a03113.html#NLLIGO_1_1CPrimitiveConfigurationso1">MatchPairs</a>.size();
00102         <span class="keywordflow">for</span> (group=0; group&lt;numGroup; group++)
00103         {
00104                 <span class="keyword">const</span> CMatchGroup &amp;matchGroup = <a class="code" href="a03113.html#NLLIGO_1_1CPrimitiveConfigurationso1">MatchPairs</a>[group];
00105 
00106                 <span class="comment">// For each rules</span>
00107                 <a class="code" href="a04558.html#a15">uint</a> rules;
00108                 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> numRules = matchGroup.Pairs.size();
00109                 <span class="keywordflow">for</span> (rules=0; rules&lt;numRules; rules++)
00110                 {
00111                         <span class="keyword">const</span> std::pair&lt;std::string, std::string&gt; &amp;pairs = matchGroup.Pairs[rules];
00112                         string key = <a class="code" href="a05378.html#a273">strlwr</a>(pairs.second);
00113 
00114                         <span class="comment">// Get the property</span>
00115                         string <a class="code" href="a04223.html#a658">value</a>;
00116                         <span class="keywordflow">if</span> (primitive.getPropertyByName (pairs.first.c_str(), <a class="code" href="a04223.html#a658">value</a>))
00117                         {
00118                                 <span class="keywordflow">if</span> (<a class="code" href="a05378.html#a273">strlwr</a>(value) == key)
00119                                         <span class="keywordflow">continue</span>;
00120                         }
00121 
00122                         <span class="comment">// Get the property</span>
00123                         <span class="keyword">const</span> std::vector&lt;string&gt; *array = NULL;
00124                         <span class="keywordflow">if</span> (primitive.getPropertyByName (pairs.first.c_str(), array) &amp;&amp; array)
00125                         {
00126                                 <a class="code" href="a04558.html#a15">uint</a> i;
00127                                 <span class="keywordflow">for</span> (i=0; i&lt;array-&gt;size(); i++)
00128                                 {
00129                                         <span class="keywordflow">if</span> (<a class="code" href="a05378.html#a273">strlwr</a>((*array)[i]) == key)
00130                                                 <span class="keywordflow">break</span>;
00131                                 }
00132                                 <span class="keywordflow">if</span> (i!=array-&gt;size())
00133                                         <span class="keywordflow">continue</span>;
00134                         }
00135 
00136                         <span class="comment">// Don't match</span>
00137                         <span class="keywordflow">break</span>;
00138                 }
00139 
00140                 <span class="comment">// Match ?</span>
00141                 <span class="keywordflow">if</span> (rules == numRules)
00142                         <span class="keywordflow">return</span> <span class="keyword">true</span>;
00143         }
00144         <span class="keywordflow">return</span> <span class="keyword">false</span>;
00145 }
</pre></div>    </td>
  </tr>
</table>
<a class="anchor" name="NLLIGO_1_1CPrimitiveConfigurationsa1" doxytag="NLLIGO::CPrimitiveConfigurations::read" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool CPrimitiveConfigurations::read </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">xmlNodePtr&nbsp;</td>
          <td class="mdname" nowrap> <em>configurationNode</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap> <em>filename</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap> <em>name</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>class <a class="el" href="a02756.html">CLigoConfig</a> &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>config</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a06203.html#l00039">39</a> of file <a class="el" href="a06203.html">primitive_configuration.cpp</a>.
<p>
References <a class="el" href="a05903.html#l00319">NLLIGO::CLigoConfig::getPropertyString()</a>, <a class="el" href="a06204.html#l00067">MatchPairs</a>, <a class="el" href="a06204.html#l00063">NLLIGO::CPrimitiveConfigurations::CMatchGroup::Pairs</a>, <a class="el" href="a06201.html#l00091">ReadColor()</a>, and <a class="el" href="a05903.html#l00333">NLLIGO::CLigoConfig::syntaxError()</a>.
<p>
<div class="fragment"><pre>00040 {
00041         <span class="comment">// The name</span>
00042         <a class="code" href="a03113.html#NLLIGO_1_1CPrimitiveConfigurationso2">Name</a> = name;
00043 
00044         <span class="comment">// Read the color</span>
00045         <a class="code" href="a04780.html#a0">ReadColor</a> (Color, configurationNode);
00046 
00047         <span class="comment">// Get the first matching pair</span>
00048         <a class="code" href="a03113.html#NLLIGO_1_1CPrimitiveConfigurationso1">MatchPairs</a>.reserve (CIXml::countChildren (configurationNode, <span class="stringliteral">"MATCH_GROUP"</span>));
00049         xmlNodePtr matchGroups = CIXml::getFirstChildNode (configurationNode, <span class="stringliteral">"MATCH_GROUP"</span>);
00050         <span class="keywordflow">if</span> (matchGroups)
00051         {
00052                 <span class="keywordflow">do</span>
00053                 {
00054                         <span class="comment">// Add a pair</span>
00055                         <a class="code" href="a03113.html#NLLIGO_1_1CPrimitiveConfigurationso1">MatchPairs</a>.push_back(CMatchGroup());
00056                         CMatchGroup &amp;matchGroup = <a class="code" href="a03113.html#NLLIGO_1_1CPrimitiveConfigurationso1">MatchPairs</a>.back();
00057 
00058                         <span class="comment">// Get the first matching pair</span>
00059                         matchGroup.Pairs.reserve (CIXml::countChildren (matchGroups, <span class="stringliteral">"MATCH"</span>));
00060                         xmlNodePtr match = CIXml::getFirstChildNode (matchGroups, <span class="stringliteral">"MATCH"</span>);
00061                         <span class="keywordflow">if</span> (match)
00062                         {
00063                                 <span class="keywordflow">do</span>
00064                                 {
00065                                         <span class="comment">// Add the match</span>
00066                                         matchGroup.Pairs.resize (matchGroup.Pairs.size()+1);
00067                                         std::pair&lt;std::string, std::string&gt; &amp;pair = matchGroup.Pairs.back();
00068 
00069                                         <span class="comment">// Get the match name</span>
00070                                         std::string name;
00071                                         <span class="keywordflow">if</span> (config.getPropertyString (name, filename, match, <span class="stringliteral">"NAME"</span>))
00072                                         {
00073                                                 pair.first = name;
00074                                         }
00075                                         <span class="keywordflow">else</span>
00076                                         {
00077                                                 config.syntaxError (filename, match, <span class="stringliteral">"Missing match name in configuration (%s)"</span>, name.c_str());
00078                                                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00079                                         }
00080 
00081                                         <span class="comment">// Get the match value</span>
00082                                         <span class="keywordflow">if</span> (config.getPropertyString (name, filename, match, <span class="stringliteral">"VALUE"</span>))
00083                                         {
00084                                                 pair.second = name;
00085                                         }
00086                                 }
00087                                 <span class="keywordflow">while</span> ((match = CIXml::getNextChildNode (match, <span class="stringliteral">"MATCH"</span>)));
00088                         }
00089                 }
00090                 <span class="keywordflow">while</span> ((matchGroups = CIXml::getNextChildNode (matchGroups, <span class="stringliteral">"MATCH_GROUP"</span>)));
00091         }
00092         <span class="keywordflow">return</span> <span class="keyword">true</span>;
00093 }
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="NLLIGO_1_1CPrimitiveConfigurationso0" doxytag="NLLIGO::CPrimitiveConfigurations::Color" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03337.html">NLMISC::CRGBA</a> <a class="el" href="a03113.html#NLLIGO_1_1CPrimitiveConfigurationso0">NLLIGO::CPrimitiveConfigurations::Color</a>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a06204.html#l00057">57</a> of file <a class="el" href="a06204.html">primitive_configuration.h</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NLLIGO_1_1CPrimitiveConfigurationso1" doxytag="NLLIGO::CPrimitiveConfigurations::MatchPairs" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> std::vector&lt;<a class="el" href="a03114.html">CMatchGroup</a>&gt; <a class="el" href="a03113.html#NLLIGO_1_1CPrimitiveConfigurationso1">NLLIGO::CPrimitiveConfigurations::MatchPairs</a>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a06204.html#l00067">67</a> of file <a class="el" href="a06204.html">primitive_configuration.h</a>.
<p>
Referenced by <a class="el" href="a06203.html#l00097">belong()</a>, and <a class="el" href="a06203.html#l00039">read()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NLLIGO_1_1CPrimitiveConfigurationso2" doxytag="NLLIGO::CPrimitiveConfigurations::Name" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> std::string <a class="el" href="a03113.html#NLLIGO_1_1CPrimitiveConfigurationso2">NLLIGO::CPrimitiveConfigurations::Name</a>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a06204.html#l00054">54</a> of file <a class="el" href="a06204.html">primitive_configuration.h</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="a06204.html">primitive_configuration.h</a><li><a class="el" href="a06203.html">primitive_configuration.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 12:48:42 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.6 </small></address>
</body>
</html>