asdmbinaries::SDMDataObjectStreamReader Class Reference

#include <SDMDataObjectStreamReader.h>

List of all members.

Public Types

enum  BINATTACHCODES {
  ACTUALDURATIONS,
  ACTUALTIMES,
  AUTODATA,
  FLAGS,
  CROSSDATA,
  ZEROLAGS
}

Public Member Functions

 SDMDataObjectStreamReader ()
virtual ~SDMDataObjectStreamReader ()
void open (const string &path)
 Open a file expected to contain BDF data, read and parse the global header.
int64_t position ()
 Returns the current position in the BDF file.
void position (int64_t p)
 Set the read position in the BDF file.
void close ()
 Close the file containing the BDF data and releases all the memory dynamically allocated.
unsigned long long currentIntegrationStartsAt () const
 Returns the current position in bytes in the file of the current block of data (subscan, integration or subintegration) .
unsigned int currentIntegrationIndex () const
 Returns the index of the current block of data (subscan, integration or subintegration).
string title () const
 Returns the title of the SDMDataObject.
const ByteOrderbyteOrder () const
 Returns the byte order of the SDMDataObject.
unsigned long long startTime () const
 Returns the start time.
unsigned int numTime () const
 Returns the number of (sub) integrations.
string dataOID () const
 Returns the dataOID.
string execBlockUID () const
 Returns the UID of the ExecBlock.
unsigned int execBlockNum () const
 Returns the number of the ExecBlock.
unsigned int scanNum () const
 Returns the number of the scan.
unsigned int subscanNum () const
 Returns the number of the subscan.
string projectPath () const
 Returns the project path.
unsigned int numAntenna () const
 Returns the number of antenna.
CorrelationMode correlationMode () const
 Returns the correlation mode.
OptionalSpectralResolutionType spectralResolutionType () const
 Returns the spectral resolution.
ProcessorType processorType () const
 Returns the processor type.
CorrelatorType correlatorType () const
 Returns the correlator type.
bool hasPackedData () const
 Returns true if the binary data are all packed in one subset or distributed in a sequence of subsets (supposedly) along the time axis.
bool isTP () const
 Returns true if the data are total power data and false otherwise.
bool isWVR () const
 Returns true if the data are WVR data and false otherwise.
bool isCorrelation () const
 Returns true if the data are correlator data and false otherwise.
const SDMDataObject::DataStructdataStruct () const
 Returns the structure of the data.
bool aborted () const
 Returns true if the observation has been aborted.
unsigned long long abortTime () const
 Returns the time, as an unsigned long long, at which the observation has been aborted.
string abortReason () const
 Returns the reason, as a string, why the observation has been aborted.
string toString () const
 Returns a string representation of the global header of this SDMDataObject.
bool hasSubset ()
 Returns true as long as the mark announcing the end of the sequence of (sub)integrations is not read in the stream.
const SDMDataSubsetgetSubset ()
const vector< SDMDataSubset > & nextSubsets (unsigned int nSubsets)
const vector< SDMDataSubset > & allRemainingSubsets ()

Public Attributes

bitset< 6 > attachmentFlags

Private Types

enum  States {
  S_NO_BDF,
  S_AT_BEGINNING,
  S_READING,
  S_AT_END
}
 

Enumerations to manage the state of an instance of SDMDataObjectStreamReader.

More...
enum  Transitions {
  T_OPEN,
  T_QUERY,
  T_TEST_END,
  T_READ,
  T_READ_NEXT,
  T_READ_ALL,
  T_CLOSE
}

Private Member Functions

void checkState (Transitions t, const string &methodName) const
 Private methods.
string nextLine ()
pair< string, string > headerField2Pair (const string &hf)
pair< string, string > requireHeaderField (const string &hf)
string requireMIMEHeader ()
string requireBoundaryInCT (const string &ctValue)
void skipAsLongAsLineStartsWith (const string &start)
void skipUntilEmptyLine (int maxSkips)
string accumulateUntilBoundary (const string &boundary, int maxLines)
void requireBoundary (const string &, int maxLines)
void lookForBinaryPartSize (xmlNode *aNode)
string requireCrossDataType (xmlNode *parent)
void printElementNames (xmlNode *a_node)
void requireSDMDataHeaderMIMEPart ()
void requireSDMDataSubsetMIMEPart (SDMDataSubset &sdmDataSubset)
void releaseMemory (SDMDataSubset &sdmDataSubset)

