This class is available for the OPUS Blackboard API. The initial OPUS 2.0 release is described here
Constructors:
Entry( ) | |
~Entry( ) |
Methods:
operator=( ) | entry assignment operator |
operator==( ) | compares the entry to another |
clone( ) | creates a copy of the entry |
str( ) | returns the concatenation of each field's str method |
size( ) | returns the number of field objects in the entry |
set_field( ) | add (or replace) a field object to the entry |
get_field( ) | obtains a copy of an entry field object |
get_Nth_field( ) | returns a copy of the indexed field object |
fill( ) | calls the fill method for all field object in the entry |
Description
The basic unit of storage on OPUS blackboards is the "entry". Entry objects decompose further still into individual field objects. This class serves as a base class from which the various blackboards derive their specialized entry objects.
Derived from
See Also:
Entry::Entry - The Entry constructor.
Synopsis
Entry::Entry() Entry::Entry( const Entry& e) // I - object to use as an initializer
Description
Constructs an empty (one that contains no fields) Entry object.
Exceptions Thrown
Entry::~Entry - The Entry destructor.
Synopsis
Entry::~Entry()
Description
The destructor deletes each field object in the entry.
Exceptions Thrown
Entry::operator== - Compare the Entry object with another.
Synopsis
bool Entry::operator==( const Entry* ee) // I - compare Entry to this object const
Description
This operator performs a comparison between the object and the one indicated in the argument. Two entries are equal if they have the same number of fields stored, in the same order, and operator== returns true for each pair of Field objects.
***Note that a pointer to the object with which the comparison is to be made is required, not a reference.
Returns
true - if the objects meet the equality conditions stated in thedescription.
false - if the objects are not identical as stated in the description.
Exceptions Thrown
Example
// compare two Entry object Entry* a = new Entry(); Entry* b = new Entry(); if (*a == b) cout << "Entries are equal.";
Entry::operator= - Assign an Entry the value of another.
Synopsis
Entry& Entry::operator=( const Entry& e) // I - the object to assign from
Description
This operator first deletes any existing fields in the Entry, then inserts a copy of each Field object in the calling argument.
Returns
A reference to the Entry object.
Exceptions Thrown
Entry::clone - Create a copy of this object.
Synopsis
Entry* Entry::clone() const
Description
A new Entry object is constructed off the heap and initialized with the contents of this object, then returned to the caller. The client should delete the new object when it is no longer needed.
Returns
A pointer to a new Entry object initialized with this object.
Exceptions Thrown
Entry::size - Get the number of Field objects contained by the entry.
Synopsis
int Entry::size() const
Description
A count of the number of Field objects placed in the entry is returned.
Returns
The number of Field objects stored in the entry.
Exceptions Thrown
Entry::str - Get a string representation of the object.
Synopsis
string Entry::str() const
Description
This method concatenates the strings returned from calls to the str method of each of its fields, then returns the result. The order in which the fields were added to the entry determines the order in which the str calls are made.
Returns
The concatenated return strings from a call to each field's str method.
Exceptions Thrown
Entry::set_field - Add (or replace an existing) Field object to the entry.
Synopsis
void Entry::set_field( const Field* f) // I - add or replace this Field
Description
This method adds, or replaces (if a field with the ID of the argument already exists in the entry), a copy of the argument to the object.
Exceptions Thrown
Bad_val<Field*> | - if the argument is null; Bad_val.arg points to the calling argument |
Example
Field* f = new Field(0, 10, Field::UNDER); Entry* e = new Entry; e->set_field(f); // places a copy of f in e delete f;
Entry::get_field - Gets a copy of the Field object in the entry with the same ID as the field in the argument.
Synopsis
void Entry::get_field( Field* f) // I/O - sample of Field object to retrieve const
Description
The ID of the argument is used to search for a Field object in the entry with the same ID. If one is found, it is assigned to the calling argument.
Exceptions Thrown
Bad_val<Field*> | - if argument is null; Bad_val.arg points to the calling argument |
No_entry<Field*> | - if no Field object matching the calling argument is found; No_entry.arg points to the calling argument |
Example
Field* f = new Field(0, 10, Field::UNDER); Entry* e = new Entry; f.assign("test"); e->set_field(f); // place a copy of f in e delete f; f = new Field(0, 10, Field::UNDER); // create a field wth the ID // we want to fetch e->get_field(f); // replaces f's contents with // that in e delete e;
Entry::get_Nth_field - Gets a copy of the Nth Field object in the entry.
Synopsis
Field* Entry::get_Nth_field( const int i) // I - index of field to retrieve const
Description
A copy of the Nth (counting from zero) Field object in the entry is constructed off the heap and returned to the caller. The client should delete the new object when it is no longer needed.
Returns
A pointer to a copy of the indicated Field object.
Exceptions Thrown
Bad_val<int> | - if there is no Field object N; Bad_val.arg is the calling argument |
Example
Field* f = new Field(0, 10, Field::UNDER); Entry* e = new Entry; f.assign("test"); e->set_field(f); // place a copy of f in e delete f; f = get_Nth_field(1); // retrieve a copy of the field delete f;
Entry::fill - Call the fill method of each field in the entry.
Synopsis
void Entry::fill( const char c) // I - fill character
Description
The fill method of each Field object in the entry is called in the order in which the fields were added to the entry with the calling argument.
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