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

A class to read a MIME message containing ALMA binary data and provide a view on these binary data through an instance of SDMDataObject. More...

#include <SDMDataObjectReader.h>

Public Member Functions

 SDMDataObjectReader ()
 An empty constructor. More...
 
virtual ~SDMDataObjectReader ()
 The destructor. More...
 
const SDMDataObjectread (std::string filename)
 This method reads a MIME message contained in a disk file and returns a reference to an SDMDataObject. More...
 
const SDMDataObjectread (const char *buffer, unsigned long int size, bool fromFile=false)
 This method reads a MIME message contained in a memory buffer and returns a reference to an SDMDataObject. More...
 
const SDMDataObjectref () const
 This method returns a reference to the SDMDataObject instance built during the execution of the read method. More...
 
const SDMDataObjectptr () const
 This method returns a pointer to the SDMDataObject instance built during the execution of the read method. More...
 
void done ()
 A method to release the resources allocated by the read operation. More...
 

Private Types

enum  READ {
  UNKNOWN_,
  MEMORY_,
  FILE_
}
 
enum  BINATTACHCODES {
  ACTUALDURATIONS,
  ACTUALTIMES,
  AUTODATA,
  FLAGS,
  CROSSDATA,
  ZEROLAGS
}
 

Private Member Functions

void init ()
 
std::string::size_type find (const std::string &s)
 
bool compare (const std::string &s)
 
bool EOD ()
 
std::string extractXMLHeader (const std::string &boundary)
 
void tokenize (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters)
 
void getFields (const std::string &header, std::map< std::string, std::string > &fields)
 
std::string getContentID ()
 
std::string getContentLocation ()
 
void processMIME ()
 
void processMIMESDMDataHeader ()
 
void processMIMESDMDataSubsetHeader (SDMDataSubset &sdmDataSubset)
 
void processMIMEIntegrations ()
 
void processMIMEIntegration ()
 
void processMIMESubscan ()
 
void processBinaryAttachment (const std::string &boundary, const SDMDataSubset &sdmDataSubset)
 
const SDMDataObjectsdmDataObject ()
 

Static Private Member Functions

static bool initClass ()
 

Private Attributes

READ read_
 
int filedes_
 
unsigned int dataSize_
 
char * data_
 
std::string::size_type position_
 
std::string::size_type lastPosition_
 
std::string::size_type endPosition_
 
unsigned int integrationNum_
 
SDMDataObjectParser parser_
 SDMDataObject related stuff. More...
 
SDMDataObject sdmDataObject_
 
std::bitset< 6 > attachmentFlags
 
const ACTUALTIMESTYPEactualTimes_
 
unsigned long int nActualTimes_
 
const ACTUALDURATIONSTYPEactualDurations_
 
unsigned long int nActualDurations_
 
const ZEROLAGSTYPEzeroLags_
 
unsigned long int nZeroLags_
 
const FLAGSTYPEflags_
 
unsigned long int nFlags_
 
const INTCROSSDATATYPElongCrossData_
 
const SHORTCROSSDATATYPEshortCrossData_
 
const FLOATCROSSDATATYPEfloatCrossData_
 
unsigned long int nCrossData_
 
const AUTODATATYPEautoData_
 
unsigned long int nAutoData_
 

Static Private Attributes

static const bool initClass_
 
static const std::string MIMEBOUNDARY_1
 Two strings used as MIME boundaries. More...
 
static const std::string MIMEBOUNDARY_2
 
static const boost::regex CONTENTIDDATASTRUCTUREREGEXP
 Regular expressions used to identify a Content-ID field in a MIME header. More...
 
static const boost::regex CONTENTIDSUBSETREGEXP
 
static const boost::regex CONTENTIDBINREGEXP
 
static const boost::regex CONTENTIDBINREGEXP1
 
static const boost::regex CONTENTIDBINREGEXP2
 
static std::set< std::string > BINATTACHNAMES
 Set of valid binary attachment names. More...
 
static std::map< std::string,
BINATTACHCODES
name2code
 

Detailed Description

A class to read a MIME message containing ALMA binary data and provide a view on these binary data through an instance of SDMDataObject.

An instance of a SDMDataObjectReader can read MIME messages stored in a file or in a memory buffer, via two different versions of the read() method. The binary data read can be Total Power or Correlator (integration and subintegration) data. Once the data obtained by a call to a read method are not needed any more the done() method must be called to release the resources allocated to access the data.

Definition at line 111 of file SDMDataObjectReader.h.

Member Enumeration Documentation

Enumerator
ACTUALDURATIONS 
ACTUALTIMES 
AUTODATA 
FLAGS 
CROSSDATA 
ZEROLAGS 

Definition at line 205 of file SDMDataObjectReader.h.

