[OPUS]

Dataset - A field object that stores the DATASET portion of an OSF.


Availability:

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

Constructors:
Dataset( )
~Dataset( )

Methods:
clone( ) returns a copy of this object
name( ) gets the field name

Description

Dataset objects contain the name of the element that the OSF is tracking. This field, along with the Time_stamp field, uniquely identifies an OSF on the OSF Blackboard.

Derived from

Field

Example

  
    #include <iostream>
    #include "file_osf_bb.h"
    #include "file_osf.h"
    #include "dataset.h"
    #include "data_id.h"
    #include "time_stamp.h"
    #include "opus_lock.h"
  
    using namespace std;
  
    // The following example uses the File OSF Blackboard to find
    // an OSF on disk, then delete it.
    int main(int argc, char* argv[])
    {
       File_osf_bb* obb = new File_osf_bb("/home/opus/sci_osfs/");
       Osf*        fosf = obb->new_osf();       // padded except
                                                // for time stamp
  
       fosf->search_fill_all();                 // place search characters
                                                // in all fields
  
       Dataset* dat = new Dataset("N12345678"); // set DATASET field
       fosf->set_field(dat);
       delete dat;
  
       Data_id* did = new Data_id("SCI");       // set DATA_ID field
       fosf->set_field(did);
       delete did;
  
       vector<Entry*> res;
       if (obb->search(fosf, res)) {            // search for OSF
          Opus_lock* lck = 0;
          try {                                 // attempt lock on OSF
             lck = obb->lock_entry(res[0]);
             obb->erase(res[0]);                // delete it
             cout << "Deleted OSF: " << fosf->str() << endl;
          }
          catch(...) {
             cout << "Failed to delete OSF: " << res[0]->str()
                  << endl;
          }
          delete lck;                           // release & delete
          delete res[0];
       } else {
          cout << "Could not find OSF: " << fosf->str() << endl;
       }
       delete fosf;
       delete obb;
       return(0);
    }
  

See Also:


Dataset::Dataset - The Dataset constructor.

Synopsis


Dataset::Dataset(
                 const string& s) // I - DATASET string

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

Description

This method constructs a new Dataset object, and assigns it the value of the string argument. The default size of this field is 23 characters and it uses the default pad character for Field objects.

Exceptions Thrown

none


Dataset::~Dataset - The Dataset destructor.

Synopsis


Dataset::~Dataset()

Description

This method destroys the object.

Exceptions Thrown

none


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

Synopsis


Field* Dataset::clone() const

Description

This method creates a new Dataset 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 Dataset object initialized by this object.

Exceptions Thrown

none


Dataset::name - Get the field name

Synopsis


string Dataset::name() const

Description

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

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