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::SDMDataObjectWriter Class Reference

A general class to write MIME messages containing ALMA binary data. More...

#include <SDMDataObjectWriter.h>

List of all members.

Public Member Functions

 SDMDataObjectWriter (const string &uid="uid://X0/X0/X0", const string &title="ALMA Binary Data")
 A constructor to write on standard output.
 SDMDataObjectWriter (ofstream *ofs, const string &uid="uid://X0/X0/X0", const string &title="ALMA Binary Data")
 A constructor to write in a file.
 SDMDataObjectWriter (ostringstream *oss, const string &uid="uid://X0/X0/X0", const string &title="ALMA Binary Data")
 A constructor to write in memory.
virtual ~SDMDataObjectWriter ()
 The destructor.
void done ()
 This method must be called to conclude the activity of this SDMDataObjectWriter.
void tpDataHeader (uint64_t startTime, const string &execBlockUID, uint32_t execBlockNum, uint32_t scanNum, uint32_t subscanNum, uint32_t numOfIntegrations, uint32_t numAntenna, SDMDataObject::DataStruct &dataStruct)
 Writes the XML global header on the MIME message stream, when binary data are Total Power data.
void addTPSubscan (uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< AUTODATATYPE > &autoData)
 Writes a data subset of Total Power binary data.
void tpData (uint64_t startTime, const string &execBlockUID, uint32_t execBlockNum, uint32_t scanNum, uint32_t subscanNum, uint32_t numOfIntegrations, uint32_t numAntenna, const vector< SDMDataObject::Baseband > &basebands, uint64_t time, uint64_t interval, const vector< AxisName > &flagsAxes, const vector< FLAGSTYPE > &flags, const vector< AxisName > &actualTimesAxes, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< AxisName > &actualDurationsAxes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< AxisName > &autoDataAxes, const vector< AUTODATATYPE > &autoData)
 Writes the full content of Total Power data in their respective attachments (global XML header, local XML header and binary attachments) on the MIME message stream.
void tpData (uint64_t startTime, const string &execBlockUID, uint32_t execBlockNum, uint32_t scanNum, uint32_t subscanNum, uint32_t numOfIntegrations, uint32_t numAntenna, const vector< SDMDataObject::Baseband > &basebands, uint64_t time, uint64_t interval, const vector< AxisName > &autoDataAxes, const vector< AUTODATATYPE > &autoData)
 Writes the full content of Total Power data in their respective attachments (global XML header, local XML header and binary attachments) on the MIME message stream.
void wvrData (const string &execBlockUID, uint32_t execBlockNum, uint32_t scanNum, uint32_t subscanNum, uint32_t numTimes, uint32_t numAntennas, uint32_t numChannels, NetSideband netSideband, uint64_t time, uint64_t interval, const vector< AUTODATATYPE > &wvrData, const vector< FLAGSTYPE > &flags)
 Writes water vapour radiometer (WVR) data in a MIME message conform with the BDF V2 format.
void corrDataHeader (uint64_t startime, const string &execBlockUID, uint32_t execBlockNum, uint32_t scanNum, uint32_t subscanNum, uint32_t numAntenna, CorrelationMode correlationMode, const OptionalSpectralResolutionType &spectralResolutionType, SDMDataObject::DataStruct &dataStruct)
 Writes the XML global header on the MIME message stream, when binary data are (sub)integrations produced by the correlator.
void addIntegration (uint32_t integrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< ZEROLAGSTYPE > &zeroLags, const vector< INTCROSSDATATYPE > &crossData, const vector< AUTODATATYPE > &autoData)
 Writes an integration (local header + binary attachment) on the MIME message stream.
void addIntegration (uint32_t integrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< ZEROLAGSTYPE > &zeroLags, const vector< SHORTCROSSDATATYPE > &crossData, const vector< AUTODATATYPE > &autoData)
 Writes an integration (local header + binary attachment) on the MIME message stream.
void addIntegration (uint32_t integrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< ZEROLAGSTYPE > &zeroLags, const vector< FLOATCROSSDATATYPE > &crossData, const vector< AUTODATATYPE > &autoData)
 Writes an integration (local header + binary attachment) on the MIME message stream.
void addSubintegration (uint32_t integrationNum, uint32_t subintegrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< ZEROLAGSTYPE > &zeroLags, const vector< INTCROSSDATATYPE > &crossData, const vector< AUTODATATYPE > &autoData)
 Writes an subintegration (local header + binary attachment) on the MIME message stream.
void addSubintegration (uint32_t integrationNum, uint32_t subintegrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< ZEROLAGSTYPE > &zeroLags, const vector< SHORTCROSSDATATYPE > &crossData, const vector< AUTODATATYPE > &autoData)
 Writes an subintegration (local header + binary attachment) on the MIME message stream.
void addSubintegration (uint32_t integrationNum, uint32_t subintegrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< ZEROLAGSTYPE > &zeroLags, const vector< FLOATCROSSDATATYPE > &crossData, const vector< AUTODATATYPE > &autoData)
 Writes an subintegration (local header + binary attachment) on the MIME message stream.
uint64_t numBytes ()
 Returns the number of bytes written so far.
void output (const string &s)
void outputln (const string &s)
void output (const float *data, uint32_t numData)
void outputln (const float *data, uint32_t numData)
void outputln (const long long *data, uint32_t numData)
template<class T >
void output (const vector< T > &data)
template<class T >
void outputln (const vector< T > &data)
void outputln ()
void outputlnLocation (const string &name, const SDMDataSubset &sdmDataSubset)
 SDMDataObjectWriter (const string &uid="uid://X0/X0/X0", const string &title="ALMA Binary Data")
 A constructor to write on standard output.
 SDMDataObjectWriter (ofstream *ofs, const string &uid="uid://X0/X0/X0", const string &title="ALMA Binary Data")
 A constructor to write in a file.
 SDMDataObjectWriter (ostringstream *oss, const string &uid="uid://X0/X0/X0", const string &title="ALMA Binary Data")
 A constructor to write in memory.
virtual ~SDMDataObjectWriter ()
 The destructor.
void done ()
 This method must be called to conclude the activity of this SDMDataObjectWriter.
void tpDataHeader (uint64_t startTime, const string &execBlockUID, uint32_t execBlockNum, uint32_t scanNum, uint32_t subscanNum, uint32_t numOfIntegrations, uint32_t numAntenna, SDMDataObject::DataStruct &dataStruct)
 Writes the XML global header on the MIME message stream, when binary data are Total Power data.
void addTPSubscan (uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< AUTODATATYPE > &autoData)
 Writes a data subset of Total Power binary data.
void tpData (uint64_t startTime, const string &execBlockUID, uint32_t execBlockNum, uint32_t scanNum, uint32_t subscanNum, uint32_t numOfIntegrations, uint32_t numAntenna, const vector< SDMDataObject::Baseband > &basebands, uint64_t time, uint64_t interval, const vector< AxisName > &flagsAxes, const vector< FLAGSTYPE > &flags, const vector< AxisName > &actualTimesAxes, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< AxisName > &actualDurationsAxes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< AxisName > &autoDataAxes, const vector< AUTODATATYPE > &autoData)
 Writes the full content of Total Power data in their respective attachments (global XML header, local XML header and binary attachments) on the MIME message stream.
