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 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 tpDataHeader (uint64_t startTime, const string &execBlockUID, uint32_t execBlockNum, uint32_t scanNum, uint32_t subscanNum, uint32_t numAntenna, SDMDataObject::DataStruct &dataStruct)
 Writes the XML global header on the MIME message stream, when binary data are Total Power data and will be written in successive steps with calls to tpAddIntegration.
void tpAddIntegration (uint32_t integrationNum, uint64_t time, uint64_t interval, const vector< FLAGSTYPE > &flags, const vector< ACTUALTIMESTYPE > &actualTimes, const vector< ACTUALDURATIONSTYPE > &actualDurations, const vector< AUTODATATYPE > &autoData)
 Writes one integration (local header + binary attachment) of total power data 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 one integration (local header + binary attachment) of correlator data 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
}
enum  States {
  START,
  S_TPDATA,
  S_TPDATAHEADER,
  S_ADDTPSUBSCAN,
  S_ADDTPINTEGRATION,
  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_ADDTPINTEGRATION,
  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)

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.

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.

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 

Definition at line 807 of file SDMDataObjectWriter.h.

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

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

Definition at line 881 of file SDMDataObjectWriter.h.

Enumerator:
T_TPDATA 
T_TPDATAHEADER 
T_ADDTPSUBSCAN 
T_ADDTPINTEGRATION 
T_WVRDATA 
T_CORRDATAHEADER 
T_ADDINTEGRATION 
T_ADDSUBINTEGRATION 
T_DONE 

Definition at line 882 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:
uid a string containing the ALMA uid of the MIME message.
title a 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:
ofs an pointer to an ofstream object.
uid a string containing the ALMA uid of the MIME message.
title a 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:
oss a pointer to an ostringstream.
uid a string containing the ALMA uid of the MIME message.
title a string defining the title for the binary data to be written.
Note:
*oss will be systematically cleared before the first write operation.
virtual asdmbinaries::SDMDataObjectWriter::~SDMDataObjectWriter (  )  [virtual]

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::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:
integrationNum the index (1 based) of the integration.
time time of the integration.
interval interval of the integration.
flags the values of flags.
actualTimes the values of actualTimes.
actualDurations the values of actualDurations.
zeroLags the values of zeroLags.
crossData the values of crossData (encoded in float).
autoData the 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< SHORTCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

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

Parameters:
integrationNum the index (1 based) of the integration.
time time of the integration.
interval interval of the integration.
flags the values of flags.
actualTimes the values of actualTimes.
actualDurations the values of actualDurations.
zeroLags the values of zeroLags.
crossData the values of crossData (encoded in short).
autoData the 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< INTCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

Writes one integration (local header + binary attachment) of correlator data on the MIME message stream.

Parameters:
integrationNum the index (1 based) of the integration.
time time of the integration.
interval interval of the integration.
flags the values of flags.
actualTimes the values of actualTimes.
actualDurations the values of actualDurations.
zeroLags the values of zeroLags.
crossData the values of crossData (encoded in int).
autoData the 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< FLOATCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

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

Parameters:
integrationNum the index (1 based) of the integration.
subintegrationNum the index(1 based) of the subintegration.
time time of the integration.
interval interval of the integration.
flags the values of flags.
actualTimes the values of actualTimes.
actualDurations the values of actualDurations.
zeroLags the values of zeroLags.
crossData the values of crossData (encoded in float).
autoData the 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< SHORTCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

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

Parameters:
integrationNum the index (1 based) of the integration.
subintegrationNum the index(1 based) of the subintegration.
time time of the integration.
interval interval of the integration.
flags the values of flags.
actualTimes the values of actualTimes.
actualDurations the values of actualDurations.
zeroLags the values of zeroLags.
crossData the values of crossData (encoded in short).
autoData the 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< INTCROSSDATATYPE > &  crossData,
const vector< AUTODATATYPE > &  autoData 
)

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

Parameters:
integrationNum the index (1 based) of the integration.
subintegrationNum the index(1 based) of the subintegration.
time time of the integration.
interval interval of the integration.
flags the values of flags.
actualTimes the values of actualTimes.
actualDurations the values of actualDurations.
zeroLags the values of zeroLags.
crossData the values of crossData (encoded in int).
autoData the 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::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:
startime start time.
execBlockUID the UID of the exec block.
execBlockNum the index of the exec block.
scanNum the index of the scan.
subscanNum the index of the subscan.
numAntenna the number of antenna.
correlationMode the correlation mode code.
spectralResolution the spectral resolution code.
dataStruct the description of the binary data structure.
Exceptions:
SDMDataObjectWriterException 
void asdmbinaries::SDMDataObjectWriter::done (  ) 

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 840 of file SDMDataObjectWriter.h.

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

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.
template<class T >
void asdmbinaries::SDMDataObjectWriter::output ( const vector< T > &  data  )  [inline]

Definition at line 779 of file SDMDataObjectWriter.h.

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

void asdmbinaries::SDMDataObjectWriter::output ( const float *  data,
uint32_t  numData 
)
void asdmbinaries::SDMDataObjectWriter::output ( const string &  s  ) 
void asdmbinaries::SDMDataObjectWriter::outputln (  ) 

