This class is available for the OPUS Blackboard API. The initial OPUS 2.0 release is described here
Constructors:
| Pstat( ) | |
| ~Pstat( ) |
Methods:
| search_mask( ) | fill non-unique Field's with search character |
| mask( ) | fill non-unique Field's with pad character fill non-unique Field's with provided character |
| search_fill_all( ) | fill all Field's with search character |
Description
Class Pstat defines the PSTAT objects for OPUS applications. PSTAT entries contain the following field objects:
Pid, Process, Proc_stat, Start_time, Path, Node, and Proc_cmd.
Of these objects, the Pid and Node combination constitute a unique PSTAT on the PSTAT blackboard.
Derived from
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[])
{
// constructor takes
// OPUS_HOME_DIR path
File_pstat_bb* pbb = new File_pstat_bb("/home/opus/pstats/");
Pstat* fpstat = pbb->new_pstat(); // padded except for Pid &
// Node
Pid* pid = new Pid(123); // replace PID in PSTAT
fpstat->set_field(pid);
delete pid;
Node* node = new Node("foo"); // replace NODE in PSTAT
fpstat->set_field(node);
delete node;
fpstat->search_fill(); // place search characters in
// remaining fields
vector<Entry*> res;
if (pbb->search(fpstat, res)) { // search for PSTAT
Opus_lock* lck = 0;
try { // attempt lock on PSTAT
lck = pbb->lock_entry(res[0]);
pbb->erase(res[0]); // delete it
cout << "Deleted PSTAT: " << fpstat->str() << endl;
}
catch(...) {
cout << "Failed to delete PSTAT: " << res[0]->str()
<< endl;
}
delete lck; // release & delete
delete res[0];
} else {
cout << "Could not find PSTAT: " << fpstat->str() << endl;
}
delete fpstat;
delete pbb;
return(0);
}
See Also:
Pstat::Pstat - The Pstat constructor.
Synopsis
Pstat::Pstat()
Pstat::Pstat(
const Pstat& o) // I - object to initialize from
Description
This method constructs objects of type Pid, Process, Proc_stat, Start_time, Path, Node, and Proc_cmd and adds them to the object. The default constructors for the Pid, Node, and Start_time objects initialize them with the OPUS process ID, the host name, and the current system time, respectively.
Exceptions Thrown
Pstat::~Pstat - The Entry destructor.
Synopsis
Pstat::~Pstat()
Description
This method destroys the object.
Exceptions Thrown
Pstat::mask - Fill non-unique PSTAT fields with indicated character.
Synopsis
void Pstat::mask()
void Pstat::mask(
const char c) // I - character to use as fill
Description
All fields other than those that determine the uniqueness of a Pstat entry are filled out with the character calling argument when this method is called.
Exceptions Thrown
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