Changes between Version 18 and Version 19 of rappture_perl_api


Ignore:
Timestamp:
Jun 24, 2010 9:48:44 AM (14 years ago)
Author:
dkearney
Comment:

cleanup perl doc

Legend:

Unmodified
Added
Removed
Modified
  • rappture_perl_api

    v18 v19  
    1111
    1212
    13 '''RpLibrary''' Class
     13'''!RpLibrary''' Class
    1414
    1515  This module provides an interface to Rappture I/O (!RpLibrary) library.
     
    1818  __'''Constructor'''__ [[BR]]
    1919
    20   ''$library'' = '''Rappture::RpLibrary(''' ''$path'' ''')''' [[BR]]
     20  ''$library'' = '''Rappture::RpLibrary->new(''' ''$path'' ''')''' [[BR]]
    2121
    2222  __'''Methods'''__ [[BR]]
     
    2424  ''$library''->'''get(''' ''$path'' ''')''' [[BR]]
    2525  ''$library''->'''put(''' ''$path'', ''$value'', ''$append'' ''')''' [[BR]]
     26  ''$library''->'''putFile(''' ''$path'', ''$fileName'', ''$compress'', ''$append''
    2627  ''$library''->'''result( )''' [[BR]]
    2728
    28 '''RpUnits''' Class [[BR]]
     29'''Rappture::RpUnits''' Class [[BR]]
    2930
    3031  This module provides an interface to Rappture Units (!RpUnits) library.
     
    3233  __'''Static Methods'''__ [[BR]]
    3334
    34   '''!RpUnits::convert(''' ''$fromVal'', ''$to'', ''$units'' ''')'''
    35 
    36 '''RpUtils''' Module [[BR]]
     35  '''Rappture::RpUnits::convert(''' ''$fromVal'', ''$to'', ''$showUnits'' ''')'''
     36
     37'''Rappture::Utils''' Module [[BR]]
    3738
    3839  This module provides an interface to Rappture Utils Module.
     
    4950
    5051
    51 '''Rappture::RpLibrary''' (''$path'') [[BR]]
     52'''Rappture::RpLibrary->new''' (''$path'') [[BR]]
    5253
    5354  Purpose:[[BR]]
     
    6162
    6263{{{
     64# Contents of driver.xml
     65# <run>
     66#     <input>
     67#         <number id="Ef">
     68#             <units>eV</units>
     69#             <min>-10eV</min>
     70#             <max>10eV</max>
     71#             <default>0eV</default>
     72#             <current>3eV</current>
     73#         </number>
     74#     </input>
     75# </run>
     76
     77use Rappture;
     78
     79my $lib = Rappture::RpLibrary->new("driver.xml");
     80
     81if (not defined $lib) {
     82    print "creation of library successful\n";
     83} else {
     84    print "creation of library failed\n";
     85}
     86
     87print "lib = $lib";
     88# $lib->delete;
     89
     90# Result:
     91# creation of library successful
     92# lib = Rappture::RpLibrary=SCALAR(0x1bd9060)
    6393}}}
    6494
     
    6696
    6797  Purpose:[[BR]]
    68 .[[BR]]
     98Retrieves the data held at location ''$path'' from the rappture object.[[BR]]
    6999
    70100  Input Arguments: [[BR]]
     
    72102
    73103  Return Value: [[BR]]
    74 . [[BR]]
    75 
    76 
    77 {{{
     104String representation of the data at ''path'' within the rappture object.[[BR]]
     105
     106
     107{{{
     108# Contents of driver.xml
     109# <run>
     110#     <input>
     111#         <number id="Ef">
     112#             <units>eV</units>
     113#             <min>-10eV</min>
     114#             <max>10eV</max>
     115#             <default>0eV</default>
     116#             <current>3eV</current>
     117#         </number>
     118#     </input>
     119# </run>
     120
     121use Rappture;
     122
     123my $lib = Rappture::RpLibrary->new("driver.xml");
     124
     125my $Ef = $lib->get("input.number(Ef).current");
     126
     127print "Ef = $Ef";
     128
     129# Result:
     130# Ef = 3eV
    78131}}}
    79132
     
    81134
    82135  Purpose:[[BR]]
    83 .[[BR]]
    84 
    85   Input Arguments: [[BR]]
    86 . [[BR]]
    87 . [[BR]]
    88 
    89   Return Value: [[BR]]
    90 . [[BR]]
    91 
    92 {{{
    93 }}}
     136Place data ''$value'' into this object at the xml location ''$path''. If the ''$append'' flag is set to 1, then ''$value'' will be appended to data that already exists at path. If the ''$append'' flag is set to 0, then ''$value'' will overwrite data that may have existed at path.[[BR]]
     137
     138  Input Arguments: [[BR]]
     1391. ''$path'' - xml path (location) to store value.
     1402. ''$value'' - data to store in this object.
     1413. ''$append' - overwrite flag (1 or 0). if set to 0, data at ''$path'' will be overwritten. if set to 1, data will be appended.
     142
     143  Return Value: [[BR]]
     144No value is returned. [[BR]]
     145
     146{{{
     147# Contents of driver.xml
     148# <run>
     149#     <input>
     150#         <number id="Ef">
     151#             <units>eV</units>
     152#             <min>-10eV</min>
     153#             <max>10eV</max>
     154#             <default>0eV</default>
     155#             <current>3eV</current>
     156#         </number>
     157#     </input>
     158# </run>
     159
     160
     161use Rappture;
     162
     163my $lib = Rappture::RpLibrary->new("driver.xml");
     164
     165print "Overwrite:\n";
     166$lib->put("input.number(Ef).current", "6", 0);
     167my $Ef = $lib->get("input.number(Ef).current");
     168print "Ef = $Ef";
     169
     170print "\n";
     171print "Append:\n";
     172$lib->put("input.number(Ef).current", "eV", 1);
     173$Ef = $lib->get("input.number(Ef).current");
     174print "Ef = $Ef";
     175
     176# Result:
     177#
     178# Overwrite:
     179# Ef = 6
     180#
     181# Append:
     182# Ef = 6eV
     183
     184}}}
     185
     186
     187''instance''->'''putFile(''' ''$path'', ''$fileName'', ''$compress'', ''$append'' ''')''' [[BR]]
     188
     189  Purpose:[[BR]]
     190Place data from file ''$fileName'' into this object at the xml location ''$path''. If the ''$compress'' flag is set to 1, the data will be gzip compressed and base64 encoded. If the ''$append'' flag is set to 1, then ''$value'' will be appended to data that already exists at path. If the ''$append'' flag is set to 0, then ''$value'' will overwrite data that may have existed at path.[[BR]]
     191
     192  Input Arguments: [[BR]]
     1931. ''$path'' - xml path (location) to store value.
     1942. ''$fileName'' - name of the file to store in this object.
     1953. ''$compress'' - flag (1 or 0). if set to 1, file data will be gzip compressed and base64 encoded.
     1963. ''$append' - overwrite flag (1 or 0). if set to 0, data at ''$path'' will be overwritten. if set to 1, data will be appended.
     197
     198  Return Value: [[BR]]
     199No value is returned. [[BR]]
     200
     201{{{
     202# Contents of driver.xml
     203# <run>
     204#     <input>
     205#         <number id="Ef">
     206#             <units>eV</units>
     207#             <min>-10eV</min>
     208#             <max>10eV</max>
     209#             <default>0eV</default>
     210#             <current>3eV</current>
     211#         </number>
     212#     </input>
     213# </run>
     214#
     215# temp.jpg is a JPEG image file
     216
     217use Rappture;
     218
     219my $lib = Rappture::RpLibrary->new("driver.xml");
     220
     221$lib->putFile("input.image.current", "temp.jpg", 1, 0);
     222
     223}}}
     224
    94225
    95226''instance''->'''result(''' ''')''' [[BR]]
    96227
    97228  Purpose:[[BR]]
    98 .[[BR]]
    99 
    100   Input Arguments: [[BR]]
    101 . [[BR]]
    102 . [[BR]]
    103 
    104   Return Value: [[BR]]
    105 . [[BR]]
    106 
    107 {{{
    108 }}}
    109 
    110 
    111 '''!RpUnits::convert(''' ''$fromVal'', ''$to'', ''$units'' ''')''' [[BR]]
     229Write the data from the Rappture Library object instance to file and signal the end of processing to the graphical user interface.[[BR]]
     230
     231  Input Arguments: [[BR]]
     232None [[BR]]
     233
     234  Return Value: [[BR]]
     235None [[BR]]
     236
     237{{{
     238# Contents of driver.xml
     239# <run>
     240#     <input>
     241#         <number id="Ef">
     242#             <units>eV</units>
     243#             <min>-10eV</min>
     244#             <max>10eV</max>
     245#             <default>0eV</default>
     246#             <current>3eV</current>
     247#         </number>
     248#     </input>
     249# </run>
     250
     251use Rappture;
     252
     253my $lib = Rappture::RpLibrary->new("driver.xml");
     254
     255$lib->result();
     256}}}
     257
     258
     259'''Rappture::RpUnits::convert(''' ''$fromVal'', ''$to'', ''$showUnits'' ''')''' [[BR]]
    112260
    113261  Purpose:[[BR]]
     
    1172651. ''$fromVal'' - String with numeric portion and optional units (ie. "3m"  or "3"). [[BR]]
    1182662. ''$to'' - String name of the units you want to convert to. [[BR]]
    119 3. ''$units'' - String "1" or "0" to tell if you want units to show up in the result.
    120 
    121   Return Value: [[BR]]
    122 Return converted value as a string. Return undef on failure. ''$units'' are set to on ("1") by default.[[BR]]
     2673. ''$showUnits'' - String "1" or "0" to tell if you want units to show up in the result.
     268
     269  Return Value: [[BR]]
     270Return converted value as a string. Return undef on failure. ''$showUnits'' are set to on ("1") by default.[[BR]]
    123271
    124272  Notes: [[BR]]
    125 1. . [[BR]]
     273None. [[BR]]
    126274
    127275{{{
     
    134282    # result is "80.329999999999998"
    135283
    136     $result = Rappture:RpUnits::convert( "3cm", "A" )
     284    $result = Rappture::RpUnits::convert( "3cm", "A" )
    137285    # result is "3e+08A"
    138286
    139     $result = Rappture::RpUnits.convert( "3", "m" )
     287    $result = Rappture::RpUnits::convert( "3", "m" )
    140288    # result is "3m"
    141289
     
    145293}}}
    146294
     295'''Rappture::Utils::progress(''' ''$value'', ''$message'' ''')''' [[BR]]
     296
     297  Purpose:[[BR]]
     298Print a progress percentage and message on the screen during simulation. [[BR]]
     299
     300  Input Arguments: [[BR]]
     3011. ''$value'' - Percentage to display. Value between 0 and 100. [[BR]]
     3022. ''$message'' - Comment associated with ''$value''. [[BR]]
     303
     304  Return Value: [[BR]]
     305None. [[BR]]
     306
     307  Notes: [[BR]]
     308None. [[BR]]
     309
     310{{{
     311    use Rappture;
     312
     313    Rappture::Utils::progress(45,"Iterating...");
     314}}}