Referenced by outputln().

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

Definition at line 797 of file SDMDataObjectWriter.h.

References outputln().

void asdmbinaries::SDMDataObjectWriter::outputln ( const long long *  data,
uint32_t  numData 
)
void asdmbinaries::SDMDataObjectWriter::outputln ( const float *  data,
uint32_t  numData 
)
void asdmbinaries::SDMDataObjectWriter::outputln ( const string &  s  ) 
void asdmbinaries::SDMDataObjectWriter::outputlnLocation ( const string &  name,
const SDMDataSubset sdmDataSubset 
)
void asdmbinaries::SDMDataObjectWriter::postamble (  )  [private]

Write the very end of the MIME message.

void asdmbinaries::SDMDataObjectWriter::preamble (  )  [private]

Writes the very first part of the MIME message.

void asdmbinaries::SDMDataObjectWriter::tpAddIntegration ( uint32_t  integrationNum,
uint64_t  time,
uint64_t  interval,
const vector< FLAGSTYPE > &  flags,
const vector< ACTUALTIMESTYPE > &  actualTimes,
const vector< ACTUALDURATIONSTYPE > &  actualDurations,
const vector< AUTODATATYPE > &  autoData 
)

Writes one integration (local header + binary attachment) of total power data on the MIME message stream.

Parameters:
integrationNum the index (1 based) of the integration.
time time of the integration.
interval interval of the integration.
flags the values of flags.
actualTimes the values of actualTimes.
actualDurations the values of actualDurations.
autoData the values of autoData.
Exceptions:
SDMDataObjectWriterException 
Note:
To be used repeatedly after one call to tpDataHeader until all the integrations of Total Power data have been acquired.
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:
startTime start time.
execBlockUID the UID of the exec block.
execBlockNum the index of the exec block.
scanNum the index of the scan.
subscanNum the index of the subscan.
numOfIntegrations the number of integrations in that Subscan.
numAntenna the number of antenna.
basebands a vector of Baseband describing the structure of the binary data.
time 
interval 
autoDataAxes the ordered set of axes names for autoData.
autoData the 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 > &  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:
startTime start time.
execBlockUID the UID of the exec block.
execBlockNum the index of the exec block.
scanNum the index of the scan.
subscanNum the index of the subscan.
numOfIntegrations the number of integrations in that Subscan.
numAntenna the number of antenna.
basebands a vector of Baseband describing the structure of the binary data.
time. 
interval. 
flags the values of flags (see note).
actualTimes the values of actualTimes (see note).
actualDurations the values of actualDurations (see note).
autoDataAxes the ordered set of axes names for autoData.
autoData the 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::tpDataHeader ( uint64_t  startTime,
const string &  execBlockUID,
uint32_t  execBlockNum,
uint32_t  scanNum,
uint32_t  subscanNum,
uint32_t  numAntenna,
SDMDataObject::DataStruct dataStruct 
)

Writes the XML global header on the MIME message stream, when binary data are Total Power data and will be written in successive steps with calls to tpAddIntegration.

Parameters:
startime start time.
execBlockUID the UID of the exec block.
execBlockNum the index of the exec block.
scanNum the index of the scan.
subscanNum the index of the subscan.
numAntenna the number of antenna.
dataStruct the 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:
execBlockUID the archive uid of the exec Block,
execBlockNum the index of the exec Block,
scanNum the number of the scan,
subscanNum the number of the subscan,
numTimes the number of time stamps (i.e. size along the TIM axis),
numAntennas the number of antennas producing WVR data,
numChannels the number of channels in WVR data,
netSideband the NetSideband characteristic attached to WVR data,
time the mid-point of the time range containing all the WVR data,
interval the duration of the time range containing all the WVR data,
wvrData the WVR data,
flags the 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 883 of file SDMDataObjectWriter.h.

Are we done with this ?

Definition at line 874 of file SDMDataObjectWriter.h.

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

Class initialization stuff.

Definition at line 833 of file SDMDataObjectWriter.h.

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

Two strings used as MIME boundaries.

Definition at line 828 of file SDMDataObjectWriter.h.

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

Definition at line 829 of file SDMDataObjectWriter.h.

The number of bytes written so far.

Definition at line 877 of file SDMDataObjectWriter.h.

Referenced by output().

Definition at line 809 of file SDMDataObjectWriter.h.

Referenced by output().

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

Definition at line 810 of file SDMDataObjectWriter.h.

Referenced by output().

Definition at line 808 of file SDMDataObjectWriter.h.

Referenced by output().

An SDMDataObject.

Definition at line 822 of file SDMDataObjectWriter.h.

The number of the SDMDataSubset being written.

Definition at line 825 of file SDMDataObjectWriter.h.

The subscan path.

Definition at line 819 of file SDMDataObjectWriter.h.

The title of the binary data.

Definition at line 816 of file SDMDataObjectWriter.h.

The ALMA uid of the MIME message.

Definition at line 813 of file SDMDataObjectWriter.h.

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

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

Definition at line 837 of file SDMDataObjectWriter.h.

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

Definition at line 837 of file SDMDataObjectWriter.h.


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

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1