void tpData (uint64_t startTime, const string &execBlockUID, uint32_t execBlockNum, uint32_t scanNum, uint32_t subscanNum, uint32_t numOfIntegrations, uint32_t numAntenna, const vector< SDMDataObject::Baseband > &basebands, uint64_t time, uint64_t interval, const vector< AxisName > &autoDataAxes, const vector< AUTODATATYPE > &autoData)
 Writes the full content of Total Power data in their respective attachments (global XML header, local XML header and binary attachments) on the MIME message stream.
void wvrData (const string &execBlockUID, uint32_t execBlockNum, uint32_t scanNum, uint32_t subscanNum, uint32_t numTimes, uint32_t numAntennas, uint32_t numChannels, NetSideband netSideband, uint64_t time, uint64_t interval, const vector< AUTODATATYPE > &wvrData, const vector< FLAGSTYPE > &flags)
 Writes water vapour radiometer (WVR) data in a MIME message conform with the BDF V2 format.
void corrDataHeader (uint64_t startime, const string &execBlockUID, uint32_t execBlockNum, uint32_t scanNum, uint32_t subscanNum, uint32_t numAntenna, CorrelationMode correlationMode, const OptionalSpectralResolutionType &spectralResolutionType, SDMDataObject::DataStruct &dataStruct)
 Writes the XML global header on the MIME message stream, when binary data are (sub)integrations produced by the correlator.
void addIntegration (uint32_t integrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< ZEROLAGSTYPE > &zeroLags, const vector< INTCROSSDATATYPE > &crossData, const vector< AUTODATATYPE > &autoData)
 Writes an integration (local header + binary attachment) on the MIME message stream.
void addIntegration (uint32_t integrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< ZEROLAGSTYPE > &zeroLags, const vector< SHORTCROSSDATATYPE > &crossData, const vector< AUTODATATYPE > &autoData)
 Writes an integration (local header + binary attachment) on the MIME message stream.
void addIntegration (uint32_t integrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< ZEROLAGSTYPE > &zeroLags, const vector< FLOATCROSSDATATYPE > &crossData, const vector< AUTODATATYPE > &autoData)
 Writes an integration (local header + binary attachment) on the MIME message stream.
void addSubintegration (uint32_t integrationNum, uint32_t subintegrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< ZEROLAGSTYPE > &zeroLags, const vector< INTCROSSDATATYPE > &crossData, const vector< AUTODATATYPE > &autoData)
 Writes an subintegration (local header + binary attachment) on the MIME message stream.
void addSubintegration (uint32_t integrationNum, uint32_t subintegrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< ZEROLAGSTYPE > &zeroLags, const vector< SHORTCROSSDATATYPE > &crossData, const vector< AUTODATATYPE > &autoData)
 Writes an subintegration (local header + binary attachment) on the MIME message stream.
void addSubintegration (uint32_t integrationNum, uint32_t subintegrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< ZEROLAGSTYPE > &zeroLags, const vector< FLOATCROSSDATATYPE > &crossData, const vector< AUTODATATYPE > &autoData)
 Writes an subintegration (local header + binary attachment) on the MIME message stream.
uint64_t numBytes ()
 Returns the number of bytes written so far.
void output (const string &s)
void outputln (const string &s)
void output (const float *data, uint32_t numData)
void outputln (const float *data, uint32_t numData)
void outputln (const long long *data, uint32_t numData)
template<class T >
void output (const vector< T > &data)
template<class T >
void outputln (const vector< T > &data)
void outputln ()
void outputlnLocation (const string &name, const SDMDataSubset &sdmDataSubset)

Private Types

enum  OUTDEST {
  STDOUT,
  MEMORY,
  FILE,
  STDOUT,
  MEMORY,
  FILE
}
enum  States {
  START,
  S_TPDATA,
  S_TPDATAHEADER,
  S_ADDTPSUBSCAN,
  S_WVRDATA,
  S_CORRDATAHEADER,
  S_ADDINTEGRATION,
  S_ADDSUBINTEGRATION,
  END,
  START,
  S_TPDATA,
  S_TPDATAHEADER,
  S_ADDTPSUBSCAN,
  S_WVRDATA,
  S_CORRDATAHEADER,
  S_ADDINTEGRATION,
  S_ADDSUBINTEGRATION,
  END
}
 A small finite state automaton to control the usage of SDMDataObjectWriter. More...
enum  Transitions {
  T_TPDATA,
  T_TPDATAHEADER,
  T_ADDTPSUBSCAN,
  T_WVRDATA,
  T_CORRDATAHEADER,
  T_ADDINTEGRATION,
  T_ADDSUBINTEGRATION,
  T_DONE,
  T_TPDATA,
  T_TPDATAHEADER,
  T_ADDTPSUBSCAN,
  T_WVRDATA,
  T_CORRDATAHEADER,
  T_ADDINTEGRATION,
  T_ADDSUBINTEGRATION,
  T_DONE
}
enum  OUTDEST {
  STDOUT,
  MEMORY,
  FILE,
  STDOUT,
  MEMORY,
  FILE
}
enum  States {
  START,
  S_TPDATA,
  S_TPDATAHEADER,
  S_ADDTPSUBSCAN,
  S_WVRDATA,
  S_CORRDATAHEADER,
  S_ADDINTEGRATION,
  S_ADDSUBINTEGRATION,
  END,
  START,
  S_TPDATA,
  S_TPDATAHEADER,
  S_ADDTPSUBSCAN,
  S_WVRDATA,
  S_CORRDATAHEADER,
  S_ADDINTEGRATION,
  S_ADDSUBINTEGRATION,
  END
}
 A small finite state automaton to control the usage of SDMDataObjectWriter. More...
enum  Transitions {
  T_TPDATA,
  T_TPDATAHEADER,
  T_ADDTPSUBSCAN,
  T_WVRDATA,
  T_CORRDATAHEADER,
  T_ADDINTEGRATION,
  T_ADDSUBINTEGRATION,
  T_DONE,
  T_TPDATA,
  T_TPDATAHEADER,
  T_ADDTPSUBSCAN,
  T_WVRDATA,
  T_CORRDATAHEADER,
  T_ADDINTEGRATION,
  T_ADDSUBINTEGRATION,
  T_DONE
}

Private Member Functions

void preamble ()
 Writes the very first part of the MIME message.
void postamble ()
 Write the very end of the MIME message.
void addData (uint32_t integrationNum, uint32_t subintegrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< ZEROLAGSTYPE > &zeroLags, const vector< INTCROSSDATATYPE > &intCrossData, const vector< SHORTCROSSDATATYPE > &shortCrossData, const vector< FLOATCROSSDATATYPE > &floatCrossData, const vector< AUTODATATYPE > &autoData)
void checkState (Transitions t, const string &methodName)
void preamble ()
 Writes the very first part of the MIME message.
void postamble ()
 Write the very end of the MIME message.
void addData (uint32_t integrationNum, uint32_t subintegrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< ZEROLAGSTYPE > &zeroLags, const vector< INTCROSSDATATYPE > &intCrossData, const vector< SHORTCROSSDATATYPE > &shortCrossData, const vector< FLOATCROSSDATATYPE > &floatCrossData, const vector< AUTODATATYPE > &autoData)
void checkState (Transitions t, const string &methodName)

Static Private Member Functions

