File: classPythonScript.html

package info (click to toggle)
capisuite 0.4.5-8
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,612 kB
  • ctags: 1,051
  • sloc: cpp: 3,981; sh: 3,465; python: 446; makefile: 265
file content (458 lines) | stat: -rw-r--r-- 18,372 bytes parent folder | download | duplicates (4)
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
<!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>CapiSuite: PythonScript Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.8 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</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">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<h1>PythonScript Class Reference</h1>Read a python script and call a function.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="pythonscript_8h-source.html">pythonscript.h</a>&gt;</code>
<p>
<p>Inheritance diagram for PythonScript:
<p><center><img src="classPythonScript.png" usemap="#PythonScript_map" border="0" alt=""></center>
<map name="PythonScript_map">
<area href="classIdleScript.html" alt="IdleScript" shape="rect" coords="0,56,95,80">
<area href="classIncomingScript.html" alt="IncomingScript" shape="rect" coords="105,56,200,80">
</map>
<a href="classPythonScript-members.html">List of all members.</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>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classPythonScript.html#a0">PythonScript</a> (ostream &amp;<a class="el" href="classPythonScript.html#p3">debug</a>, unsigned short <a class="el" href="classPythonScript.html#p5">debug_level</a>, ostream &amp;<a class="el" href="classPythonScript.html#p4">error</a>, string <a class="el" href="classPythonScript.html#p0">filename</a>, string <a class="el" href="classPythonScript.html#p1">functionname</a>, PycStringIO_CAPI *<a class="el" href="classPythonScript.html#p6">cStringIO</a>)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor. Create Object.  <a href="#a0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>virtual&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classPythonScript.html#a1">~PythonScript</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor.  <a href="#a1"></a><br></td></tr>
<tr><td colspan=2><br><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>virtual void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classPythonScript.html#b0">run</a> ()  throw (ApplicationError)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Reads the given python script and calls the given function.  <a href="#b0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>virtual void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classPythonScript.html#b1">final</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Called by pscript_cleanup_handler(), will delete the current object.  <a href="#b1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classPythonScript.html#b2">prefix</a> (bool verbose=true)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">return a prefix containing this pointer, Python script name and date for log messages  <a href="#b2"></a><br></td></tr>
<tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classPythonScript.html#p0">filename</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">name of the python script to read  <a href="#p0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>string&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classPythonScript.html#p1">functionname</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">name of the function to call  <a href="#p1"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>PyObject *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classPythonScript.html#p2">args</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">python tuple containing the args for the called python function  <a href="#p2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>ostream &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classPythonScript.html#p3">debug</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">debug stream  <a href="#p3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>ostream &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classPythonScript.html#p4">error</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">error stream  <a href="#p4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>unsigned short&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classPythonScript.html#p5">debug_level</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">debug level  <a href="#p5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>PycStringIO_CAPI *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="classPythonScript.html#p6">cStringIO</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">holds a pointer to the Python cStringIO C API  <a href="#p6"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Read a python script and call a function. 
<p>
This class reads a given python script which must define one function with given name. This function is called with arbitrary parameters.<p>
<dl compact><dt><b>Author:</b></dt><dd>Gernot Hillier </dd></dl>

<p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="a0" doxytag="PythonScript::PythonScript" ></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"> PythonScript::PythonScript           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">ostream &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>debug</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>unsigned short&nbsp;</td>
          <td class="mdname" nowrap> <em>debug_level</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>ostream &amp;&nbsp;</td>
          <td class="mdname" nowrap> <em>error</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>string&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>string&nbsp;</td>
          <td class="mdname" nowrap> <em>functionname</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td></td>
          <td class="md" nowrap>PycStringIO_CAPI *&nbsp;</td>
          <td class="mdname" nowrap> <em>cStringIO</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>
Constructor. Create Object. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td></td><td valign=top><em>debug</em>&nbsp;</td><td>stream for debugging info </td></tr>
    <tr><td></td><td valign=top><em>debug_level</em>&nbsp;</td><td>verbosity level for debug messages </td></tr>
    <tr><td></td><td valign=top><em>error</em>&nbsp;</td><td>stream for error messages </td></tr>
    <tr><td></td><td valign=top><em>filename</em>&nbsp;</td><td>file name of the python script to read </td></tr>
    <tr><td></td><td valign=top><em>functionname</em>&nbsp;</td><td>name of the function to call </td></tr>
    <tr><td></td><td valign=top><em>cStringIO</em>&nbsp;</td><td>pointer to the Python cStringIO C API</td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="a1" doxytag="PythonScript::~PythonScript" ></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"> PythonScript::~<a class="el" href="classPythonScript.html">PythonScript</a>           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Destructor. 
<p>
    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="b1" doxytag="PythonScript::final" ></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"> void PythonScript::final           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [protected, virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Called by pscript_cleanup_handler(), will delete the current object. 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="b2" doxytag="PythonScript::prefix" ></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"> string PythonScript::prefix           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">bool&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>verbose</em> = <code>true</code>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [protected]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
return a prefix containing this pointer, Python script name and date for log messages 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td></td><td valign=top><em>verbose</em>&nbsp;</td><td>controls verbosity, default is true which means to log filename etc., false means only this pointer</td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>constructed prefix as stringstream</dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="b0" doxytag="PythonScript::run" ></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"> void PythonScript::run           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap>  throw (<a class="el" href="classApplicationError.html">ApplicationError</a>)<code> [protected, virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Reads the given python script and calls the given function. 
<p>
The arguments for the function must be given in the constructor.<p>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td></td><td valign=top><em>ApplicationError</em>&nbsp;</td><td>Thrown when script can't be executed for any reason.</td></tr>
  </table>
</dl>

<p>
Reimplemented in <a class="el" href="classIdleScript.html#d0">IdleScript</a>, and <a class="el" href="classIncomingScript.html#d0">IncomingScript</a>.
<p>
    </td>
  </tr>
</table>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="p2" doxytag="PythonScript::args" ></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"> PyObject* <a class="el" href="classPythonScript.html#p2">PythonScript::args</a><code> [protected]</code>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
python tuple containing the args for the called python function 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="p6" doxytag="PythonScript::cStringIO" ></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"> PycStringIO_CAPI* <a class="el" href="classPythonScript.html#p6">PythonScript::cStringIO</a><code> [protected]</code>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
holds a pointer to the Python cStringIO C API 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="p3" doxytag="PythonScript::debug" ></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"> ostream&amp; <a class="el" href="classPythonScript.html#p3">PythonScript::debug</a><code> [protected]</code>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
debug stream 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="p5" doxytag="PythonScript::debug_level" ></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"> unsigned short <a class="el" href="classPythonScript.html#p5">PythonScript::debug_level</a><code> [protected]</code>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
debug level 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="p4" doxytag="PythonScript::error" ></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"> ostream &amp; <a class="el" href="classPythonScript.html#p4">PythonScript::error</a><code> [protected]</code>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
error stream 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="p0" doxytag="PythonScript::filename" ></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"> string <a class="el" href="classPythonScript.html#p0">PythonScript::filename</a><code> [protected]</code>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
name of the python script to read 
<p>
    </td>
  </tr>
</table>
<a class="anchor" name="p1" doxytag="PythonScript::functionname" ></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"> string <a class="el" href="classPythonScript.html#p1">PythonScript::functionname</a><code> [protected]</code>          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
name of the function to call 
<p>
    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="pythonscript_8h-source.html">pythonscript.h</a><li>pythonscript.cpp</ul>
<hr size="1"><address style="align: right;"><small>Generated on Sun Nov 28 14:37:45 2004 for CapiSuite by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address>
</body>
</html>