Private Attributes

unsigned long long integrationStartsAt
 Private variables.
unsigned int integrationIndex
string path
ifstream f
States currentState
string currentLine
string boundary_1
string boundary_2
bool opened
map< string, int64_t > binaryPartSize
set< string > s_partNames
char * actualTimesBuffer
char * actualDurationsBuffer
char * autoDataBuffer
char * crossDataBuffer
char * flagsBuffer
char * zeroLagsBuffer
SDMDataObjectParser parser
SDMDataObject sdmDataObject
SDMDataSubset sdmDataSubset
vector< SDMDataSubsetremainingSubsets
vector< SDMDataSubsetsomeSubsets

Detailed Description

Definition at line 37 of file SDMDataObjectStreamReader.h.


Member Enumeration Documentation

Enumerator:
ACTUALDURATIONS 
ACTUALTIMES 
AUTODATA 
FLAGS 
CROSSDATA 
ZEROLAGS 

Definition at line 304 of file SDMDataObjectStreamReader.h.

Enumerations to manage the state of an instance of SDMDataObjectStreamReader.

Enumerator:
S_NO_BDF 
S_AT_BEGINNING 
S_READING 
S_AT_END 

Definition at line 310 of file SDMDataObjectStreamReader.h.

Enumerator:
T_OPEN 
T_QUERY 
T_TEST_END 
T_READ 
T_READ_NEXT 
T_READ_ALL 
T_CLOSE 

Definition at line 311 of file SDMDataObjectStreamReader.h.


Constructor & Destructor Documentation

asdmbinaries::SDMDataObjectStreamReader::SDMDataObjectStreamReader (  ) 
virtual asdmbinaries::SDMDataObjectStreamReader::~SDMDataObjectStreamReader (  )  [virtual]

Member Function Documentation

bool asdmbinaries::SDMDataObjectStreamReader::aborted (  )  const

Returns true if the observation has been aborted.

This method must be used on an SDMDataObject containing correlator data,otherwise a SDMDataObjectException is thrown.

Returns:
a bool.
Exceptions:
SDMDataObjectException. 
string asdmbinaries::SDMDataObjectStreamReader::abortReason (  )  const

Returns the reason, as a string, why the observation has been aborted.

The returned value is significant only if the observation has been aborted, therefore the method must always be used in conjuction with the aborted method. This method must be used on an SDMDataObject containing correlator data, otherwise a SDMDataObjectException is thrown.

Returns:
a string.
Exceptions:
SDMDataObjectException 
unsigned long long asdmbinaries::SDMDataObjectStreamReader::abortTime (  )  const

Returns the time, as an unsigned long long, at which the observation has been aborted.

The returned value is significant only if the observation has been aborted, therefore the method must always be used in conjuction with the aborted method. This method must be used on an SDMDataObject containing correlator data, otherwise a SDMDataObjectException is thrown.

Returns:
an unsigned long long.
Exceptions:
SDMDataObjectException 
string asdmbinaries::SDMDataObjectStreamReader::accumulateUntilBoundary ( const string &  boundary,
int  maxLines 
) [private]
const vector<SDMDataSubset>& asdmbinaries::SDMDataObjectStreamReader::allRemainingSubsets (  ) 
const ByteOrder* asdmbinaries::SDMDataObjectStreamReader::byteOrder (  )  const

Returns the byte order of the SDMDataObject.

Returns:
a pointer to a ByteOrder instance.
void asdmbinaries::SDMDataObjectStreamReader::checkState ( Transitions  t,
const string &  methodName 
) const [private]

Private methods.

void asdmbinaries::SDMDataObjectStreamReader::close (  ) 

Close the file containing the BDF data and releases all the memory dynamically allocated.

CorrelationMode asdmbinaries::SDMDataObjectStreamReader::correlationMode (  )  const

Returns the correlation mode.

Returns:
a value from enumeration CorrelationMode.
CorrelatorType asdmbinaries::SDMDataObjectStreamReader::correlatorType (  )  const

Returns the correlator type.

Returns:
a value from the enumeration CorrelatorType if processorType == CORRELATOR else an SDMDataObjectException is thrown.
Exceptions:
SDMDataException 
unsigned int asdmbinaries::SDMDataObjectStreamReader::currentIntegrationIndex (  )  const

Returns the index of the current block of data (subscan, integration or subintegration).

The indexing is 0 based.

Returns:
an unsigned int.
unsigned long long asdmbinaries::SDMDataObjectStreamReader::currentIntegrationStartsAt (  )  const

Returns the current position in bytes in the file of the current block of data (subscan, integration or subintegration) .

Returns:
a long long unsigned int.
string asdmbinaries::SDMDataObjectStreamReader::dataOID (  )  const

Returns the dataOID.

Returns:
a string.
const SDMDataObject::DataStruct& asdmbinaries::SDMDataObjectStreamReader::dataStruct (  )  const

Returns the structure of the data.

Returns:
a reference to a DataStruct.
unsigned int asdmbinaries::SDMDataObjectStreamReader::execBlockNum (  )  const

Returns the number of the ExecBlock.

Returns:
an unsigned int.
string asdmbinaries::SDMDataObjectStreamReader::execBlockUID (  )  const

Returns the UID of the ExecBlock.

Returns:
a string.
const SDMDataSubset& asdmbinaries::SDMDataObjectStreamReader::getSubset (  ) 
bool asdmbinaries::SDMDataObjectStreamReader::hasPackedData (  )  const

Returns true if the binary data are all packed in one subset or distributed in a sequence of subsets (supposedly) along the time axis.

Returns:
a boolean
bool asdmbinaries::SDMDataObjectStreamReader::hasSubset (  ) 

Returns true as long as the mark announcing the end of the sequence of (sub)integrations is not read in the stream.

pair<string, string> asdmbinaries::SDMDataObjectStreamReader::headerField2Pair ( const string &  hf  )  [private]
bool asdmbinaries::SDMDataObjectStreamReader::isCorrelation (  )  const

Returns true if the data are correlator data and false otherwise.

Returns:
a bool.
Note:
data are considered as correlator data if SpectralResolutionType != BASEBAND_WIDE.
bool asdmbinaries::SDMDataObjectStreamReader::isTP (  )  const

Returns true if the data are total power data and false otherwise.

Returns:
a bool.
Note:
data are considered as total power data if CorrelationMode == AUTO_ONLY && SpectralResolutionType == BASEBAND_WIDE.
bool asdmbinaries::SDMDataObjectStreamReader::isWVR (  )  const

Returns true if the data are WVR data and false otherwise.

Returns:
a bool.
Note:
data are considered as total power data if CorrelationMode == AUTO_ONLY && SpectralResolutionType == BASEBAND_WIDE.
void asdmbinaries::SDMDataObjectStreamReader::lookForBinaryPartSize ( xmlNode aNode  )  [private]
string asdmbinaries::SDMDataObjectStreamReader::nextLine (  )  [private]
const vector<SDMDataSubset>& asdmbinaries::SDMDataObjectStreamReader::nextSubsets ( unsigned int  nSubsets  ) 
unsigned int asdmbinaries::SDMDataObjectStreamReader::numAntenna (  )  const

Returns the number of antenna.

Returns:
an unsigned int.
unsigned int asdmbinaries::SDMDataObjectStreamReader::numTime (  )  const

Returns the number of (sub) integrations.

Returns:
an unsigned int.
void asdmbinaries::SDMDataObjectStreamReader::open ( const string &  path  ) 

Open a file expected to contain BDF data, read and parse the global header.

On exit the first block of data (subscan, integration or subintegration) is ready to be read by the getData method.

Exceptions:
SDMDataObjectStreamReaderException,SDMDataObjectException,SDMDataObjectParserException. 
void asdmbinaries::SDMDataObjectStreamReader::position ( int64_t  p  ) 

Set the read position in the BDF file.

int64_t asdmbinaries::SDMDataObjectStreamReader::position (  ) 

Returns the current position in the BDF file.

or -1 if it fails to determine the position.

Returns:
an int64_t
void asdmbinaries::SDMDataObjectStreamReader::printElementNames ( xmlNode a_node  )  [private]
ProcessorType asdmbinaries::SDMDataObjectStreamReader::processorType (  )  const

Returns the processor type.

Returns:
a value from the enumeration ProcessorType.
string asdmbinaries::SDMDataObjectStreamReader::projectPath (  )  const