static bool initClass ()
template<class Enum , class EnumHelper >
static vector< Enum > enumvec (const string &strliterals)
 A utility to fill a vector of <Enum> from a an array of c-strings.
static bool initClass ()
template<class Enum , class EnumHelper >
static vector< Enum > enumvec (const string &strliterals)
 A utility to fill a vector of <Enum> from a an array of c-strings.

Private Attributes

OUTDEST otype_
ofstream * ofs_
ostringstream * oss_
string uid_
 The ALMA uid of the MIME message.
string title_
 The title of the binary data.
string subscanPath_
 The subscan path.
SDMDataObject sdmDataObject_
 An SDMDataObject.
uint32_t sdmDataSubsetNum_
 The number of the SDMDataSubset being written.
bool done_
 Are we done with this ?
uint64_t numBytes_
 The number of bytes written so far.
States currentState_

Static Private Attributes

static const string MIMEBOUNDARY_1
 Two strings used as MIME boundaries.
static const string MIMEBOUNDARY_2
static const bool initClass_
 Class initialization stuff.
static vector< AxisName > WVRDATAAXES
 The axes names definitions for WVR data and their related flags.
static vector< AxisName > WVRDATAFLAGSAXES

Detailed Description

A general class to write MIME messages containing ALMA binary data.

An instance of this class can be used to write :

The MIME message is written on standard output, a disk file or a char buffer depending on the constructor used to create an instance of SDMDataObjectWriter.

How to use an instance of SDMDataObjectWriter.

Whatever is the type of binary data (total power, WVR, integration, subintegration) to write, the following scheme must be respected when using an SDMDataObjectWriter.

  1. Instantiate an SDMDataObjectWriter by using the appropriate constructor depending on the kind of desired output (standard output, disk file, memory).
  2. Write the binary data by using the appropriate methods depending on the kind of binary data.
  3. Conclude the usage of this instance of SDMDataObjectWriter by calling the done method (done()).

Example:

 // open a disk file
 ofstream osf("myCorrData.dat");

 // builds an SDMDataObjectWriter which will write the data in the file "myCorrData.dat".  
 SDMDataObjectWriter sdmdow(&osf, "uid://X1/X2/X3", "ALMA Binary Data");
 
 // Here produce the binary data by using one the sequences detailed below.
 .
 .
 // done with sdmdow.
 sdmdow.done();
 
 // Do not forget to close the file !!
 osf.close()
 .
 .

Example of a MIME message output in an ostringstream :

 // create an osstringstream
 ostringstream oss;

 // builds an SDMDataObjectWriter which will write the data in the string attached to oss.  
 SDMDataObjectWriter sdmdow(&oss, "uid://X1/X2/X3", "ALMA Binary Data");
 
 // Here produce the binary data by using one the sequences detailed below.
 .
 .
 // done with sdmdow.
 sdmdow.done();
 
 // Do whatever you want with oss.
 .
 .
 // And perhaps a good thing to erase the content of oss.
 oss.str("");
 .
 .

We detail now the different valid sequences for writing binary data depending on their kind.

How to write Total Power data.

One single call to the tpData() method.

  sdmdow.tpData(123450000,          // startTime
                "uid://X123/X4/X5", // execBlockUID
                1,                  // execBlockNum
                10,                 // scanNum
                3,                  // subscanNum
                100,                // number of integrations
                2,                  // number of antennas
                basebands,          // vector of basebands.
                171450000,          // time 
                96000000,           // interval
                axis,               // names of axis
                autoData);          // total power data values.

One may also consider to use in that order the methods tpDataHeader and addTPSubscan.

How to write WVR data.

One single call to the wvrData() method.

  sdmdow.wvrData("uid://X123/X4/X5", // execBlockUID,
                 1,                  // execBlockNum,
                 10,                 // scanNum,
                 3,                  // subscanNum,
                 100,                // number of time stamps (i.e. size along the TIM axis),
                 8,                  // number of antennas,
                 4,                  // number of channels,
                 DSB,                // NetSideband characteristic,
                 171450000,          // time, 
                 96000000,           // interval,
                 wvrData,            // the WVR data values,
                 flags);             // flags associated to the WVR data.

How to write integrations.

One single call to corrDataHeader() followed by one or more calls to addIntegration().

  // Write the global header.
  sdmdow.corrDataHeader(123450000,          // startTime
                        "uid://X123/X4/X5", // execBlockUID
                        1,                  // execBlockNum
                        10,                 // scanNum
                        3,                  // subscanNum
                        2,                  // numAntenna        
                        correlationMode,    // the correlation mode.
                        spectralResolution, // the spectral resolution.
                        correlatorType,     // the processor (correlator) type.
                        dataStruct);        // the description of the structure of the binary data.

 // And write the integrations (3 in that example).
 for (uint32_t i = 0; i < 3; i++) {
  .
  .
  .
  sdmdow.addIntegration(i+1,               // integration's index.
                        time,              // midpoint
                        interval,          // time interval
                        flags,             // flags binary data 
                        actualTimes,       // actual times binary data      
                        actualDurations,   // actual durations binary data          
                        zeroLags,          // zero lags binary data                 
                        shortCrossData,    // cross data (can be short or int)  
                        autoData);         // single dish data.                 
  .
  .
  .
 }  

How to write subintegrations.

One single call to corrDataHeader() followed by one or more calls to addSubintegration().

  // Write the global header.
  sdmdow.corrDataHeader(123450000,          // startTime
                        "uid://X123/X4/X5", // execBlockUID
                        1,                  // execBlockNum
                        10,                 // scanNum
                        3,                  // subscanNum
                        2,                  // numAntenna        
                        correlationMode,    // the correlation mode.
                        spectralResolution, // the spectral resolution.
                        processorType,      // the processor type.
                        dataStruct);        // the description of the structure of the binary data.

 // And write the subintegrations (6 in that example). 
 for (uint32_t i = 0; i < 3; i++) {
   for (uint32_t j = 0; j < 2; j++) {
    .
    .
    .
    sdmdow.addSubintegration(i+1,            // integration's index.
                             j+1,            // subintegration's index
                             time,           // midpoint
                             interval,       // time interval
                             flags,          // flags binary data 
                             actualTimes,    // actual times binary data            
                             actualDurations,// actual durations binary data        
                             zeroLags,   // zero lags binary data                   
                             shortCrossData, // cross data (can be short or int)  
                             autoData);  // single dish data.                 
    .
    .
    .
   }
 }  

Valid calls sequences.

The table below summarizes the valid call sequences when using an SDMDataObjectWriter. Any deviation from these rules will result in an SDMDataObjectWriterException thrown.

Valid sequences of methods calls
Total Power data WVR data Integration subIntegration
ctor, tpData, done ctor, wvrData, done ctor, corrDataHeader, addIntegration (one or more times), done ctor, corrDataHeader, addSubintegration (one or more times), done
ctor, tpDataHeader, addTPSubscan, done

Definition at line 276 of file SDMDataObjectWriter.h.


Member Enumeration Documentation

Enumerator:
STDOUT 
MEMORY 
FILE 
STDOUT 
MEMORY 
FILE 

Definition at line 782 of file SDMDataObjectWriter.h.

Enumerator:
STDOUT 
MEMORY 
FILE 
STDOUT 
MEMORY 
FILE 

