HiRISE
 libHiRISE

Enumerations | Functions | Variables

Make_Observation_ID.cc File Reference

#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <libgen.h>
#include "Observation_ID.hh"
Include dependency graph for Make_Observation_ID.cc:

Enumerations

enum  Exit_Code {
  SUCCESS = 0,
  BAD_ID,
  THREW_INVALID_ARGUMENT_EXCEPTION,
  THREW_OTHER_EXCEPTION,
  THREW_UNKNOWN_EXCEPTION
}

Functions

int main (int argument_count, char **arguments)
 A command-line application to generate observation IDs from text.

Variables

static const char * ID = "Make_Observation_ID (2.6, 2020/02/14 00:58:12)"

Enumeration Type Documentation

enum Exit_Code
Enumerator:
SUCCESS 
BAD_ID 
THREW_INVALID_ARGUMENT_EXCEPTION 
THREW_OTHER_EXCEPTION 
THREW_UNKNOWN_EXCEPTION 

Function Documentation

int main ( int  argument_count,
char **  arguments 
)

A command-line application to generate observation IDs from text.

Synopsis

Make_Observation_ID [-Dec] [-HEX] [-No_newline] id_1 [id_2 ...]

Make_Observation_ID -Version

Make_Observation_ID [-Help]

Description

Make_Observation_ID generates one or more observation IDs based on command-line input. Each non-switch argument is parsed in an attempt to extract an observation ID. Potential observation IDs may be of the following forms:

  • A simple decimal integer.
  • A hexadecimal number, preceded by 0x or 0X.
  • An embedded pre-orbit observation ID.
  • An embedded in-orbit observation ID.
  • An embedded RSDS test venue filename.
  • An embedded RSDS operations venue filename.
  • An embedded JPL-style day-of-year date.
  • An embedded RSDS test ID (timestamp).
  • An embedded hexadecimal number, with or without a leading 0x or 0X.

"Embedded" means the text can be found within additional text, provided the text is one single argument. For example, ID=CRU_000027_1000 contains an embedded in-orbit observation ID, CRU_000027_1000.

Non-switch arguments that are identified as observation IDs are reported to the standard output stream in their conventional text form after parsing is complete. Optional switches control the form of the output somewhat. By default, only the text form is reported, followed by a newline character. The newline may be surpressed, and the decimal form or the hex form of the ID may also be reported.

Non-switch arguments that cannot be identified as observation IDs are reported to the standard error stream after parsing is complete. If such bad arguments are found, the application exits with a non-zero exit status.

Options

The following options are not case-sensitive. They may be reduced to the character sequence indicated in uppercase for simplicity's sake.

-Dec
Display the observation IDs in their decimal form as well as their text form.
-HEX
Display the observation IDs in their hexadecimal form as well as their text form.
-No_newline
Surpress the newline after each reported observation ID.
-Version
Report the version identifier of Make_Observation_ID and the Observation_ID class to standard output stream and exit with success.
-Help
Report a simple help message to the standard output stream and exit with success.

If no arguments are supplied to the application, the help statement is reported on the standard output stream and the application exits with success.

Exit Status

Make_Observation_ID exits with one of the following statuses, depending on the circumstances of its processing. All error messages are written to the standard error stream.

0, Success
The processing of input was successful.
1, Bad ID
One or more input argument was found not to include a valid observation ID. Note that valid IDs are still reported, so this exit status may indicate a partial success.
2, Invalid Argument
An invalid argument was encountered on the command line. A HiRISE::Invalid_Argument exception was thrown and the message text reported to the standard error stream.
3, Other Exception
Some other exception was thrown during the execution of the application. Its message, if any, was reported to the standard error stream.
4, Unknown Exception
An unknown exception was thrown. This fact was reported to the standard error stream.
Author:
Christian Schaller - UA/PIRL
Version:
2.6

References BAD_ID, ID, SUCCESS, and Observation_ID::value().


Variable Documentation

const char* ID = "Make_Observation_ID (2.6, 2020/02/14 00:58:12)" [static]