08.06.2013 Views

Bernese GPS Software Version 5.0 - Bernese GNSS Software

Bernese GPS Software Version 5.0 - Bernese GNSS Software

Bernese GPS Software Version 5.0 - Bernese GNSS Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

19. <strong>Bernese</strong> Processing Engine (BPE)<br />

delivered with the software. Most of them are very generic and may be used in a number<br />

of different BPEs. The user may take them as examples for the development of his own<br />

sophisticated user scripts when creating his own BPE procedures.<br />

These scripts are started by the BPE-client and are responsible for running the main <strong>Bernese</strong><br />

programs or performing other specific tasks such as copying or downloading files or executing<br />

auxiliary programs. On UNIX platforms the user scripts may be written in almost any<br />

programming language (actually the only requirement is that the environment variables are<br />

accessible from within the user script and some system commands can be performed). Old<br />

UNIX user scripts were, e.g., written in Bourne shell and may still be used (with a few<br />

modifications, see Section 24.3).<br />

However, we recommend to use Perl for writing new scripts. Scripts written in Perl may<br />

profit from inherited methods defined in the BPE client ${BPE}/RUNBPE.pm and efficiency<br />

is increased because the user scripts do no need to be executed as a separate child process<br />

of the client. On Windows platforms the use of Perl as scripting language is required. DOS<br />

batch files are no longer supported. The “skeleton” of Perl user scripts is very simple as<br />

shown in the following section.<br />

19.6.1 User Script Skeleton<br />

From the user point of view the most important method of the RUNBPE object (that is<br />

defined in ${BPE}/RUNBPE.pm) is the method run. This method is responsible for starting<br />

the user script. In the terminology of object-oriented programming the method should be<br />

looked at as virtual. Therefore, it is possible to use the technique of method overloading. A<br />

user script written in Perl inherits its behavior from the RUNBPE object and overrides the<br />

RUNBPE::run method in such a way that it directly fulfills the required task.<br />

Let us start with a trivial example of a user script. We call this script DUMMY and it does<br />

nothing else but directly exiting. The implementation of the script is given here (of course,<br />

the line numbers are not a part of the script):<br />

1: package DUMMY;<br />

2: @ISA = ("RUNBPE");<br />

3: sub run {<br />

4: my $bpe = shift;<br />

5:<br />

6: }<br />

The first line is the name of the script. The second line says that the behavior of the new<br />

package DUMMY (or object DUMMY) is inherited from the package RUNBPE. Lines 3–6<br />

redefine the method run. In Perl object-oriented style the first parameter of each method is<br />

the pointer to the object itself. Line 4 stores this pointer into the variable $bpe (using the<br />

name $bpe is a useful convention but not a strict demand). The body of the script doing<br />

the actual work would be specified in lines 5 and following.<br />

Of course, real scripts will have to perform more complicated tasks (e.g., running a <strong>Bernese</strong><br />

program). However, the lines 1–4 from the example above may remain without any changes.<br />

Before we proceed with a more sophisticated example we have to make a remark concerning<br />

the variables that are accessible in user scripts.<br />

Page 396 AIUB

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!