[OPUS]

Pstat_event_bb - A blackboard that stores a PSTAT against which PSTAT-related triggers poll.


Availability:

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

Constructors:
Pstat_event_bb( )
~Pstat_event_bb( )

Methods:
post( ) no-op
erase( ) no-op
replace( ) forwards replace request to the PSTAT blackboard
search( ) get application PSTAT or compare with argument
lock_entry( ) no-op
str( ) gets the blackboard name
test_driver( ) runs the test driver

Description

Several PSTAT blackboard related triggers are defined by Opus_env. In order to reduce the amount of polling these triggers produce on the PSTAT blackboard, this blackboard caches the application's PSTAT. A trigger calls the search method with a non-Pstat object which triggers this blackboard to fetch the current state of the application's PSTAT. Search requests with Pstat a Pstat entry will return the application's PSTAT if a match occurs.

Derived from

Blackboard

See Also:


Pstat_event_bb::Pstat_event_bb - The Pstat_event_bb constructor.

Synopsis


Pstat_event_bb::Pstat_event_bb(Pstat_bb* pstat_bb) : pbb(pstat_bb), pstat(0)

Description

This method constructs a Pstat_event_bb object.

Exceptions Thrown

none


Pstat_event_bb::~Pstat_event_bb - The Pstat_event_bb destructor.

Synopsis


Pstat_event_bb::~Pstat_event_bb()

Description

This method destroys the object.

Exceptions Thrown

none


Pstat_event_bb::post - This method does nothing.

Synopsis


void Pstat_event_bb::post(const Entry* e)

Description

none

Exceptions Thrown

none


Pstat_event_bb::erase - This method does nothing.

Synopsis


void Pstat_event_bb::erase(const Entry* e)

Description

none

Exceptions Thrown

none


Pstat_event_bb::replace - This method forwards the replace request to the PSTAT blackboard.

Synopsis


void Pstat_event_bb::replace(const Entry* old_ent, const Entry* new_ent)

Description

Triggers that poll against this blackboard and that attempt to apply a modifier to a matching entry must be permitted to do so on the PSTAT blackboard.

Exceptions Thrown

Bad_val<int> - if either argument is null; Bad_val.arg indicates which arg is bad (0 or 1)
Type<const Entry*> - if either argument is not of type File_pstat; Type.arg points to the bad argument
Io_error<const char*> - if the file rename attempt fails; Io_error.arg contains the error message


Pstat_event_bb::search - Search for the application's PSTAT and store the result or perform a PSTAT comparison.

Synopsis


int Pstat_event_bb::search(
                       const Entry* e,          // I   - dummy argument
                                                //       or PSTAT test
                       vector<Entry*>& results) // I/O - results vector
                       const

Description

The current state of the application's PSTAT is stored on this blackboard if the first argument is not a Pstat. Otherwise, it is assumed that a trigger polling

Returns

    If a match is checked for, the PSTAT stored on this blackboard is

returned as the search result. Otherwise this method returns 0.

Exceptions Thrown

Bad_val<Entry*> - if first argument is null; Bad_val.arg points to the first argument
Type<Entry*> - if first argument is not of type File_pstat; Type.arg points to the first argument
Io_error<const char*> - if the file search fails; Io_error.arg contains the error message
Ambiguous<vector<string>*> - if more than one PSTAT is found; Ambiguous.arg points to a vector allocated off the heap containing the list of matching PSTAT files
No_entry<void*> - if no PSTAT file is found; No_entry.arg points to null
Not_ready<void*> - if a comparison attempt is made before this method is called with a dummy argument; Not_ready.arg contains 0.


Pstat_event_bb::lock_entry - This method does nothing.

Synopsis


Opus_lock* Pstat_event_bb::lock_entry(const Entry* e)

Description

none

Returns

    A pointer to a Null_lock object allocated off the heap.

Exceptions Thrown

none


Pstat_event_bb::str - Get the blackboard name.

Synopsis


string Pstat_event_bb::str() const

Description

This method returns a string describing the blackboard.

Returns

    string containing the blackboard name

Exceptions Thrown

none

Example

  
    Pstat_event_bb cbb;
    cout << "About to post command on " << cbb.str() << endl;
  


Pstat_event_bb::test_driver - Test the blackboard implementation.

Synopsis


bool Pstat_event_bb::test_driver()

Description

This method exercises the blackboard methods. Diagnostic output is sent to cerr. If all of the tests pass, this method returns true. Otherwise, it returns false. All exceptions generated during the test are caught and reported.

Returns

    true  - if all tests pass;

false - if one or more of the tests fail

Exceptions Thrown

none

Example

  
    Pstat_event_bb cbb;
    cout << "Running the Pstat Event Blackboard test driver." << endl;
    if (cbb.test_driver()) cout << "Pass." << endl;
    else                   cout << "Fail." << endl;
    

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