Definition at line 782 of file SDMDataObjectWriter.h.

A small finite state automaton to control the usage of SDMDataObjectWriter.

Enumerator:
START 
S_TPDATA 
S_TPDATAHEADER 
S_ADDTPSUBSCAN 
S_WVRDATA 
S_CORRDATAHEADER 
S_ADDINTEGRATION 
S_ADDSUBINTEGRATION 
END 
START 
S_TPDATA 
S_TPDATAHEADER 
S_ADDTPSUBSCAN 
S_WVRDATA 
S_CORRDATAHEADER 
S_ADDINTEGRATION 
S_ADDSUBINTEGRATION 
END 

Definition at line 856 of file SDMDataObjectWriter.h.

A small finite state automaton to control the usage of SDMDataObjectWriter.

Enumerator:
START 
S_TPDATA 
S_TPDATAHEADER 
S_ADDTPSUBSCAN 
S_WVRDATA 
S_CORRDATAHEADER 
S_ADDINTEGRATION 
S_ADDSUBINTEGRATION 
END 
START 
S_TPDATA 
S_TPDATAHEADER 
S_ADDTPSUBSCAN 
S_WVRDATA 
S_CORRDATAHEADER 
S_ADDINTEGRATION 
S_ADDSUBINTEGRATION 
END 

Definition at line 856 of file SDMDataObjectWriter.h.

Enumerator:
T_TPDATA 
T_TPDATAHEADER 
T_ADDTPSUBSCAN 
T_WVRDATA 
T_CORRDATAHEADER 
T_ADDINTEGRATION 
T_ADDSUBINTEGRATION 
T_DONE 
T_TPDATA 
T_TPDATAHEADER 
T_ADDTPSUBSCAN 
T_WVRDATA 
T_CORRDATAHEADER 
T_ADDINTEGRATION 
T_ADDSUBINTEGRATION 
T_DONE 

Definition at line 857 of file SDMDataObjectWriter.h.

Enumerator:
T_TPDATA 
T_TPDATAHEADER 
T_ADDTPSUBSCAN 
T_WVRDATA 
T_CORRDATAHEADER 
T_ADDINTEGRATION 
T_ADDSUBINTEGRATION 
T_DONE 
T_TPDATA 
T_TPDATAHEADER 
T_ADDTPSUBSCAN 
T_WVRDATA 
T_CORRDATAHEADER 
T_ADDINTEGRATION 
T_ADDSUBINTEGRATION 
T_DONE 

Definition at line 857 of file SDMDataObjectWriter.h.


Constructor & Destructor Documentation

asdmbinaries::SDMDataObjectWriter::SDMDataObjectWriter ( const string &  uid = "uid://X0/X0/X0",
const string &  title = "ALMA Binary Data" 
)

A constructor to write on standard output.

The MIME message will be written to the standard output.

Parameters:
uida string containing the ALMA uid of the MIME message.
titlea string defining the title for the binary data to be written.
asdmbinaries::SDMDataObjectWriter::SDMDataObjectWriter ( ofstream *  ofs,
const string &  uid = "uid://X0/X0/X0",
const string &  title = "ALMA Binary Data" 
)

A constructor to write in a file.

The MIME message will be written into the file attached to the ofstream argument.

Parameters:
ofsan pointer to an ofstream object.
uida string containing the ALMA uid of the MIME message.
titlea string defining the title for the binary data to be written.
asdmbinaries::SDMDataObjectWriter::SDMDataObjectWriter ( ostringstream *  oss,
const string &  uid = "uid://X0/X0/X0",
const string &  title = "ALMA Binary Data" 
)

A constructor to write in memory.

The MIME message will be written in an ostringstream.

Parameters:
ossa pointer to an ostringstream.
uida string containing the ALMA uid of the MIME message.
titlea string defining the title for the binary data to be written.
Note:
*oss will be systematically cleared before the first write operation.

The destructor.

asdmbinaries::SDMDataObjectWriter::SDMDataObjectWriter ( const string &  uid = "uid://X0/X0/X0",
const string &  title = "ALMA Binary Data" 
)

A constructor to write on standard output.

The MIME message will be written to the standard output.

Parameters:
uida string containing the ALMA uid of the MIME message.
titlea string defining the title for the binary data to be written.
asdmbinaries::SDMDataObjectWriter::SDMDataObjectWriter ( ofstream *  ofs,
const string &  uid = "uid://X0/X0/X0",
const string &  title = "ALMA Binary Data" 
)

A constructor to write in a file.

The MIME message will be written into the file attached to the ofstream argument.

Parameters:
ofsan pointer to an ofstream object.
uida string containing the ALMA uid of the MIME message.
titlea string defining the title for the binary data to be written.
asdmbinaries::SDMDataObjectWriter::SDMDataObjectWriter ( ostringstream *  oss,
const string &  uid = "uid://X0/X0/X0",
const string &  title = "ALMA Binary Data" 
)

A constructor to write in memory.

The MIME message will be written in an ostringstream.

Parameters:
ossa pointer to an ostringstream.
uida string containing the ALMA uid of the MIME message.
titlea string defining the title for the binary data to be written.
Note:
*oss will be systematically cleared before the first write operation.

The destructor.


Member Function Documentation

