This class is available for the OPUS Blackboard API. The initial OPUS 2.0 release is described here
Constructors:
Ofile( ) | |
~Ofile( ) |
Methods:
assign( ) | specify a stretch name for the object |
resolve( ) | resolve the stretch |
Description
Ofile objects know how to resolve directory stretches for file names containing them. The directory stretch name appears before the file name and is separated from it by a colon. The file must exist somewhere in the stretch in order for it to be resolved.
Example
#include <iostream> #include "opus_env.h" #include "ofile.h" using namespace std; // The following example demonstrates the directory stretch // resolution capabilities of Ofile int main(int argc, char* argv[]) { Opus_env opus(argc, argv); // initialize OPUS if (!opus.is_initialized()) { cerr << "OPUS failed to initialize." << endl; return(-1); } Ofile of("OPUS_DEFINITIONS_DIR:opus_login.csh"); cout << "The location of opus_login.csh is: " << of.resolve() << endl; return(0); }
See Also:
Ofile::Ofile - The Ofile object constructor.
Synopsis
Ofile::Ofile() Ofile::Ofile( const string& fname) // I - stretched file name
Description
The constructor creates a new Ofile object and assigns an argument to the stretched name.
Exceptions Thrown
Ofile::~Ofile - The Ofile object destructor.
Synopsis
Ofile::~Ofile()
Description
This method destroys the object.
Exceptions Thrown
Ofile::assign - Assign a stretched file specification to the object.
Synopsis
void Ofile::assign( const string& s) // I - stretched file name
Description
This method sets (or resets) the stretched name associated with the object. The stretched name need not exist at this point.
Exceptions Thrown
Ofile::resolve - Resolve the stretched file name into a full file specification.
Synopsis
string Ofile::resolve() const
Description
An attempt is made to resolve the stretched file name into a file specification when this method is called. The stretch must be defined and it must contain the target file name. The first instance of the file located in the stretch is returned.
Returns
The full file specification.
Exceptions Thrown
Bad_val<string> | - if the stretch cannot be resolved; Bad_val.arg contains the stretched file name |
Bad_val<vector<string>> | - if the calling arguments are incorrect; Bad_val.arg is a vector containing the calling arguments |
Io_error<int> | - if the disk space check fails; Io_error.arg contains the value of errno |
Bad_val<vector<string>> | - if calling arguments are incorrect; Bad_val.arg is a vector containing the calling arguments |
Exec<int> | - if the subprocess spawn attempt fails; Exec.arg contains the return status from the spawn attemp |
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