casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
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>

List of all members.

Public Member Functions

 SDMDataObjectReader ()
 An empty constructor.
virtual ~SDMDataObjectReader ()
 The destructor.
const SDMDataObjectread (string filename)
 This method reads a MIME message contained in a disk file and returns a reference to an SDMDataObject.
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.
const SDMDataObjectref () const
 This method returns a reference to the SDMDataObject instance built during the execution of the read method.
const SDMDataObjectptr () const
 This method returns a pointer to the SDMDataObject instance built during the execution of the read method.
void done ()
 A method to release the resources allocated by the read operation.
 SDMDataObjectReader ()
 An empty constructor.
virtual ~SDMDataObjectReader ()
 The destructor.
const SDMDataObjectread (string filename)
 This method reads a MIME message contained in a disk file and returns a reference to an SDMDataObject.
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.
const SDMDataObjectref () const
 This method returns a reference to the SDMDataObject instance built during the execution of the read method.
const SDMDataObjectptr () const
 This method returns a pointer to the SDMDataObject instance built during the execution of the read method.
void done ()
 A method to release the resources allocated by the read operation.

Private Types

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

Private Member Functions

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

Static Private Member Functions

static bool initClass ()
static bool initClass ()

Private Attributes

READ read_
int filedes_
unsigned int dataSize_
char * data_
string::size_type position_
string::size_type lastPosition_
string::size_type endPosition_
unsigned int integrationNum_
unsigned int scanNum_
SDMDataObjectParser parser_
 SDMDataObject related stuff.
SDMDataObject sdmDataObject_
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 string MIMEBOUNDARY_1
 Two strings used as MIME boundaries.
static const string MIMEBOUNDARY_2
static const regex CONTENTIDDATASTRUCTUREREGEXP
 Regular expressions used to identify a Content-ID field in a MIME header.
static const regex CONTENTIDSUBSETREGEXP
static const regex CONTENTIDBINREGEXP
static const regex CONTENTIDBINREGEXP1
static const regex CONTENTIDBINREGEXP2
static set< string > BINATTACHNAMES
 Set of valid binary attachment names.
static map< 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 112 of file SDMDataObjectReader.h.


Member Enumeration Documentation

Enumerator:
ACTUALDURATIONS 
ACTUALTIMES 
AUTODATA 
FLAGS 
CROSSDATA 
ZEROLAGS 
ACTUALDURATIONS 
ACTUALTIMES 
AUTODATA 
FLAGS 
CROSSDATA 
ZEROLAGS 

Definition at line 200 of file SDMDataObjectReader.h.

Enumerator:
ACTUALDURATIONS 
ACTUALTIMES 
AUTODATA 
FLAGS 
CROSSDATA 
ZEROLAGS 
ACTUALDURATIONS 
ACTUALTIMES 
AUTODATA 
FLAGS 
CROSSDATA 
ZEROLAGS 

Definition at line 200 of file SDMDataObjectReader.h.

Enumerator:
UNKNOWN_ 
MEMORY_ 
FILE_ 
UNKNOWN_ 
MEMORY_ 
FILE_ 

Definition at line 167 of file SDMDataObjectReader.h.

Enumerator:
UNKNOWN_ 
MEMORY_ 
FILE_ 
UNKNOWN_ 
MEMORY_ 
FILE_ 

Definition at line 167 of file SDMDataObjectReader.h.


Constructor & Destructor Documentation

An empty constructor.

The destructor.

An empty constructor.

The destructor.


Member Function Documentation

bool asdmbinaries::SDMDataObjectReader::compare ( const string &  s) [private]
bool asdmbinaries::SDMDataObjectReader::compare ( const string &  s) [private]

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.

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.

