casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
casa::RegionTextParser Class Reference

Parse and store regions and annotations from an ascii region file <author>Dave Mehringer</author> More...

#include <RegionTextParser.h>

List of all members.

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< AsciiAnnotationFileLinegetLines () 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 ()
RegionTextParseroperator= (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 &currentParamSet, 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

Detailed Description

Parse and store regions and annotations from an ascii region file <author>Dave Mehringer</author>

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

Etymology

This is a class designed to parse and store regions and annotations from an ascii region file

Synopsis

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.


Member Typedef Documentation

Definition at line 83 of file RegionTextParser.h.


Constructor & Destructor Documentation

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 
)

         

Definition at line 128 of file RegionTextParser.h.


Member Function Documentation

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]
Parameters:
qDirsconst 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]
static Vector<Stokes::StokesTypes> casa::RegionTextParser::_stokesFromString ( const String stokes,
const String preamble 
) [static, private]
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]

Member Data Documentation

Definition at line 119 of file RegionTextParser.h.

Definition at line 121 of file RegionTextParser.h.

Definition at line 124 of file RegionTextParser.h.

Definition at line 123 of file RegionTextParser.h.

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.

Definition at line 126 of file RegionTextParser.h.

const String casa::RegionTextParser::bTwoPair [static, private]

Definition at line 114 of file RegionTextParser.h.

Definition at line 64 of file RegionTextParser.h.

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.

Definition at line 116 of file RegionTextParser.h.


The documentation for this class was generated from the following file: