casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
asdmbinaries::SDMDataObjectStreamReader Class Reference

#include <SDMDataObjectStreamReader.h>

Public Types

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

Public Member Functions

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

Public Attributes

std::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 std::string &methodName) const
 Private methods. More...
 
std::string nextLine ()
 
std::pair< std::string,
std::string > 
headerField2Pair (const std::string &hf)
 
std::pair< std::string,
std::string > 
requireHeaderField (const std::string &hf)
 
std::string requireMIMEHeader ()
 
std::string requireBoundaryInCT (const std::string &ctValue)
 
void skipAsLongAsLineStartsWith (const std::string &start)
 
void skipUntilEmptyLine (int maxSkips)
 
std::string accumulateUntilBoundary (const std::string &boundary, int maxLines)
 
void requireBoundary (const std::string &, int maxLines)
 
void lookForBinaryPartSize (xmlNode *aNode)
 
std::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. More...
 
unsigned int integrationIndex
 
std::string path
 
std::ifstream f
 
States currentState
 
std::string currentLine
 
std::string boundary_1
 
std::string boundary_2
 
bool opened
 
std::map< std::string, int64_t > binaryPartSize
 
std::set< std::string > s_partNames
 
char * actualTimesBuffer
 
char * actualDurationsBuffer
 
char * autoDataBuffer
 
char * crossDataBuffer
 
char * flagsBuffer
 
char * zeroLagsBuffer
 
SDMDataObjectParser parser
 
SDMDataObject sdmDataObject
 
SDMDataSubset sdmDataSubset
 
std::vector< SDMDataSubsetremainingSubsets
 
std::vector< SDMDataSubsetsomeSubsets
 

Detailed Description

Definition at line 38 of file SDMDataObjectStreamReader.h.

Member Enumeration Documentation

Enumerator
ACTUALDURATIONS 
ACTUALTIMES 
AUTODATA 
FLAGS 
CROSSDATA 
ZEROLAGS 

Definition at line 305 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 311 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 312 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.
std::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
std::string asdmbinaries::SDMDataObjectStreamReader::accumulateUntilBoundary ( const std::string &  boundary,
int  maxLines 
)
private
const std::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 std::string &  methodName 
) const
private

Private methods.

void asdmbinaries::SDMDataObjectStreamReader::close ( )

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

CorrelationModeMod::CorrelationMode asdmbinaries::SDMDataObjectStreamReader::correlationMode ( ) const

Returns the correlation mode.

Returns
a value from enumeration CorrelationMode.
CorrelatorTypeMod::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.
std::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.
std::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.

std::pair<std::string, std::string> asdmbinaries::SDMDataObjectStreamReader::headerField2Pair ( const std::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
std::string asdmbinaries::SDMDataObjectStreamReader::nextLine ( )
private
const std::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 std::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.
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::position ( int64_t  p)

Set the read position in the BDF file.

void asdmbinaries::SDMDataObjectStreamReader::printElementNames ( xmlNode a_node)
private
ProcessorTypeMod::ProcessorType asdmbinaries::SDMDataObjectStreamReader::processorType ( ) const

Returns the processor type.

Returns
a value from the enumeration ProcessorType.
std::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 std::string &  ,
int  maxLines 
)
private
std::string asdmbinaries::SDMDataObjectStreamReader::requireBoundaryInCT ( const std::string &  ctValue)
private
std::string asdmbinaries::SDMDataObjectStreamReader::requireCrossDataType ( xmlNode parent)
private
std::pair<std::string, std::string> asdmbinaries::SDMDataObjectStreamReader::requireHeaderField ( const std::string &  hf)
private
std::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 std::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.
std::string asdmbinaries::SDMDataObjectStreamReader::title ( ) const

Returns the title of the SDMDataObject.

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

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

Returns
a string.

Member Data Documentation

char* asdmbinaries::SDMDataObjectStreamReader::actualDurationsBuffer
private

Definition at line 328 of file SDMDataObjectStreamReader.h.

char* asdmbinaries::SDMDataObjectStreamReader::actualTimesBuffer
private

Definition at line 327 of file SDMDataObjectStreamReader.h.

std::bitset<6> asdmbinaries::SDMDataObjectStreamReader::attachmentFlags

Definition at line 306 of file SDMDataObjectStreamReader.h.

char* asdmbinaries::SDMDataObjectStreamReader::autoDataBuffer
private

Definition at line 329 of file SDMDataObjectStreamReader.h.

std::map<std::string, int64_t> asdmbinaries::SDMDataObjectStreamReader::binaryPartSize
private

Definition at line 325 of file SDMDataObjectStreamReader.h.

std::string asdmbinaries::SDMDataObjectStreamReader::boundary_1
private

Definition at line 321 of file SDMDataObjectStreamReader.h.

std::string asdmbinaries::SDMDataObjectStreamReader::boundary_2
private

Definition at line 322 of file SDMDataObjectStreamReader.h.

char* asdmbinaries::SDMDataObjectStreamReader::crossDataBuffer
private

Definition at line 330 of file SDMDataObjectStreamReader.h.

std::string asdmbinaries::SDMDataObjectStreamReader::currentLine
private

Definition at line 320 of file SDMDataObjectStreamReader.h.

States asdmbinaries::SDMDataObjectStreamReader::currentState
private

Definition at line 319 of file SDMDataObjectStreamReader.h.

std::ifstream asdmbinaries::SDMDataObjectStreamReader::f
private

Definition at line 318 of file SDMDataObjectStreamReader.h.

char* asdmbinaries::SDMDataObjectStreamReader::flagsBuffer
private

Definition at line 331 of file SDMDataObjectStreamReader.h.

unsigned int asdmbinaries::SDMDataObjectStreamReader::integrationIndex
private

Definition at line 316 of file SDMDataObjectStreamReader.h.

unsigned long long asdmbinaries::SDMDataObjectStreamReader::integrationStartsAt
private

Private variables.

Definition at line 315 of file SDMDataObjectStreamReader.h.

bool asdmbinaries::SDMDataObjectStreamReader::opened
private

Definition at line 323 of file SDMDataObjectStreamReader.h.

SDMDataObjectParser asdmbinaries::SDMDataObjectStreamReader::parser
private

Definition at line 334 of file SDMDataObjectStreamReader.h.

std::string asdmbinaries::SDMDataObjectStreamReader::path
private

Definition at line 317 of file SDMDataObjectStreamReader.h.

std::vector<SDMDataSubset> asdmbinaries::SDMDataObjectStreamReader::remainingSubsets
private

Definition at line 337 of file SDMDataObjectStreamReader.h.

std::set<std::string> asdmbinaries::SDMDataObjectStreamReader::s_partNames
private

Definition at line 326 of file SDMDataObjectStreamReader.h.

SDMDataObject asdmbinaries::SDMDataObjectStreamReader::sdmDataObject
private

Definition at line 335 of file SDMDataObjectStreamReader.h.

SDMDataSubset asdmbinaries::SDMDataObjectStreamReader::sdmDataSubset
private

Definition at line 336 of file SDMDataObjectStreamReader.h.

std::vector<SDMDataSubset> asdmbinaries::SDMDataObjectStreamReader::someSubsets
private

Definition at line 338 of file SDMDataObjectStreamReader.h.

char* asdmbinaries::SDMDataObjectStreamReader::zeroLagsBuffer
private

Definition at line 332 of file SDMDataObjectStreamReader.h.


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