string asdmbinaries::SDMDataObjectReader::extractXMLHeader ( const string &  boundary) [private]
string asdmbinaries::SDMDataObjectReader::extractXMLHeader ( const string &  boundary) [private]
string::size_type asdmbinaries::SDMDataObjectReader::find ( const string &  s) [private]
string::size_type asdmbinaries::SDMDataObjectReader::find ( const string &  s) [private]
void asdmbinaries::SDMDataObjectReader::getFields ( const string &  header,
map< string, string > &  fields 
) [private]
void asdmbinaries::SDMDataObjectReader::getFields ( const string &  header,
map< string, string > &  fields 
) [private]
static bool asdmbinaries::SDMDataObjectReader::initClass ( ) [static, private]
static bool asdmbinaries::SDMDataObjectReader::initClass ( ) [static, private]
void asdmbinaries::SDMDataObjectReader::processBinaryAttachment ( const string &  boundary,
const SDMDataSubset sdmDataSubset 
) [private]
void asdmbinaries::SDMDataObjectReader::processBinaryAttachment ( const string &  boundary,
const SDMDataSubset sdmDataSubset 
) [private]

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.

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.

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

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::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

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.

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.
void asdmbinaries::SDMDataObjectReader::tokenize ( const string &  str,
vector< string > &  tokens,
const string &  delimiters 
) [private]
void asdmbinaries::SDMDataObjectReader::tokenize ( const string &  str,
vector< string > &  tokens,
const string &  delimiters 
) [private]

Member Data Documentation

Definition at line 227 of file SDMDataObjectReader.h.

Definition at line 225 of file SDMDataObjectReader.h.

Definition at line 223 of file SDMDataObjectReader.h.

Definition at line 237 of file SDMDataObjectReader.h.

static set< string > asdmbinaries::SDMDataObjectReader::BINATTACHNAMES [static, private]

Set of valid binary attachment names.

Definition at line 199 of file SDMDataObjectReader.h.

static const regex asdmbinaries::SDMDataObjectReader::CONTENTIDBINREGEXP [static, private]

Definition at line 194 of file SDMDataObjectReader.h.

static const regex asdmbinaries::SDMDataObjectReader::CONTENTIDBINREGEXP1 [static, private]

Definition at line 195 of file SDMDataObjectReader.h.

static const regex asdmbinaries::SDMDataObjectReader::CONTENTIDBINREGEXP2 [static, private]

Definition at line 196 of file SDMDataObjectReader.h.

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

Definition at line 192 of file SDMDataObjectReader.h.

static const regex asdmbinaries::SDMDataObjectReader::CONTENTIDSUBSETREGEXP [static, private]

Definition at line 193 of file SDMDataObjectReader.h.

Definition at line 172 of file SDMDataObjectReader.h.

Definition at line 171 of file SDMDataObjectReader.h.

Definition at line 175 of file SDMDataObjectReader.h.

Definition at line 170 of file SDMDataObjectReader.h.

Definition at line 231 of file SDMDataObjectReader.h.

Definition at line 235 of file SDMDataObjectReader.h.

static const bool asdmbinaries::SDMDataObjectReader::initClass_ [static, private]

Definition at line 180 of file SDMDataObjectReader.h.

Definition at line 177 of file SDMDataObjectReader.h.

Definition at line 174 of file SDMDataObjectReader.h.

Definition at line 233 of file SDMDataObjectReader.h.

static const string asdmbinaries::SDMDataObjectReader::MIMEBOUNDARY_1 [static, private]

Two strings used as MIME boundaries.

Definition at line 188 of file SDMDataObjectReader.h.

static const string asdmbinaries::SDMDataObjectReader::MIMEBOUNDARY_2 [static, private]

Definition at line 189 of file SDMDataObjectReader.h.

Definition at line 228 of file SDMDataObjectReader.h.

Definition at line 226 of file SDMDataObjectReader.h.

static map< string, BINATTACHCODES > asdmbinaries::SDMDataObjectReader::name2code [static, private]

Definition at line 201 of file SDMDataObjectReader.h.

unsigned long int asdmbinaries::SDMDataObjectReader::nAutoData_ [private]

Definition at line 238 of file SDMDataObjectReader.h.

Definition at line 236 of file SDMDataObjectReader.h.

unsigned long int asdmbinaries::SDMDataObjectReader::nFlags_ [private]

Definition at line 232 of file SDMDataObjectReader.h.

unsigned long int asdmbinaries::SDMDataObjectReader::nZeroLags_ [private]

Definition at line 230 of file SDMDataObjectReader.h.

SDMDataObject related stuff.

Definition at line 219 of file SDMDataObjectReader.h.

string::size_type asdmbinaries::SDMDataObjectReader::position_ [private]

Definition at line 173 of file SDMDataObjectReader.h.

Definition at line 168 of file SDMDataObjectReader.h.

Definition at line 178 of file SDMDataObjectReader.h.

Definition at line 220 of file SDMDataObjectReader.h.

Definition at line 234 of file SDMDataObjectReader.h.

Definition at line 229 of file SDMDataObjectReader.h.


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