casa
$Rev:20696$
|
Parse and store regions and annotations from an ascii region file <author>Dave Mehringer</author> More...
#include <RegionTextParser.h>
Classes | |
struct | ParamValue |
because of nonstandard access patterns, be careful when using ParamValue and ParamSet outside this class; These should probably be made into full fledged classes at some point; More... | |
Public Types | |
typedef std::map < AnnotationBase::Keyword, ParamValue > | ParamSet |
Public Member Functions | |
RegionTextParser (const String &filename, const CoordinateSystem &csys, const IPosition &imShape, const Int requireAtLeastThisVersion) | |
differentiating between the filename and simple text constructors | |
RegionTextParser (const CoordinateSystem &csys, const IPosition &imShape, const String &text) | |
~RegionTextParser () | |
Int | getFileVersion () const |
Vector< AsciiAnnotationFileLine > | getLines () const |
Static Public Member Functions | |
static ParamSet | getParamSet (Bool &spectralParmsUpdated, LogIO &log, const String &text, const String &preamble, const CoordinateSystem &csys) |
get the parameter set from a line of text ; preamble is prepended to exception messages; | |
Static Public Attributes | |
static const Int | CURRENT_VERSION |
static const Regex | MAGIC |
Private Member Functions | |
RegionTextParser () | |
RegionTextParser & | operator= (const RegionTextParser &) |
void | _parse (const String &contents, const String &fileDesc) |
Array< String > | _extractTwoPairs (uInt &end, const String &string) const |
void | _addLine (const AsciiAnnotationFileLine &line) |
AnnotationBase::Type | _getAnnotationType (Vector< Quantity > &qDirs, Vector< Quantity > &qunatities, String &textString, String &consumeMe, const String &preamble) const |
ParamSet | _getCurrentParamSet (Bool &spectralParmsUpdated, ParamSet &newParams, String &consumeMe, const String &preamble) const |
void | _createAnnotation (const AnnotationBase::Type annType, const Vector< Quantity > &qDirs, const Vector< Quantity > &qFreqs, const Vector< Quantity > &quantities, const String &textString, const ParamSet ¤tParamSet, const Bool annOnly, const Bool isDifference, const String &preamble) |
Vector< Quantity > | _quantitiesFromFrequencyString (const String &freqString, const String &preamble) const |
Vector< Quantity > | _extractQuantityPairAndSingleQuantity (String &consumeMe, const String &preamble) const |
Vector< Quantity > | _extractNQuantityPairs (String &consumeMe, const String &preamble) const |
Vector< Quantity > | _extractTwoQuantityPairs (String &consumeMe, const String &preamble) const |
Vector< Quantity > | _extractSingleQuantityPair (const String &pair, const String &preamble) const |
void | _setInitialGlobals () |
Vector< Quantity > | _extractTwoQuantityPairsAndSingleQuantity (String &consumeMe, const String &preamble) const |
void | _extractQuantityPairAndString (Vector< Quantity > &quantities, String &string, String &consumeMe, const String &preamble, const Bool requireQuotesAroundString) const |
Vector< Quantity > | _extractQuantitiesFromPair (const String &pair, const String &preamble) const |
void | _determineVersion (const String &chunk, const String &filename, const Int requireAtLeastThisVersion) |
Static Private Member Functions | |
static Vector< String > | _extractSinglePair (const String &string) |
extract s1 and s2 from a string of the form "[s1, s2]" | |
static String | _doLabel (String &consumeMe, const String &logPreamble) |
static String | _getKeyValue (String &consumeMe, const String &preamble) |
static Vector < Stokes::StokesTypes > | _stokesFromString (const String &stokes, const String &preamble) |
Private Attributes | |
CoordinateSystem | _csys |
std::auto_ptr< LogIO > | _log |
ParamSet | _currentGlobals |
Vector< AsciiAnnotationFileLine > | _lines |
Vector< AnnotationBase::Keyword > | _globalKeysToApply |
Int | _fileVersion |
IPosition | _imShape |
uInt | _regions |
Static Private Attributes | |
static const String | sOnePair |
static const String | bTwoPair |
static const String | sNPair |
static const Regex | startOnePair |
static const Regex | startNPair |
Parse and store regions and annotations from an ascii region file <author>Dave Mehringer</author>
Public interface
This is a class designed to parse and store regions and annotations from an ascii region file
This class is for parsing and storing regions and annotations from an ascii region file . See the region file format proposal attached to CAS-2285 (https://bugs.nrao.edu/browse/CAS-2285)
Note: This class will create AnnotationBase pointers via new(); It is assumed the caller will make use of these pointers so they are not deleted upon deletion of the object; It is the caller's responsibility to delete them; To do so, call getLines() and loop through the returned Vector of AsciiRegionLines; For objects of type AsciiRegionLines::ANNOTATION, get the pointer and delete it;
Definition at line 60 of file RegionTextParser.h.
typedef std::map<AnnotationBase::Keyword, ParamValue> casa::RegionTextParser::ParamSet |
Definition at line 83 of file RegionTextParser.h.
casa::RegionTextParser::RegionTextParser | ( | const String & | filename, |
const CoordinateSystem & | csys, | ||
const IPosition & | imShape, | ||
const Int | requireAtLeastThisVersion | ||
) |
differentiating between the filename and simple text constructors
casa::RegionTextParser::RegionTextParser | ( | const CoordinateSystem & | csys, |
const IPosition & | imShape, | ||
const String & | text | ||
) |
casa::RegionTextParser::RegionTextParser | ( | ) | [inline, private] |
Definition at line 128 of file RegionTextParser.h.
void casa::RegionTextParser::_addLine | ( | const AsciiAnnotationFileLine & | line | ) | [private] |
void casa::RegionTextParser::_createAnnotation | ( | const AnnotationBase::Type | annType, |
const Vector< Quantity > & | qDirs, | ||
const Vector< Quantity > & | qFreqs, | ||
const Vector< Quantity > & | quantities, | ||
const String & | textString, | ||
const ParamSet & | currentParamSet, | ||
const Bool | annOnly, | ||
const Bool | isDifference, | ||
const String & | preamble | ||
) | [private] |
qDirs | const Vector<MDirection> dirs, |
void casa::RegionTextParser::_determineVersion | ( | const String & | chunk, |
const String & | filename, | ||
const Int | requireAtLeastThisVersion | ||
) | [private] |
static String casa::RegionTextParser::_doLabel | ( | String & | consumeMe, |
const String & | logPreamble | ||
) | [static, private] |
Vector<Quantity> casa::RegionTextParser::_extractNQuantityPairs | ( | String & | consumeMe, |
const String & | preamble | ||
) | const [private] |
Vector<Quantity> casa::RegionTextParser::_extractQuantitiesFromPair | ( | const String & | pair, |
const String & | preamble | ||
) | const [private] |
Vector<Quantity> casa::RegionTextParser::_extractQuantityPairAndSingleQuantity | ( | String & | consumeMe, |
const String & | preamble | ||
) | const [private] |
void casa::RegionTextParser::_extractQuantityPairAndString | ( | Vector< Quantity > & | quantities, |
String & | string, | ||
String & | consumeMe, | ||
const String & | preamble, | ||
const Bool | requireQuotesAroundString | ||
) | const [private] |
static Vector<String> casa::RegionTextParser::_extractSinglePair | ( | const String & | string | ) | [static, private] |
extract s1 and s2 from a string of the form "[s1, s2]"
Vector<Quantity> casa::RegionTextParser::_extractSingleQuantityPair | ( | const String & | pair, |
const String & | preamble | ||
) | const [private] |
Array<String> casa::RegionTextParser::_extractTwoPairs | ( | uInt & | end, |
const String & | string | ||
) | const [private] |
Vector<Quantity> casa::RegionTextParser::_extractTwoQuantityPairs | ( | String & | consumeMe, |
const String & | preamble | ||
) | const [private] |
Vector<Quantity> casa::RegionTextParser::_extractTwoQuantityPairsAndSingleQuantity | ( | String & | consumeMe, |
const String & | preamble | ||
) | const [private] |
AnnotationBase::Type casa::RegionTextParser::_getAnnotationType | ( | Vector< Quantity > & | qDirs, |
Vector< Quantity > & | qunatities, | ||
String & | textString, | ||
String & | consumeMe, | ||
const String & | preamble | ||
) | const [private] |
ParamSet casa::RegionTextParser::_getCurrentParamSet | ( | Bool & | spectralParmsUpdated, |
ParamSet & | newParams, | ||
String & | consumeMe, | ||
const String & | preamble | ||
) | const [private] |
static String casa::RegionTextParser::_getKeyValue | ( | String & | consumeMe, |
const String & | preamble | ||
) | [static, private] |
void casa::RegionTextParser::_parse | ( | const String & | contents, |
const String & | fileDesc | ||
) | [private] |
Vector<Quantity> casa::RegionTextParser::_quantitiesFromFrequencyString | ( | const String & | freqString, |
const String & | preamble | ||
) | const [private] |
void casa::RegionTextParser::_setInitialGlobals | ( | ) | [private] |
static Vector<Stokes::StokesTypes> casa::RegionTextParser::_stokesFromString | ( | const String & | stokes, |
const String & | preamble | ||
) | [static, private] |
Int casa::RegionTextParser::getFileVersion | ( | ) | const |
static ParamSet casa::RegionTextParser::getParamSet | ( | Bool & | spectralParmsUpdated, |
LogIO & | log, | ||
const String & | text, | ||
const String & | preamble, | ||
const CoordinateSystem & | csys | ||
) | [static] |
get the parameter set from a line of text
; preamble
is prepended to exception messages;
RegionTextParser& casa::RegionTextParser::operator= | ( | const RegionTextParser & | ) | [private] |
Definition at line 119 of file RegionTextParser.h.
Definition at line 121 of file RegionTextParser.h.
Int casa::RegionTextParser::_fileVersion [private] |
Definition at line 124 of file RegionTextParser.h.
Definition at line 123 of file RegionTextParser.h.
IPosition casa::RegionTextParser::_imShape [private] |
Definition at line 125 of file RegionTextParser.h.
Definition at line 122 of file RegionTextParser.h.
std::auto_ptr<LogIO> casa::RegionTextParser::_log [private] |
Definition at line 120 of file RegionTextParser.h.
uInt casa::RegionTextParser::_regions [private] |
Definition at line 126 of file RegionTextParser.h.
const String casa::RegionTextParser::bTwoPair [static, private] |
Definition at line 114 of file RegionTextParser.h.
const Int casa::RegionTextParser::CURRENT_VERSION [static] |
Definition at line 64 of file RegionTextParser.h.
const Regex casa::RegionTextParser::MAGIC [static] |
Definition at line 65 of file RegionTextParser.h.
const String casa::RegionTextParser::sNPair [static, private] |
Definition at line 115 of file RegionTextParser.h.
const String casa::RegionTextParser::sOnePair [static, private] |
Definition at line 113 of file RegionTextParser.h.
const Regex casa::RegionTextParser::startNPair [static, private] |
Definition at line 117 of file RegionTextParser.h.
const Regex casa::RegionTextParser::startOnePair [static, private] |
Definition at line 116 of file RegionTextParser.h.