Enumerator
UNKNOWN_ 
MEMORY_ 
FILE_ 

Definition at line 166 of file SDMDataObjectReader.h.

Constructor & Destructor Documentation

asdmbinaries::SDMDataObjectReader::SDMDataObjectReader ( )

An empty constructor.

virtual asdmbinaries::SDMDataObjectReader::~SDMDataObjectReader ( )
virtual

The destructor.

Member Function Documentation

bool asdmbinaries::SDMDataObjectReader::compare ( const std::string &  s)
private
void asdmbinaries::SDMDataObjectReader::done ( )

A method to release the resources allocated by the read operation.

This method must be called once the SDMDataObject built by the read method is no more needed.

bool asdmbinaries::SDMDataObjectReader::EOD ( )
private
std::string asdmbinaries::SDMDataObjectReader::extractXMLHeader ( const std::string &  boundary)
private
std::string::size_type asdmbinaries::SDMDataObjectReader::find ( const std::string &  s)
private
std::string asdmbinaries::SDMDataObjectReader::getContentID ( )
private
std::string asdmbinaries::SDMDataObjectReader::getContentLocation ( )
private
void asdmbinaries::SDMDataObjectReader::getFields ( const std::string &  header,
std::map< std::string, std::string > &  fields 
)
private
void asdmbinaries::SDMDataObjectReader::init ( )
private
static bool asdmbinaries::SDMDataObjectReader::initClass ( )
staticprivate
void asdmbinaries::SDMDataObjectReader::processBinaryAttachment ( const std::string &  boundary,
const SDMDataSubset sdmDataSubset 
)
private
void asdmbinaries::SDMDataObjectReader::processMIME ( )
private
void asdmbinaries::SDMDataObjectReader::processMIMEIntegration ( )
private
void asdmbinaries::SDMDataObjectReader::processMIMEIntegrations ( )
private
void asdmbinaries::SDMDataObjectReader::processMIMESDMDataHeader ( )
private
void asdmbinaries::SDMDataObjectReader::processMIMESDMDataSubsetHeader ( SDMDataSubset sdmDataSubset)
private
void asdmbinaries::SDMDataObjectReader::processMIMESubscan ( )
private
const SDMDataObject* asdmbinaries::SDMDataObjectReader::ptr ( ) const

This method returns a pointer to the SDMDataObject instance built during the execution of the read method.

Returns
a reference to an SDMDataObject.
Exceptions
SDMDataObjectReaderException.
const SDMDataObject& asdmbinaries::SDMDataObjectReader::read ( std::string  filename)

This method reads a MIME message contained in a disk file and returns a reference to an SDMDataObject.

Parameters
filenamethe name of the file to be read.
Returns
a reference to an SDMDataObject built during the read operation.
Exceptions
SDMDataObjectReaderException
const SDMDataObject& asdmbinaries::SDMDataObjectReader::read ( const char *  buffer,
unsigned long int  size,
bool  fromFile = false 
)

This method reads a MIME message contained in a memory buffer and returns a reference to an SDMDataObject.

Parameters
bufferthe adress of the buffer containing the MIME message.
sizethe size in bytes of that buffer.
fromFilea bool to indicate if the buffer is actually the result of a mapping of a file to virtual memory (false by default).
Returns
a reference to an SDMDataObject built during the read operation.
Exceptions
SDMDataObjectReaderException
const SDMDataObject& asdmbinaries::SDMDataObjectReader::ref ( ) const

This method returns a reference to the SDMDataObject instance built during the execution of the read method.

Returns
a reference to an SDMDataObject.
Exceptions
SDMDataObjectReaderException.
const SDMDataObject& asdmbinaries::SDMDataObjectReader::sdmDataObject ( )
private
void asdmbinaries::SDMDataObjectReader::tokenize ( const std::string &  str,
std::vector< std::string > &  tokens,
const std::string &  delimiters 
)
private

Member Data Documentation

const ACTUALDURATIONSTYPE* asdmbinaries::SDMDataObjectReader::actualDurations_
private

Definition at line 232 of file SDMDataObjectReader.h.

const ACTUALTIMESTYPE* asdmbinaries::SDMDataObjectReader::actualTimes_
private

Definition at line 230 of file SDMDataObjectReader.h.

std::bitset<6> asdmbinaries::SDMDataObjectReader::attachmentFlags
private

Definition at line 228 of file SDMDataObjectReader.h.

const AUTODATATYPE* asdmbinaries::SDMDataObjectReader::autoData_
private

Definition at line 242 of file SDMDataObjectReader.h.

std::set<std::string> asdmbinaries::SDMDataObjectReader::BINATTACHNAMES
staticprivate

Set of valid binary attachment names.

Definition at line 204 of file SDMDataObjectReader.h.

