[OPUS]

Pid - A field object that stores the PID portion of a PSTAT.


Availability:

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

Constructors:
Pid( )
~Pid( )

Methods:
clone( ) create copy of object
assign( ) override base class-- validate string
name( ) get field name

Description

This field, along with the Node field, uniquely identify a PSTAT on the PSTAT blackboard. The process ID is formatted in hexadecimal and zero filled to the width of the field.

Derived from

Field

Example

  
    #include <iostream>
    #include "file_pstat_bb.h"
    #include "file_pstat.h"
    #include "pid.h"
    #include "node.h"
    #include "opus_lock.h"
  
    using namespace std;
  
    // The following example uses the File PSTAT Blackboard to find
    // an application's PSTAT on disk, then delete it.
    int main(int argc, char* argv[])
    {
       Opus_env opus(argc, argv);        // initialize OPUS
       if (!opus.is_initialized()) {
       }
       Pstat* pstat = opus.appl_pstat(); // get process' PSTAT
  
       Pid* pid = new Pid;               // replace PID in PSTAT
       pstat->get_field(pid);
       cout << "Process ID = " << pid->str() << endl;
       delete pid;
       return(0);
    }
  

See Also:


Pid::Pid - The Pid constructor.

Synopsis


Pid::Pid() : Field(Bb_params_db::get_id("PID"), 
                   Bb_params_db::get_size("PID"))

Pid::Pid(
         const string& s) // I - pid string

Pid::Pid(
         const Pid& di) // I - object to initialize from

Description

This method constructs a new Pid object, initialized by the calling argument. The default constructor uses the OPUS process ID for the current process. The field is formatted in hexadecimal and padded to width with 0's. String arguments MUST be in hexadecimal format.

Exceptions Thrown

Bad_val<string> - if string contains invalid characters or wrong size; Bad_val.arg contains the calling argument


Pid::~Pid - The Pid destructor.

Synopsis


Pid::~Pid()

Description

This method destroys the object.

Exceptions Thrown

none


Pid::clone - Create a copy of this object.

Synopsis


Field* Pid::clone() const

Description

This method creates a new Pid object, initialized by this object, off the heap and returns a pointer to the new object. The client should delete the returned object when it is no longer needed.

Returns

    A pointer to the new Pid object initialized by this object.

Exceptions Thrown

none


Pid::assign - Validate and assign a string to this object.

Synopsis


void Pid::assign(
                 const string& s) // I - string to assign from

Description

This method scans the string for invalid characters before assigning it to the object.

Exceptions Thrown

Bad_val<string> - if string contains invalid characters or wrong size; Bad_val.arg contains the calling argument


Pid::name - Get the field name

Synopsis


string Pid::name() const 

Description

This method returns the name of the field, "PID".

Returns

    string field name

Exceptions Thrown

none


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