1 #ifndef SDMDataObjectWriter_CLASS
2 #define SDMDataObjectWriter_CLASS
22 namespace asdmbinaries {
60 return "SDMDataObjectWriterException : " +
message;
275 SDMDataObjectWriter(
const std::string& uid=
"uid://X0/X0/X0",
const std::string& title=
"ALMA Binary Data");
285 SDMDataObjectWriter(std::ofstream* ofs,
const std::string& uid=
"uid://X0/X0/X0",
const std::string& title=
"ALMA Binary Data");
295 SDMDataObjectWriter(std::ostringstream* oss,
const std::string& uid=
"uid://X0/X0/X0",
const std::string& title=
"ALMA Binary Data");
363 void tpData(uint64_t startTime,
364 const std::string& execBlockUID,
365 uint32_t execBlockNum,
368 uint32_t numOfIntegrations,
370 const std::vector<SDMDataObject::Baseband>& basebands,
373 const std::vector<AxisNameMod::AxisName>& flagsAxes,
374 const std::vector<FLAGSTYPE>&
flags,
375 const std::vector<AxisNameMod::AxisName>& actualTimesAxes,
376 const std::vector<ACTUALTIMESTYPE>& actualTimes,
377 const std::vector<AxisNameMod::AxisName>& actualDurationsAxes,
378 const std::vector<ACTUALDURATIONSTYPE>& actualDurations,
379 const std::vector<AxisNameMod::AxisName>& autoDataAxes,
380 const std::vector<AUTODATATYPE>& autoData);
404 void tpData(uint64_t startTime,
405 const std::string& execBlockUID,
406 uint32_t execBlockNum,
409 uint32_t numOfIntegrations,
411 const std::vector<SDMDataObject::Baseband>& basebands,
414 const std::vector<AxisNameMod::AxisName>& autoDataAxes,
415 const std::vector<AUTODATATYPE>& autoData);
432 const std::string& execBlockUID,
433 uint32_t execBlockNum,
458 const std::vector<FLAGSTYPE>& flags,
459 const std::vector<ACTUALTIMESTYPE>& actualTimes,
460 const std::vector<ACTUALDURATIONSTYPE>& actualDurations,
461 const std::vector<AUTODATATYPE>& autoData);
506 void wvrData (
const std::string & execBlockUID,
507 uint32_t execBlockNum,
511 uint32_t numAntennas,
512 uint32_t numChannels,
513 NetSidebandMod::NetSideband netSideband,
516 const std::vector<AUTODATATYPE>&
wvrData,
517 const std::vector<FLAGSTYPE>& flags);
536 const std::string& execBlockUID,
537 uint32_t execBlockNum,
541 CorrelationModeMod::CorrelationMode correlationMode,
571 const std::vector<FLAGSTYPE>& flags,
572 const std::vector<ACTUALTIMESTYPE>& actualTimes,
573 const std::vector<ACTUALDURATIONSTYPE>& actualDurations,
574 const std::vector<ZEROLAGSTYPE>& zeroLags,
575 const std::vector<INTCROSSDATATYPE>& crossData,
576 const std::vector<AUTODATATYPE>& autoData);
604 const std::vector<FLAGSTYPE>& flags,
605 const std::vector<ACTUALTIMESTYPE>& actualTimes,
606 const std::vector<ACTUALDURATIONSTYPE>& actualDurations,
607 const std::vector<ZEROLAGSTYPE>& zeroLags,
608 const std::vector<SHORTCROSSDATATYPE>& crossData,
609 const std::vector<AUTODATATYPE>& autoData);
636 const std::vector<FLAGSTYPE>& flags,
637 const std::vector<ACTUALTIMESTYPE>& actualTimes,
638 const std::vector<ACTUALDURATIONSTYPE>& actualDurations,
639 const std::vector<ZEROLAGSTYPE>& zeroLags,
640 const std::vector<FLOATCROSSDATATYPE>& crossData,
641 const std::vector<AUTODATATYPE>& autoData);
668 uint32_t subintegrationNum,
671 const std::vector<FLAGSTYPE>& flags,
672 const std::vector<ACTUALTIMESTYPE>& actualTimes,
673 const std::vector<ACTUALDURATIONSTYPE>& actualDurations,
674 const std::vector<ZEROLAGSTYPE>& zeroLags,
675 const std::vector<INTCROSSDATATYPE>& crossData,
676 const std::vector<AUTODATATYPE>& autoData);
703 uint32_t subintegrationNum,
706 const std::vector<FLAGSTYPE>& flags,
707 const std::vector<ACTUALTIMESTYPE>& actualTimes,
708 const std::vector<ACTUALDURATIONSTYPE>& actualDurations,
709 const std::vector<ZEROLAGSTYPE>& zeroLags,
710 const std::vector<SHORTCROSSDATATYPE>& crossData,
711 const std::vector<AUTODATATYPE>& autoData);
737 uint32_t subintegrationNum,
740 const std::vector<FLAGSTYPE>& flags,
741 const std::vector<ACTUALTIMESTYPE>& actualTimes,
742 const std::vector<ACTUALDURATIONSTYPE>& actualDurations,
743 const std::vector<ZEROLAGSTYPE>& zeroLags,
744 const std::vector<FLOATCROSSDATATYPE>& crossData,
745 const std::vector<AUTODATATYPE>& autoData);
763 void output (
const std::string& s);
764 void outputln (
const std::string& s);
765 void output (
const float*
data, uint32_t numData);
766 void outputln (
const float* data, uint32_t numData);
767 void outputln (
const long long* data, uint32_t numData);
769 template <
class T>
void output(
const std::vector<T>& data) {
774 std::cout.write((
const char*)&data.at(0), data.size()*
sizeof(T));
778 oss_->write((
const char*)&data.at(0), data.size()*
sizeof(T));
782 ofs_->write((
const char*)&data.at(0), data.size()*
sizeof(T));
787 template <
class T>
void outputln (
const std::vector<T>& data) {
830 template <
class Enum,
class EnumHelper>
static std::vector<Enum>
enumvec(
const std::string& strliterals) {
831 std::vector<Enum> result;
833 std::string strliteral;
834 std::stringstream ss(strliterals);
836 std::vector<std::string> tokens;
837 while (ss >> strliteral)
838 result.push_back(EnumHelper::literal(strliteral));
850 void addData(uint32_t integrationNum,
851 uint32_t subintegrationNum,
854 const std::vector<FLAGSTYPE>& flags,
855 const std::vector<ACTUALTIMESTYPE>& actualTimes,
856 const std::vector<ACTUALDURATIONSTYPE>& actualDurations,
857 const std::vector<ZEROLAGSTYPE>& zeroLags,
858 const std::vector<INTCROSSDATATYPE>& intCrossData,
859 const std::vector<SHORTCROSSDATATYPE>& shortCrossData,
860 const std::vector<FLOATCROSSDATATYPE>& floatCrossData,
861 const std::vector<AUTODATATYPE>& autoData);
879 #endif // SDMDataObjectWriter_CLASS
SDMDataObject:: declarations.
void wvrData(const std::string &execBlockUID, uint32_t execBlockNum, uint32_t scanNum, uint32_t subscanNum, uint32_t numTimes, uint32_t numAntennas, uint32_t numChannels, NetSidebandMod::NetSideband netSideband, uint64_t time, uint64_t interval, const std::vector< AUTODATATYPE > &wvrData, const std::vector< FLAGSTYPE > &flags)
Writes water vapour radiometer (WVR) data in a MIME message conform with the BDF V2 format...
void output(const std::string &s)
static std::vector< Enum > enumvec(const std::string &strliterals)
A utility to fill a vector of <Enum> from a an array of c-strings.
bool done_
Are we done with this ?
void corrDataHeader(uint64_t startime, const std::string &execBlockUID, uint32_t execBlockNum, uint32_t scanNum, uint32_t subscanNum, uint32_t numAntenna, CorrelationModeMod::CorrelationMode correlationMode, const OptionalSpectralResolutionType &spectralResolutionType, SDMDataObject::DataStruct &dataStruct)
Writes the XML global header on the MIME message stream, when binary data are (sub)integrations produ...
States
A small finite state automaton to control the usage of SDMDataObjectWriter.
virtual ~SDMDataObjectWriter()
The destructor.
virtual ~SDMDataObjectWriterException()
The destructor.
std::string uid_
The ALMA uid of the MIME message.
ABSTRACT TOOL CLASSES A PlotTool is a higher level event handler for a PlotCanvas The idea is to take common tasks which may require multiple events and put them in one place PlotTools also provide additional functionality in that they can be active and blocking non blocking The PlotCanvas will only send events to active and will not send events to later tools or event handlers if the latest tool was blocking In this way a single tool can be used to handle ALL user interaction via the GUI at one time
uint64_t numBytes()
Returns the number of bytes written so far.
void postamble()
Write the very end of the MIME message.
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
void done()
This method must be called to conclude the activity of this SDMDataObjectWriter.
A general class to write MIME messages containing ALMA binary data.
void outputln(const std::vector< T > &data)
static const std::string MIMEBOUNDARY_1
Two strings used as MIME boundaries.
std::ostringstream * oss_
void addIntegration(uint32_t integrationNum, uint64_t time, uint64_t interval, const std::vector< FLAGSTYPE > &flags, const std::vector< ACTUALTIMESTYPE > &actualTimes, const std::vector< ACTUALDURATIONSTYPE > &actualDurations, const std::vector< ZEROLAGSTYPE > &zeroLags, const std::vector< INTCROSSDATATYPE > &crossData, const std::vector< AUTODATATYPE > &autoData)
Writes one integration (local header + binary attachment) of correlator data on the MIME message stre...
void tpDataHeader(uint64_t startTime, const std::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 wi...
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
SDMDataObject sdmDataObject_
An SDMDataObject.
static std::vector< AxisNameMod::AxisName > WVRDATAAXES
The axes names definitions for WVR data and their related flags.
A class to represent an exception thrown while writing a MIME message containing ALMA binary data...
void preamble()
Writes the very first part of the MIME message.
std::string title_
The title of the binary data.
std::string subscanPath_
The subscan path.
void outputlnLocation(const std::string &name, const SDMDataSubset &sdmDataSubset)
void tpAddIntegration(uint32_t integrationNum, uint64_t time, uint64_t interval, const std::vector< FLAGSTYPE > &flags, const std::vector< ACTUALTIMESTYPE > &actualTimes, const std::vector< ACTUALDURATIONSTYPE > &actualDurations, const std::vector< AUTODATATYPE > &autoData)
Writes one integration (local header + binary attachment) of total power data on the MIME message str...
void addSubintegration(uint32_t integrationNum, uint32_t subintegrationNum, uint64_t time, uint64_t interval, const std::vector< FLAGSTYPE > &flags, const std::vector< ACTUALTIMESTYPE > &actualTimes, const std::vector< ACTUALDURATIONSTYPE > &actualDurations, const std::vector< ZEROLAGSTYPE > &zeroLags, const std::vector< INTCROSSDATATYPE > &crossData, const std::vector< AUTODATATYPE > &autoData)
Writes an subintegration (local header + binary attachment) on the MIME message stream.
SDMDataObjectWriterException()
An empty contructor.
void checkState(Transitions t, const std::string &methodName)
void tpData(uint64_t startTime, const std::string &execBlockUID, uint32_t execBlockNum, uint32_t scanNum, uint32_t subscanNum, uint32_t numOfIntegrations, uint32_t numAntenna, const std::vector< SDMDataObject::Baseband > &basebands, uint64_t time, uint64_t interval, const std::vector< AxisNameMod::AxisName > &flagsAxes, const std::vector< FLAGSTYPE > &flags, const std::vector< AxisNameMod::AxisName > &actualTimesAxes, const std::vector< ACTUALTIMESTYPE > &actualTimes, const std::vector< AxisNameMod::AxisName > &actualDurationsAxes, const std::vector< ACTUALDURATIONSTYPE > &actualDurations, const std::vector< AxisNameMod::AxisName > &autoDataAxes, const std::vector< AUTODATATYPE > &autoData)
Writes the full content of Total Power data in their respective attachments (global XML header...
static const std::string MIMEBOUNDARY_2
uint32_t sdmDataSubsetNum_
The number of the SDMDataSubset being written.
static const bool initClass_
Class initialization stuff.
std::string getMessage() const
Returns the message associated to this exception.
uint64_t numBytes_
The number of bytes written so far.
static std::vector< AxisNameMod::AxisName > WVRDATAFLAGSAXES
SDMDataObjectWriter(const std::string &uid="uid://X0/X0/X0", const std::string &title="ALMA Binary Data")
A constructor to write on standard output.
void addData(uint32_t integrationNum, uint32_t subintegrationNum, uint64_t time, uint64_t interval, const std::vector< FLAGSTYPE > &flags, const std::vector< ACTUALTIMESTYPE > &actualTimes, const std::vector< ACTUALDURATIONSTYPE > &actualDurations, const std::vector< ZEROLAGSTYPE > &zeroLags, const std::vector< INTCROSSDATATYPE > &intCrossData, const std::vector< SHORTCROSSDATATYPE > &shortCrossData, const std::vector< FLOATCROSSDATATYPE > &floatCrossData, const std::vector< AUTODATATYPE > &autoData)
SDMDataObject::DataStruct:: declarations.
void output(const std::vector< T > &data)