[OPUS]

Opus_pid - An OPUS process identifier object.


Availability:

This class is available for the OPUS Blackboard API. The initial OPUS 2.0 release is described here

Constructors:
Opus_pid( )
~Opus_pid( )

Methods:
get_pid( ) gets OPUS process ID
get_pid_hex_str( ) returns a string with the pid in hex format at the specified width
get_node( ) gets the host name

Description

Opus_pid objects provide information that uniquely identifies an Opus process. This information includes an integer ID, unique within a node, and a string node name.

See Also:


Opus_pid::Opus_pid - The Opus_pid constructor.

Synopsis


Opus_pid::Opus_pid()

Opus_pid::Opus_pid(
                   const int pid,       // I - process ID
                   const string& hname) // I - host name

Description

This method checks whether the static data have been initialized, and if not, fetches the parent process ID and host name for the process. If arguments are given, the process ID and host name specified are used instead.

Exceptions Thrown

Severe<int> - if the host name or PID lookup fails; Severe.arg contains the value of errno

Example

  
    #include <iostream>
    #include <string>
    #include "opus_pid.h"
  
    // The following example demonstrates the use of the Opus_pid
    // object; it prints the parent process id and host for the
    // process.
    int main(int argc, char* argv[])
    {
       Opus_pid pid;
  
       cout << "Parent process id : " << pid.get_pid() << endl <<
            << "Host name         : " << pid.get_node() << endl;
  
    }
  


Opus_pid::~Opus_pid - The Opus_pid destructor.

Synopsis


Opus_pid::~Opus_pid()

Description

This method destroys the object.

Exceptions Thrown

none


Opus_pid::get_pid - Get the OPUS process ID.

Synopsis


int Opus_pid::get_pid() const

Description

This method returns the OPUS process ID for this process.

Returns

    int process ID.

Exceptions Thrown

none


Opus_pid::get_node - Get node name.

Synopsis


string Opus_pid::get_node() const

Description

This method returns the node name on which the process is running.

Returns

    string containing the node name

Exceptions Thrown

none


Opus_pid::get_pid_hex_str - Get string with pid in hexadecimal format at the specified width.

Synopsis


string Opus_pid::get_pid_hex_str(
                                 const int size) // I - desired width
                                 const

Description

This method retuens a string with the pid in hex format, 0 padded, at the specified width.

Returns

    A string of the specified width containing the pid value in hex.

Exceptions Thrown

Bad_val<int> - if width specified is less then or equal to 0; Bad_val.arg contains the calling argument


OPUS API index · STScI Home Page · Search · Topics · Index

Copyright © 1997-2000 The Association of Universities for Research in Astronomy, Inc. All Rights Reserved.


For more information, contact opushelp@stsci.edu

Last modified: 25 April 2000