const boost::regex asdmbinaries::SDMDataObjectReader::CONTENTIDBINREGEXP
staticprivate

Definition at line 193 of file SDMDataObjectReader.h.

const boost::regex asdmbinaries::SDMDataObjectReader::CONTENTIDBINREGEXP1
staticprivate

Definition at line 194 of file SDMDataObjectReader.h.

const boost::regex asdmbinaries::SDMDataObjectReader::CONTENTIDBINREGEXP2
staticprivate

Definition at line 195 of file SDMDataObjectReader.h.

const boost::regex asdmbinaries::SDMDataObjectReader::CONTENTIDDATASTRUCTUREREGEXP
staticprivate

Regular expressions used to identify a Content-ID field in a MIME header.

Definition at line 191 of file SDMDataObjectReader.h.

const boost::regex asdmbinaries::SDMDataObjectReader::CONTENTIDSUBSETREGEXP
staticprivate

Definition at line 192 of file SDMDataObjectReader.h.

char* asdmbinaries::SDMDataObjectReader::data_
private

Definition at line 171 of file SDMDataObjectReader.h.

unsigned int asdmbinaries::SDMDataObjectReader::dataSize_
private

Definition at line 170 of file SDMDataObjectReader.h.

std::string::size_type asdmbinaries::SDMDataObjectReader::endPosition_
private

Definition at line 174 of file SDMDataObjectReader.h.

int asdmbinaries::SDMDataObjectReader::filedes_
private

Definition at line 169 of file SDMDataObjectReader.h.

const FLAGSTYPE* asdmbinaries::SDMDataObjectReader::flags_
private

Definition at line 236 of file SDMDataObjectReader.h.

const FLOATCROSSDATATYPE* asdmbinaries::SDMDataObjectReader::floatCrossData_
private

Definition at line 240 of file SDMDataObjectReader.h.

const bool asdmbinaries::SDMDataObjectReader::initClass_
staticprivate

Definition at line 178 of file SDMDataObjectReader.h.

unsigned int asdmbinaries::SDMDataObjectReader::integrationNum_
private

Definition at line 176 of file SDMDataObjectReader.h.

std::string::size_type asdmbinaries::SDMDataObjectReader::lastPosition_
private

Definition at line 173 of file SDMDataObjectReader.h.

const INTCROSSDATATYPE* asdmbinaries::SDMDataObjectReader::longCrossData_
private

Definition at line 238 of file SDMDataObjectReader.h.

const std::string asdmbinaries::SDMDataObjectReader::MIMEBOUNDARY_1
staticprivate

Two strings used as MIME boundaries.

Definition at line 186 of file SDMDataObjectReader.h.

const std::string asdmbinaries::SDMDataObjectReader::MIMEBOUNDARY_2
staticprivate

Definition at line 187 of file SDMDataObjectReader.h.

unsigned long int asdmbinaries::SDMDataObjectReader::nActualDurations_
private

Definition at line 233 of file SDMDataObjectReader.h.

unsigned long int asdmbinaries::SDMDataObjectReader::nActualTimes_
private

Definition at line 231 of file SDMDataObjectReader.h.

std::map<std::string, BINATTACHCODES> asdmbinaries::SDMDataObjectReader::name2code
staticprivate

Definition at line 206 of file SDMDataObjectReader.h.

unsigned long int asdmbinaries::SDMDataObjectReader::nAutoData_
private

Definition at line 243 of file SDMDataObjectReader.h.

unsigned long int asdmbinaries::SDMDataObjectReader::nCrossData_
private

Definition at line 241 of file SDMDataObjectReader.h.

unsigned long int asdmbinaries::SDMDataObjectReader::nFlags_
private

Definition at line 237 of file SDMDataObjectReader.h.

unsigned long int asdmbinaries::SDMDataObjectReader::nZeroLags_
private

Definition at line 235 of file SDMDataObjectReader.h.

SDMDataObjectParser asdmbinaries::SDMDataObjectReader::parser_
private

SDMDataObject related stuff.

Definition at line 224 of file SDMDataObjectReader.h.

std::string::size_type asdmbinaries::SDMDataObjectReader::position_
private

Definition at line 172 of file SDMDataObjectReader.h.

READ asdmbinaries::SDMDataObjectReader::read_
private

Definition at line 167 of file SDMDataObjectReader.h.

SDMDataObject asdmbinaries::SDMDataObjectReader::sdmDataObject_
private

Definition at line 225 of file SDMDataObjectReader.h.

const SHORTCROSSDATATYPE* asdmbinaries::SDMDataObjectReader::shortCrossData_
private

Definition at line 239 of file SDMDataObjectReader.h.

const ZEROLAGSTYPE* asdmbinaries::SDMDataObjectReader::zeroLags_
private

Definition at line 234 of file SDMDataObjectReader.h.


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