[OPUS]

Dcf_num - A field object that stores the DCF_NUM portion of an OSF.


Availability:

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

Constructors:
Dcf_num( )
~Dcf_num( )

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

Description

Dcf_num objects manage the DCF_NUM portion of an OSF.

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;
  
       Dcf_num* did = new Dcf_num("123");       // set DCF_NUM 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:


Dcf_num::Dcf_num - The Dcf_num constructor.

Synopsis


Dcf_num::Dcf_num(
                 const string& s) // I - DCF_NUM string

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

Description

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

Exceptions Thrown

none


Dcf_num::~Dcf_num - The Dcf_num destructor.

Synopsis


Dcf_num::~Dcf_num()

Description

This method destroys the object.

Exceptions Thrown

none


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

Synopsis


Field* Dcf_num::clone() const

Description

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

Exceptions Thrown

none


Dcf_num::name - Get the field name

Synopsis


string Dcf_num::name() const 

Description

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

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