void asdmbinaries::SDMDataObjectWriter::addData ( uint32_t  integrationNum,
uint32_t  subintegrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< ZEROLAGSTYPE > &  zeroLags,
const vector< INTCROSSDATATYPE > &  intCrossData,
const vector< SHORTCROSSDATATYPE > &  shortCrossData,
const vector< FLOATCROSSDATATYPE > &  floatCrossData,
const vector< AUTODATATYPE > &  autoData 
) [private]
void asdmbinaries::SDMDataObjectWriter::addData ( uint32_t  integrationNum,
uint32_t  subintegrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< ZEROLAGSTYPE > &  zeroLags,
const vector< INTCROSSDATATYPE > &  intCrossData,
const vector< SHORTCROSSDATATYPE > &  shortCrossData,
const vector< FLOATCROSSDATATYPE > &  floatCrossData,
const vector< AUTODATATYPE > &  autoData 
) [private]
void asdmbinaries::SDMDataObjectWriter::addIntegration ( uint32_t  integrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< ZEROLAGSTYPE > &  zeroLags,
const vector< INTCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

Writes an integration (local header + binary attachment) on the MIME message stream.

Parameters:
integrationNumthe index (1 based) of the integration.
timetime of the integration.
intervalinterval of the integration.
flagsthe values of flags.
actualTimesthe values of actualTimes.
actualDurationsthe values of actualDurations.
zeroLagsthe values of zeroLags.
crossDatathe values of crossData (encoded in int).
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method is to be used when cross data are coded with "int" values.
If this integration contains only cross data (CROSS_ONLY) , the autoData parameter is ignored. A empty vector can be passed as an actual parameter.
void asdmbinaries::SDMDataObjectWriter::addIntegration ( uint32_t  integrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< ZEROLAGSTYPE > &  zeroLags,
const vector< INTCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

Writes an integration (local header + binary attachment) on the MIME message stream.

Parameters:
integrationNumthe index (1 based) of the integration.
timetime of the integration.
intervalinterval of the integration.
flagsthe values of flags.
actualTimesthe values of actualTimes.
actualDurationsthe values of actualDurations.
zeroLagsthe values of zeroLags.
crossDatathe values of crossData (encoded in int).
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method is to be used when cross data are coded with "int" values.
If this integration contains only cross data (CROSS_ONLY) , the autoData parameter is ignored. A empty vector can be passed as an actual parameter.
void asdmbinaries::SDMDataObjectWriter::addIntegration ( uint32_t  integrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< ZEROLAGSTYPE > &  zeroLags,
const vector< SHORTCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

Writes an integration (local header + binary attachment) on the MIME message stream.

Parameters:
integrationNumthe index (1 based) of the integration.
timetime of the integration.
intervalinterval of the integration.
flagsthe values of flags.
actualTimesthe values of actualTimes.
actualDurationsthe values of actualDurations.
zeroLagsthe values of zeroLags.
crossDatathe values of crossData (encoded in short).
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method is to be used when cross data are coded with "short" values.
If this integration contains only cross data (CROSS_ONLY) , the autoData parameter is ignored. A empty vector can be passed as an actual parameter.
void asdmbinaries::SDMDataObjectWriter::addIntegration ( uint32_t  integrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< ZEROLAGSTYPE > &  zeroLags,
const vector< SHORTCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

Writes an integration (local header + binary attachment) on the MIME message stream.

Parameters:
integrationNumthe index (1 based) of the integration.
timetime of the integration.
intervalinterval of the integration.
flagsthe values of flags.
actualTimesthe values of actualTimes.
actualDurationsthe values of actualDurations.
zeroLagsthe values of zeroLags.
crossDatathe values of crossData (encoded in short).
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method is to be used when cross data are coded with "short" values.
If this integration contains only cross data (CROSS_ONLY) , the autoData parameter is ignored. A empty vector can be passed as an actual parameter.
void asdmbinaries::SDMDataObjectWriter::addIntegration ( uint32_t  integrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< ZEROLAGSTYPE > &  zeroLags,
const vector< FLOATCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

Writes an integration (local header + binary attachment) on the MIME message stream.

Parameters:
integrationNumthe index (1 based) of the integration.
timetime of the integration.
intervalinterval of the integration.
flagsthe values of flags.
actualTimesthe values of actualTimes.
actualDurationsthe values of actualDurations.
zeroLagsthe values of zeroLags.
crossDatathe values of crossData (encoded in float).
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method is to be used when cross data are coded with "float" values.
If this integration contains only cross data (CROSS_ONLY) , the autoData parameter is ignored. A empty vector can be passed as an actual parameter.
void asdmbinaries::SDMDataObjectWriter::addIntegration ( uint32_t  integrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< ZEROLAGSTYPE > &  zeroLags,
const vector< FLOATCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

Writes an integration (local header + binary attachment) on the MIME message stream.

Parameters:
integrationNumthe index (1 based) of the integration.
timetime of the integration.
intervalinterval of the integration.
flagsthe values of flags.
actualTimesthe values of actualTimes.
actualDurationsthe values of actualDurations.
zeroLagsthe values of zeroLags.
crossDatathe values of crossData (encoded in float).
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method is to be used when cross data are coded with "float" values.
If this integration contains only cross data (CROSS_ONLY) , the autoData parameter is ignored. A empty vector can be passed as an actual parameter.
void asdmbinaries::SDMDataObjectWriter::addSubintegration ( uint32_t  integrationNum,
uint32_t  subintegrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< ZEROLAGSTYPE > &  zeroLags,
const vector< INTCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

Writes an subintegration (local header + binary attachment) on the MIME message stream.

Parameters:
integrationNumthe index (1 based) of the integration.
subintegrationNumthe index(1 based) of the subintegration.
timetime of the integration.
intervalinterval of the integration.
flagsthe values of flags.
actualTimesthe values of actualTimes.
actualDurationsthe values of actualDurations.
zeroLagsthe values of zeroLags.
crossDatathe values of crossData (encoded in int).
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method is to be used when cross data are coded with "int" values.
If this integration contains only cross data (CROSS_ONLY) , the autoData parameter is ignored. A empty vector can be passed as an actual parameter.
void asdmbinaries::SDMDataObjectWriter::addSubintegration ( uint32_t  integrationNum,
uint32_t  subintegrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< ZEROLAGSTYPE > &  zeroLags,
const vector< INTCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

Writes an subintegration (local header + binary attachment) on the MIME message stream.

Parameters:
integrationNumthe index (1 based) of the integration.
subintegrationNumthe index(1 based) of the subintegration.
timetime of the integration.
intervalinterval of the integration.
flagsthe values of flags.
actualTimesthe values of actualTimes.
actualDurationsthe values of actualDurations.
zeroLagsthe values of zeroLags.
crossDatathe values of crossData (encoded in int).
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method is to be used when cross data are coded with "int" values.
If this integration contains only cross data (CROSS_ONLY) , the autoData parameter is ignored. A empty vector can be passed as an actual parameter.
void asdmbinaries::SDMDataObjectWriter::addSubintegration ( uint32_t  integrationNum,
uint32_t  subintegrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< ZEROLAGSTYPE > &  zeroLags,
const vector< SHORTCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

Writes an subintegration (local header + binary attachment) on the MIME message stream.

Parameters:
integrationNumthe index (1 based) of the integration.
subintegrationNumthe index(1 based) of the subintegration.
timetime of the integration.
intervalinterval of the integration.
flagsthe values of flags.
actualTimesthe values of actualTimes.
actualDurationsthe values of actualDurations.
zeroLagsthe values of zeroLags.
crossDatathe values of crossData (encoded in short).
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method is to be used when cross data are coded with "short" values.
If this integration contains only cross data (CROSS_ONLY) , the autoData parameter is ignored. A empty vector can be passed as an actual parameter.
void asdmbinaries::SDMDataObjectWriter::addSubintegration ( uint32_t  integrationNum,
uint32_t  subintegrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< ZEROLAGSTYPE > &  zeroLags,
const vector< SHORTCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

Writes an subintegration (local header + binary attachment) on the MIME message stream.

Parameters:
integrationNumthe index (1 based) of the integration.
subintegrationNumthe index(1 based) of the subintegration.
timetime of the integration.
intervalinterval of the integration.
flagsthe values of flags.
actualTimesthe values of actualTimes.
actualDurationsthe values of actualDurations.
zeroLagsthe values of zeroLags.
crossDatathe values of crossData (encoded in short).
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method is to be used when cross data are coded with "short" values.
If this integration contains only cross data (CROSS_ONLY) , the autoData parameter is ignored. A empty vector can be passed as an actual parameter.
void asdmbinaries::SDMDataObjectWriter::addSubintegration ( uint32_t  integrationNum,
uint32_t  subintegrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< ZEROLAGSTYPE > &  zeroLags,
const vector< FLOATCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

Writes an subintegration (local header + binary attachment) on the MIME message stream.

Parameters:
integrationNumthe index (1 based) of the integration.
subintegrationNumthe index(1 based) of the subintegration.
timetime of the integration.
intervalinterval of the integration.
flagsthe values of flags.
actualTimesthe values of actualTimes.
actualDurationsthe values of actualDurations.
zeroLagsthe values of zeroLags.
crossDatathe values of crossData (encoded in float).
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method is to be used when cross data are coded with "float" values.
If this integration contains only cross data (CROSS_ONLY) , the autoData parameter is ignored. A empty vector can be passed as an actual parameter.
void asdmbinaries::SDMDataObjectWriter::addSubintegration ( uint32_t  integrationNum,
uint32_t  subintegrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< ZEROLAGSTYPE > &  zeroLags,
const vector< FLOATCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

Writes an subintegration (local header + binary attachment) on the MIME message stream.

Parameters:
integrationNumthe index (1 based) of the integration.
subintegrationNumthe index(1 based) of the subintegration.
timetime of the integration.
intervalinterval of the integration.
flagsthe values of flags.
actualTimesthe values of actualTimes.
actualDurationsthe values of actualDurations.
zeroLagsthe values of zeroLags.
crossDatathe values of crossData (encoded in float).
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method is to be used when cross data are coded with "float" values.
If this integration contains only cross data (CROSS_ONLY) , the autoData parameter is ignored. A empty vector can be passed as an actual parameter.
void asdmbinaries::SDMDataObjectWriter::addTPSubscan ( uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< AUTODATATYPE > &  autoData 
)

Writes a data subset of Total Power binary data.

Parameters:
timetime of the subscan.
intervalduration of the subscan.
flagsthe values of flags (see note).
actualTimesthe values of actualTimes (see note).
actualDurationsthe values of actualDurations (see note).
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method must called only once after a call to tpDataHeader.
void asdmbinaries::SDMDataObjectWriter::addTPSubscan ( uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< AUTODATATYPE > &  autoData 
)

Writes a data subset of Total Power binary data.

Parameters:
timetime of the subscan.
intervalduration of the subscan.
flagsthe values of flags (see note).
actualTimesthe values of actualTimes (see note).
actualDurationsthe values of actualDurations (see note).
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method must called only once after a call to tpDataHeader.
void asdmbinaries::SDMDataObjectWriter::checkState ( Transitions  t,
const string &  methodName 
) [private]
void asdmbinaries::SDMDataObjectWriter::checkState ( Transitions  t,
const string &  methodName 
) [private]
void asdmbinaries::SDMDataObjectWriter::corrDataHeader ( uint64_t  startime,
const string &  execBlockUID,
uint32_t  execBlockNum,
uint32_t  scanNum,
uint32_t  subscanNum,
uint32_t  numAntenna,
CorrelationMode  correlationMode,
const OptionalSpectralResolutionType spectralResolutionType,
SDMDataObject::DataStruct dataStruct 
)

Writes the XML global header on the MIME message stream, when binary data are (sub)integrations produced by the correlator.

Parameters:
startimestart time.
execBlockUIDthe UID of the exec block.
execBlockNumthe index of the exec block.
scanNumthe index of the scan.
subscanNumthe index of the subscan.
numAntennathe number of antenna.
correlationModethe correlation mode code.
spectralResolutionthe spectral resolution code.
dataStructthe description of the binary data structure.
Exceptions:
SDMDataObjectWriterException
void asdmbinaries::SDMDataObjectWriter::corrDataHeader ( uint64_t  startime,
const string &  execBlockUID,
uint32_t  execBlockNum,
uint32_t  scanNum,
uint32_t  subscanNum,
uint32_t  numAntenna,
CorrelationMode  correlationMode,
const OptionalSpectralResolutionType spectralResolutionType,
SDMDataObject::DataStruct dataStruct 
)

Writes the XML global header on the MIME message stream, when binary data are (sub)integrations produced by the correlator.

Parameters:
startimestart time.
execBlockUIDthe UID of the exec block.
execBlockNumthe index of the exec block.
scanNumthe index of the scan.
subscanNumthe index of the subscan.
numAntennathe number of antenna.
correlationModethe correlation mode code.
spectralResolutionthe spectral resolution code.
dataStructthe description of the binary data structure.
Exceptions:
SDMDataObjectWriterException

This method must be called to conclude the activity of this SDMDataObjectWriter.

It completes the MIME message.

Note:
Do not forget to call it when you have finished to write your binary data !
It does not close the file attached to the output stream if any, this operation is left to the user.

This method must be called to conclude the activity of this SDMDataObjectWriter.

It completes the MIME message.

Note:
Do not forget to call it when you have finished to write your binary data !
It does not close the file attached to the output stream if any, this operation is left to the user.
template<class Enum , class EnumHelper >
static vector<Enum> asdmbinaries::SDMDataObjectWriter::enumvec ( const string &  strliterals) [inline, static, private]

A utility to fill a vector of <Enum> from a an array of c-strings.

Definition at line 815 of file SDMDataObjectWriter.h.

template<class Enum , class EnumHelper >
static vector<Enum> asdmbinaries::SDMDataObjectWriter::enumvec ( const string &  strliterals) [inline, static, private]

A utility to fill a vector of <Enum> from a an array of c-strings.

Definition at line 815 of file SDMDataObjectWriter.h.

static bool asdmbinaries::SDMDataObjectWriter::initClass ( ) [static, private]
static bool asdmbinaries::SDMDataObjectWriter::initClass ( ) [static, private]

Returns the number of bytes written so far.

This method can be used at any time during the life of an instance of SDMDataObjectWriter. It returns the number of bytes emitted on the output (memory, standard output, disk file...) as the methods of this class, except done, are called.

  • This number is set to 0 at the creation of an SDMDataObjectWriter,
  • it is incremented accordingly with the number of bytes emitted by the different methods, except done,
  • it is reset to 0 by a call to the method done.
Returns:
an uint64_t.

Returns the number of bytes written so far.

This method can be used at any time during the life of an instance of SDMDataObjectWriter. It returns the number of bytes emitted on the output (memory, standard output, disk file...) as the methods of this class, except done, are called.

  • This number is set to 0 at the creation of an SDMDataObjectWriter,
  • it is incremented accordingly with the number of bytes emitted by the different methods, except done,
  • it is reset to 0 by a call to the method done.
Returns:
an uint64_t.
void asdmbinaries::SDMDataObjectWriter::output ( const string &  s)
void asdmbinaries::SDMDataObjectWriter::output ( const string &  s)
void asdmbinaries::SDMDataObjectWriter::output ( const float *  data,
uint32_t  numData 
)
void asdmbinaries::SDMDataObjectWriter::output ( const float *  data,
uint32_t  numData 
)
template<class T >
void asdmbinaries::SDMDataObjectWriter::output ( const vector< T > &  data) [inline]

Definition at line 754 of file SDMDataObjectWriter.h.

References FILE, MEMORY, numBytes_, ofs_, oss_, otype_, and STDOUT.

template<class T >
void asdmbinaries::SDMDataObjectWriter::output ( const vector< T > &  data) [inline]

Definition at line 754 of file SDMDataObjectWriter.h.

References FILE, MEMORY, numBytes_, ofs_, oss_, otype_, and STDOUT.

void asdmbinaries::SDMDataObjectWriter::outputln ( const string &  s)
void asdmbinaries::SDMDataObjectWriter::outputln ( const string &  s)
void asdmbinaries::SDMDataObjectWriter::outputln ( const float *  data,
uint32_t  numData 
)
void asdmbinaries::SDMDataObjectWriter::outputln ( const float *  data,
uint32_t  numData 
)
void asdmbinaries::SDMDataObjectWriter::outputln ( const long long *  data,
uint32_t  numData 
)
void asdmbinaries::SDMDataObjectWriter::outputln ( const long long *  data,
uint32_t  numData 
)
template<class T >
void asdmbinaries::SDMDataObjectWriter::outputln ( const vector< T > &  data) [inline]

Definition at line 772 of file SDMDataObjectWriter.h.

References casa::data, and outputln().

template<class T >
void asdmbinaries::SDMDataObjectWriter::outputln ( const vector< T > &  data) [inline]

Definition at line 772 of file SDMDataObjectWriter.h.

References casa::data, and outputln().

Referenced by outputln().

void asdmbinaries::SDMDataObjectWriter::outputlnLocation ( const string &  name,
const SDMDataSubset sdmDataSubset 
)
void asdmbinaries::SDMDataObjectWriter::outputlnLocation ( const string &  name,
const SDMDataSubset sdmDataSubset 
)

Write the very end of the MIME message.

Write the very end of the MIME message.

Writes the very first part of the MIME message.

Writes the very first part of the MIME message.

void asdmbinaries::SDMDataObjectWriter::tpData ( uint64_t  startTime,
const string &  execBlockUID,
uint32_t  execBlockNum,
uint32_t  scanNum,
uint32_t  subscanNum,
uint32_t  numOfIntegrations,
uint32_t  numAntenna,
const vector< SDMDataObject::Baseband > &  basebands,
uint64_t  time,
uint64_t  interval,
const vector< AxisName > &  flagsAxes,
const vector< FLAGSTYPE > &  flags,
const vector< AxisName > &  actualTimesAxes,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< AxisName > &  actualDurationsAxes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< AxisName > &  autoDataAxes,
const vector< AUTODATATYPE > &  autoData 
)

Writes the full content of Total Power data in their respective attachments (global XML header, local XML header and binary attachments) on the MIME message stream.

Parameters:
startTimestart time.
execBlockUIDthe UID of the exec block.
execBlockNumthe index of the exec block.
scanNumthe index of the scan.
subscanNumthe index of the subscan.
numOfIntegrationsthe number of integrations in that Subscan.
numAntennathe number of antenna.
basebandsa vector of Baseband describing the structure of the binary data.
time.
interval.
flagsthe values of flags (see note).
actualTimesthe values of actualTimes (see note).
actualDurationsthe values of actualDurations (see note).
autoDataAxesthe ordered set of axes names for autoData.
autoDatathe values of autoData.
autoDataNormalized
Exceptions:
SDMDataObjectWriterException
Note:
A vector with a null size can be passed when the (optional) attachment is absent.
this method allows to write Total Power data in a "one-call" way. An alternate solution consists in calling tpDataHeader and then addTPSubscan.
void asdmbinaries::SDMDataObjectWriter::tpData ( uint64_t  startTime,
const string &  execBlockUID,
uint32_t  execBlockNum,
uint32_t  scanNum,
uint32_t  subscanNum,
uint32_t  numOfIntegrations,
uint32_t  numAntenna,
const vector< SDMDataObject::Baseband > &  basebands,
uint64_t  time,
uint64_t  interval,
const vector< AxisName > &  flagsAxes,
const vector< FLAGSTYPE > &  flags,
const vector< AxisName > &  actualTimesAxes,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< AxisName > &  actualDurationsAxes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< AxisName > &  autoDataAxes,
const vector< AUTODATATYPE > &  autoData 
)

Writes the full content of Total Power data in their respective attachments (global XML header, local XML header and binary attachments) on the MIME message stream.

Parameters:
startTimestart time.
execBlockUIDthe UID of the exec block.
execBlockNumthe index of the exec block.
scanNumthe index of the scan.
subscanNumthe index of the subscan.
numOfIntegrationsthe number of integrations in that Subscan.
numAntennathe number of antenna.
basebandsa vector of Baseband describing the structure of the binary data.
time.
interval.
flagsthe values of flags (see note).
actualTimesthe values of actualTimes (see note).
actualDurationsthe values of actualDurations (see note).
autoDataAxesthe ordered set of axes names for autoData.
autoDatathe values of autoData.
autoDataNormalized
Exceptions:
SDMDataObjectWriterException
Note:
A vector with a null size can be passed when the (optional) attachment is absent.
this method allows to write Total Power data in a "one-call" way. An alternate solution consists in calling tpDataHeader and then addTPSubscan.
void asdmbinaries::SDMDataObjectWriter::tpData ( uint64_t  startTime,
const string &  execBlockUID,
uint32_t  execBlockNum,
uint32_t  scanNum,
uint32_t  subscanNum,
uint32_t  numOfIntegrations,
uint32_t  numAntenna,
const vector< SDMDataObject::Baseband > &  basebands,
uint64_t  time,
uint64_t  interval,
const vector< AxisName > &  autoDataAxes,
const vector< AUTODATATYPE > &  autoData 
)

Writes the full content of Total Power data in their respective attachments (global XML header, local XML header and binary attachments) on the MIME message stream.

Parameters:
startTimestart time.
execBlockUIDthe UID of the exec block.
execBlockNumthe index of the exec block.
scanNumthe index of the scan.
subscanNumthe index of the subscan.
numOfIntegrationsthe number of integrations in that Subscan.
numAntennathe number of antenna.
basebandsa vector of Baseband describing the structure of the binary data.
time
interval
autoDataAxesthe ordered set of axes names for autoData.
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method is kept for backward compatibility reasons. It's recommanded to use the "long" version of tpData which gives a full control of the optional attachments to be written.
void asdmbinaries::SDMDataObjectWriter::tpData ( uint64_t  startTime,
const string &  execBlockUID,
uint32_t  execBlockNum,
uint32_t  scanNum,
uint32_t  subscanNum,
uint32_t  numOfIntegrations,
uint32_t  numAntenna,
const vector< SDMDataObject::Baseband > &  basebands,
uint64_t  time,
uint64_t  interval,
const vector< AxisName > &  autoDataAxes,
const vector< AUTODATATYPE > &  autoData 
)

Writes the full content of Total Power data in their respective attachments (global XML header, local XML header and binary attachments) on the MIME message stream.

Parameters:
startTimestart time.
execBlockUIDthe UID of the exec block.
execBlockNumthe index of the exec block.
scanNumthe index of the scan.
subscanNumthe index of the subscan.
numOfIntegrationsthe number of integrations in that Subscan.
numAntennathe number of antenna.
basebandsa vector of Baseband describing the structure of the binary data.
time
interval
autoDataAxesthe ordered set of axes names for autoData.
autoDatathe values of autoData.
Exceptions:
SDMDataObjectWriterException
Note:
This method is kept for backward compatibility reasons. It's recommanded to use the "long" version of tpData which gives a full control of the optional attachments to be written.
void asdmbinaries::SDMDataObjectWriter::tpDataHeader ( uint64_t  startTime,
const string &  execBlockUID,
uint32_t  execBlockNum,
uint32_t  scanNum,
uint32_t  subscanNum,
uint32_t  numOfIntegrations,
uint32_t  numAntenna,
SDMDataObject::DataStruct dataStruct 
)

Writes the XML global header on the MIME message stream, when binary data are Total Power data.

Parameters:
startimestart time.
execBlockUIDthe UID of the exec block.
execBlockNumthe index of the exec block.
scanNumthe index of the scan.
subscanNumthe index of the subscan.
numOfIntegrationsthe number of integrations in that Subscan.
numAntennathe number of antenna.
dataStructthe description of the binary data structure.
Exceptions:
SDMDataObjectWriterException
void asdmbinaries::SDMDataObjectWriter::tpDataHeader ( uint64_t  startTime,
const string &  execBlockUID,
uint32_t  execBlockNum,
uint32_t  scanNum,
uint32_t  subscanNum,
uint32_t  numOfIntegrations,
uint32_t  numAntenna,
SDMDataObject::DataStruct dataStruct 
)

Writes the XML global header on the MIME message stream, when binary data are Total Power data.

Parameters:
startimestart time.
execBlockUIDthe UID of the exec block.
execBlockNumthe index of the exec block.
scanNumthe index of the scan.
subscanNumthe index of the subscan.
numOfIntegrationsthe number of integrations in that Subscan.
numAntennathe number of antenna.
dataStructthe description of the binary data structure.
Exceptions:
SDMDataObjectWriterException
void asdmbinaries::SDMDataObjectWriter::wvrData ( const string &  execBlockUID,
uint32_t  execBlockNum,
uint32_t  scanNum,
uint32_t  subscanNum,
uint32_t  numTimes,
uint32_t  numAntennas,
uint32_t  numChannels,
NetSideband  netSideband,
uint64_t  time,
uint64_t  interval,
const vector< AUTODATATYPE > &  wvrData,
const vector< FLAGSTYPE > &  flags 
)

Writes water vapour radiometer (WVR) data in a MIME message conform with the BDF V2 format.

Parameters:
execBlockUIDthe archive uid of the exec Block,
execBlockNumthe index of the exec Block,
scanNumthe number of the scan,
subscanNumthe number of the subscan,
numTimesthe number of time stamps (i.e. size along the TIM axis),
numAntennasthe number of antennas producing WVR data,
numChannelsthe number of channels in WVR data,
netSidebandthe NetSideband characteristic attached to WVR data,
timethe mid-point of the time range containing all the WVR data,
intervalthe duration of the time range containing all the WVR data,
wvrDatathe WVR data,
flagsthe flags associated to the WVR data.
Exceptions:
SDMDataObjectWriterException
Note:
  • see the constructor of the class and the done method for opening the output stream where the MIME message is actually written (file, memory...) and for closing it
  • the "startTime" element of the global header in the resulting MIME document will be filled with a value equal to 'time' - 'interval'/2,
  • 'time' and 'interval' express a number of nanoseconds. 'time' is an MJD,
  • 'wvrData' and 'flags' are both 1D arrays. Nonetheless they are expected to be the linearized versions of multi dimensional arrays whose axes are defined by the sequence TIM ANT SPP for the WVR data and TIM ANT for their flags, (SPP varying before ANT varying itself before TIM),
  • a vector of null size for the argument 'flags' will be interpreted as 'flags not available'.
  • a null value in at least one of the arguments 'numTimes', 'numAntennas' or 'numChannels' will trigger an SDMDataObjectWriterException.
  • a argument 'wvrData' with a size different from 'numTimes' * 'numAntennas' * 'numChannels' will trigger an SDMDataObjectWriterException.
  • an argument 'flags' with a size different from 0 and different from 'numTimes' * 'numAntennas' will trigger an SDMDataObjectWriterException.
void asdmbinaries::SDMDataObjectWriter::wvrData ( const string &  execBlockUID,
uint32_t  execBlockNum,
uint32_t  scanNum,
uint32_t  subscanNum,
uint32_t  numTimes,
uint32_t  numAntennas,
uint32_t  numChannels,
NetSideband  netSideband,
uint64_t  time,
uint64_t  interval,
const vector< AUTODATATYPE > &  wvrData,
const vector< FLAGSTYPE > &  flags 
)

Writes water vapour radiometer (WVR) data in a MIME message conform with the BDF V2 format.

Parameters:
execBlockUIDthe archive uid of the exec Block,
execBlockNumthe index of the exec Block,
scanNumthe number of the scan,
subscanNumthe number of the subscan,
numTimesthe number of time stamps (i.e. size along the TIM axis),
numAntennasthe number of antennas producing WVR data,
numChannelsthe number of channels in WVR data,
netSidebandthe NetSideband characteristic attached to WVR data,
timethe mid-point of the time range containing all the WVR data,
intervalthe duration of the time range containing all the WVR data,
wvrDatathe WVR data,
flagsthe flags associated to the WVR data.
Exceptions:
SDMDataObjectWriterException
Note:
  • see the constructor of the class and the done method for opening the output stream where the MIME message is actually written (file, memory...) and for closing it
  • the "startTime" element of the global header in the resulting MIME document will be filled with a value equal to 'time' - 'interval'/2,
  • 'time' and 'interval' express a number of nanoseconds. 'time' is an MJD,
  • 'wvrData' and 'flags' are both 1D arrays. Nonetheless they are expected to be the linearized versions of multi dimensional arrays whose axes are defined by the sequence TIM ANT SPP for the WVR data and TIM ANT for their flags, (SPP varying before ANT varying itself before TIM),
  • a vector of null size for the argument 'flags' will be interpreted as 'flags not available'.
  • a null value in at least one of the arguments 'numTimes', 'numAntennas' or 'numChannels' will trigger an SDMDataObjectWriterException.
  • a argument 'wvrData' with a size different from 'numTimes' * 'numAntennas' * 'numChannels' will trigger an SDMDataObjectWriterException.
  • an argument 'flags' with a size different from 0 and different from 'numTimes' * 'numAntennas' will trigger an SDMDataObjectWriterException.

Member Data Documentation

Definition at line 858 of file SDMDataObjectWriter.h.

Are we done with this ?

Definition at line 849 of file SDMDataObjectWriter.h.

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

Class initialization stuff.

Definition at line 808 of file SDMDataObjectWriter.h.

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

Two strings used as MIME boundaries.

Definition at line 803 of file SDMDataObjectWriter.h.

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

Definition at line 804 of file SDMDataObjectWriter.h.

The number of bytes written so far.

Definition at line 852 of file SDMDataObjectWriter.h.

Referenced by output().

Definition at line 784 of file SDMDataObjectWriter.h.

Referenced by output().

ostringstream * asdmbinaries::SDMDataObjectWriter::oss_ [private]

Definition at line 785 of file SDMDataObjectWriter.h.

Referenced by output().

Definition at line 783 of file SDMDataObjectWriter.h.

Referenced by output().

An SDMDataObject.

Definition at line 797 of file SDMDataObjectWriter.h.

The number of the SDMDataSubset being written.

Definition at line 800 of file SDMDataObjectWriter.h.

The subscan path.

Definition at line 794 of file SDMDataObjectWriter.h.

The title of the binary data.

Definition at line 791 of file SDMDataObjectWriter.h.

The ALMA uid of the MIME message.

Definition at line 788 of file SDMDataObjectWriter.h.

static vector< AxisName > asdmbinaries::SDMDataObjectWriter::WVRDATAAXES [static, private]

The axes names definitions for WVR data and their related flags.

Definition at line 812 of file SDMDataObjectWriter.h.

static vector< AxisName > asdmbinaries::SDMDataObjectWriter::WVRDATAFLAGSAXES [static, private]

Definition at line 812 of file SDMDataObjectWriter.h.


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