Returns the project path.

The project path is a string of the form "/<s>execBlockNum</s>/<s>scanNum</s>/<s>subscanNum</s>"

void asdmbinaries::SDMDataObjectStreamReader::releaseMemory ( SDMDataSubset sdmDataSubset  )  [private]
void asdmbinaries::SDMDataObjectStreamReader::requireBoundary ( const string &  ,
int  maxLines 
) [private]
string asdmbinaries::SDMDataObjectStreamReader::requireBoundaryInCT ( const string &  ctValue  )  [private]
string asdmbinaries::SDMDataObjectStreamReader::requireCrossDataType ( xmlNode parent  )  [private]
pair<string, string> asdmbinaries::SDMDataObjectStreamReader::requireHeaderField ( const string &  hf  )  [private]
string asdmbinaries::SDMDataObjectStreamReader::requireMIMEHeader (  )  [private]
void asdmbinaries::SDMDataObjectStreamReader::requireSDMDataHeaderMIMEPart (  )  [private]
void asdmbinaries::SDMDataObjectStreamReader::requireSDMDataSubsetMIMEPart ( SDMDataSubset sdmDataSubset  )  [private]
unsigned int asdmbinaries::SDMDataObjectStreamReader::scanNum (  )  const

Returns the number of the scan.

Returns:
an unsigned int.
void asdmbinaries::SDMDataObjectStreamReader::skipAsLongAsLineStartsWith ( const string &  start  )  [private]
void asdmbinaries::SDMDataObjectStreamReader::skipUntilEmptyLine ( int  maxSkips  )  [private]
OptionalSpectralResolutionType asdmbinaries::SDMDataObjectStreamReader::spectralResolutionType (  )  const

Returns the spectral resolution.

Due to this optional nature, the spectral resolution type is not returned directly as a literal of the enumeration SpectralResolutionType, but as an instance of the class OptionalSpectralResolutionType. This instance can be queried to check if the spectral resolution type information is present and if it is its value as an SpectralResolutionType literal.

Returns:
a value from enumeration SpectralResolutionType.
unsigned long long asdmbinaries::SDMDataObjectStreamReader::startTime (  )  const

Returns the start time.

Returns:
a long long.
unsigned int asdmbinaries::SDMDataObjectStreamReader::subscanNum (  )  const

Returns the number of the subscan.

Returns:
an unsigned int.
string asdmbinaries::SDMDataObjectStreamReader::title (  )  const

Returns the title of the SDMDataObject.

Returns:
a string.
string asdmbinaries::SDMDataObjectStreamReader::toString (  )  const

Returns a string representation of the global header of this SDMDataObject.

Returns:
a string.

Member Data Documentation

Definition at line 327 of file SDMDataObjectStreamReader.h.

Definition at line 326 of file SDMDataObjectStreamReader.h.

Definition at line 305 of file SDMDataObjectStreamReader.h.

Definition at line 328 of file SDMDataObjectStreamReader.h.

Definition at line 324 of file SDMDataObjectStreamReader.h.

Definition at line 320 of file SDMDataObjectStreamReader.h.

Definition at line 321 of file SDMDataObjectStreamReader.h.

Definition at line 329 of file SDMDataObjectStreamReader.h.

Definition at line 319 of file SDMDataObjectStreamReader.h.

Definition at line 318 of file SDMDataObjectStreamReader.h.

Definition at line 317 of file SDMDataObjectStreamReader.h.

Definition at line 330 of file SDMDataObjectStreamReader.h.

Definition at line 315 of file SDMDataObjectStreamReader.h.

Private variables.

Definition at line 314 of file SDMDataObjectStreamReader.h.

Definition at line 322 of file SDMDataObjectStreamReader.h.

Definition at line 333 of file SDMDataObjectStreamReader.h.

Definition at line 316 of file SDMDataObjectStreamReader.h.

Definition at line 336 of file SDMDataObjectStreamReader.h.

Definition at line 325 of file SDMDataObjectStreamReader.h.

Definition at line 334 of file SDMDataObjectStreamReader.h.

Definition at line 335 of file SDMDataObjectStreamReader.h.

Definition at line 337 of file SDMDataObjectStreamReader.h.

Definition at line 331 of file SDMDataObjectStreamReader.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1