1 #ifndef SDMDataObject_CLASS
2 #define SDMDataObject_CLASS
12 #include "almaEnumerations_IFC.h"
29 #include <boost/regex.hpp>
82 #if defined(__APPLE__)
83 #include <machine/endian.h>
113 namespace asdmbinaries {
158 return "SDMDataObjectException : " +
message;
170 template<
class Enum,
class EnumHelper>
362 void strSw(
const std::string& s);
363 const std::string &
strSw()
const;
364 void strImage(
const std::string& s);
365 const std::string &
strImage()
const;
392 NetSidebandMod::NetSideband
sideband);
400 NetSidebandMod::NetSideband
sideband);
406 const std::vector<StokesParameterMod::StokesParameter>& sdPolProduct,
410 NetSidebandMod::NetSideband
sideband);
418 const std::vector<StokesParameterMod::StokesParameter>&
crossPolProducts()
const;
427 const std::vector<StokesParameterMod::StokesParameter>&
sdPolProducts()
const;
453 unsigned int numBin()
const;
461 NetSidebandMod::NetSideband
sideband()
const;
484 BasebandNameMod::BasebandName
name_;
513 BasebandNameMod::BasebandName
name()
const;
552 std::vector<AxisNameMod::AxisName>
axes_;
573 const std::vector<AxisNameMod::AxisName>&
axes);
579 virtual unsigned int size()
const;
588 virtual const std::vector<AxisNameMod::AxisName>&
axes()
const ;
623 const std::vector<AxisNameMod::AxisName>&
axes,
666 const std::vector<AxisNameMod::AxisName>&
axes,
724 DataStruct(
const std::vector<AtmPhaseCorrectionMod::AtmPhaseCorrection>&
apc,
738 const std::vector<AtmPhaseCorrectionMod::AtmPhaseCorrection>&
apc()
const;
745 const std::vector<Baseband>&
basebands()
const;
822 unsigned int ispw)
const;
853 unsigned int ispw)
const;
857 std::vector<AtmPhaseCorrectionMod::AtmPhaseCorrection>
apc_;
877 void divorceSPW(
unsigned int ibb,
unsigned int ispw) ;
890 CorrelationModeMod::CorrelationMode correlatorMode,
908 std::string
title()
const;
1034 bool isWVR()
const ;
1157 static std::vector<std::string>
axes;
1159 static std::vector<std::string>
apcs;
1228 bool inTitle(
const std::string& what)
const;
1240 std::string
toXML() ;
1241 void toXML(
const BinaryPart& binaryPart,
const std::string& elementName, std::ostringstream& oss)
const;
1242 void toXML(
const AutoDataBinaryPart& autoDataBinaryPart,
const std::string& elementName, std::ostringstream& oss)
const;
1243 void toXML(
const ZeroLagsBinaryPart& zeroLagsBinaryPart,
const std::string& elementName, std::ostringstream& oss)
const;
1244 void spectralWindowsToXML(
const std::vector<Baseband>& basebands,
unsigned int ibb, std::ostringstream& oss)
const;
1250 #ifndef WITHOUT_BOOST
1284 unsigned long long time,
1286 const std::vector<float>&
autoData);
1326 unsigned long long time()
const;
1332 unsigned long long interval()
const;
1339 std::string
toString(
unsigned int N = 10 )
const ;
1345 void toXML(std::ostringstream& oss)
const;
1351 std::string
toXML();
1446 PrimitiveDataTypeMod::PrimitiveDataType
crossDataType()
const;
1510 CorrelationModeMod::CorrelationMode
ref_;
1558 static std::string
quote(
const std::string& s);
1559 static std::string
quote(
bool b);
1560 static std::string
quote(
int i);
1561 static std::string
quote(
unsigned int i);
1562 static std::string
quote(
long long l);
1563 static std::string
quote(
float f);
1564 static std::string
quote(
const std::set<std::string>& s);
1565 static std::string
quote(
const std::vector<std::string>& s);
1566 template<
class Enum,
class EnumHelper>
static std::string
quote(Enum l) {
1567 std::ostringstream oss;
1574 template<
class Enum,
class EnumHelper>
static std::string
quote(
const std::vector<Enum>& v_l) {
1575 std::ostringstream oss;
1581 for (
unsigned int i = 1; i < v_l.size(); i++)
1587 template<
class Enum,
class EnumHelper>
static std::string
toString(Enum l) {
1588 std::ostringstream oss;
1593 template<
class Enum,
class EnumHelper>
static std::string
toString(
const std::vector<Enum>& v_l) {
1594 std::ostringstream oss;
1599 for (
unsigned int i = 1; i < v_l.size(); i++)
1607 template<
class Enum,
class EnumHelper>
static std::vector<Enum>
enumvec(
const std::string& strliterals) {
1608 std::vector<Enum> result;
1610 std::string strliteral;
1611 std::istringstream iss(strliterals);
1613 while (iss >> strliteral)
1614 result.push_back(EnumHelper::literal(strliteral));
1620 static void toXML(
const std::string& elementName,
int value, std::ostringstream& oss);
1621 static void toXML(
const std::string& elementName,
unsigned int value, std::ostringstream& oss);
1622 static void toXML(
const std::string& elementName,
long long value, std::ostringstream& oss);
1623 static void toXML(
const std::string& elementName,
unsigned long long value, std::ostringstream& oss);
1624 static void oXML(
const std::string& elementName, std::ostringstream& oss);
1625 static void cXML(
const std::string& elementName, std::ostringstream& oss);
1635 template<
class Enum,
class EnumHelper>
static void toXML(
const std::string& elementName, Enum
value, std::ostringstream& oss) {
1636 oss <<
"<" << elementName <<
">" <<
EnumHelper::name(value) <<
"</" << elementName <<
">" << std::endl;
1639 #define QUOTE Utils::quote
1640 #define TOSTRING Utils::toString
1641 #define TOXML Utils::toXML
1642 #define OXML Utils::oXML
1643 #define CXML Utils::cXML
1646 #endif // SDMDataObject_CLASS
std::string toXML()
Returns an XML representation of this SDMDataSubset.
unsigned int numBin() const
void numSpectralPoint(unsigned int value);
SDMDataObject:: declarations.
std::string xsiType() const
BinaryPart actualDurations_
AutoDataBinaryPart autoData_
unsigned long long interval_
std::map< std::string, unsigned int > str2index_
void corrBinAttachToXML(std::ostringstream &oss)
uint64_t actualTimesPosition() const
Returns the position (0-based, relative to the beginning of the file) of this part when it has been r...
float FLOATCROSSDATATYPE
Type of cross data when those are encoded as 32bits float.
const std::string & strSw() const
const ZeroLagsBinaryPart & zeroLags() const
void actualDurations(const BinaryPart& value);
static void invalidCall(const std::string &methodName, const SDMDataObject *sdmDataObject)
std::string abortReason() const
Returns the reason why the [sub]integration was aborted.
static std::string quote(Enum l)
static const ByteOrder * Little_Endian
void owner(const SDMDataObject *o)
virtual unsigned int size() const
Returns the size of a binary attachment as a number of values (e.g.
std::string projectPath() const
Returns the project path of this SDMDataSubset.
const std::vector< StokesParameterMod::StokesParameter > & crossPolProducts() const
Returns the vector of polarization products (for the interferometric data).
CorrelatorTypeMod::CorrelatorType correlatorType_
int16_t SHORTCROSSDATATYPE
Type of cross data when those are encoded as 16bits unsigned integers.
static std::vector< std::string > apcs
static std::string toString(const std::vector< Enum > &v_l)
uint64_t autoDataPosition() const
Returns the position (0-based, relative to the beginning of the file) of this part when it has been r...
uint64_t zeroLagsPosition_
static const ByteOrder * machineEndianity()
unsigned long int nAutoData_
void spectralWindowsToXML(const std::vector< Baseband > &basebands, unsigned int ibb, std::ostringstream &oss) const
bool associatedSPW(unsigned int ibb, unsigned int ispw1, unsigned int ispw2)
const std::vector< SDMDataSubset > & corrDataSubsets() const
Returns the binary data as a sequence of integrations.
float scaleFactor() const
void sdPolProducts(const vector<StokesParameter>& value);
SDMDataObject::Baseband:: declarations.
CorrelationModeMod::CorrelationMode correlationMode_
std::string actualDurationsREF_
Optional< SpectralResolutionTypeMod::SpectralResolutionType, CSpectralResolutionType > OptionalSpectralResolutionType
A typedef definition for an optional spectral resolution type.
std::string getMessage() const
Returns the message associated to this exception.
std::string title() const
Returns the title of the SDMDataObject.
Baseband()
An empty constructor.
unsigned int subintegrationNum() const
bool isTP() const
Returns true if the data are total power data and false otherwise.
const std::vector< SpectralWindow > & spectralWindows() const
void ref(BasebandName value);
unsigned long long abortTime() const
Returns the time, as an unsigned long long, at which the observation has been aborted.
std::string toString() const
Returns a string representation of this.
unsigned long int nZeroLags_
void checkCoordinate(unsigned int ibb, unsigned int ispw) const
void basebandsToXML(std::ostringstream &oss) const
const AUTODATATYPE * autoData_
unsigned int integrationNum() const
unsigned long long int abortTime_
ZeroLagsBinaryPart()
An empty constructor.
A class to embed optional information.
unsigned long int nFlags_
static const ByteOrder * Big_Endian
unsigned long int flags(const FLAGSTYPE *&ptr) const
Set ptr to the adress of the array of flags and returns the number of flags.
unsigned long long abortTime() const
Returns the time when the [sub]integration has been declared aborted.
const ACTUALTIMESTYPE * actualTimes_
std::vector< StokesParameterMod::StokesParameter > crossPolProducts_
static std::string quote(const std::vector< Enum > &v_l)
OptionalSpectralResolutionType spectralResolutionType() const
Returns the spectral resolution.
unsigned int subscanNum() const
Returns the number of the subscan.
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
Optional(Enum literal)
The full constructor.
unsigned int subintegrationNum_
void done()
Makes this SDMDataObject unusable.
~Baseband()
The destructor.
unsigned long long interval() const
Returns the duration of the subscan in the case of total power data.
float AUTODATATYPE
Type of auto data.
unsigned int numSpectralPoint_
unsigned int numTime() const
Returns the number of (sub) integrations.
unsigned long long time() const
Returns the midpoint of :
SDMDataSubset:: declarations.
A general class to write MIME messages containing ALMA binary data.
unsigned long int autoData(const AUTODATATYPE *&ptr) const
Set ptr to the adress of the array of AutoData and returns the number of AutoData.
unsigned int integrationNum_
static void toXML(const std::string &elementName, Enum value, std::ostringstream &oss)
A generic utility to XML'ize a literal as the content of an XML element.
Optional()
The empty constructor.
std::vector< StokesParameterMod::StokesParameter > sdPolProducts_
std::vector< SpectralWindow > spectralWindows_
const ByteOrder * byteOrder_
NetSidebandMod::NetSideband sideband_
static void oXML(const std::string &elementName, std::ostringstream &oss)
const std::vector< SDMDataSubset > & sdmDataSubsets() const
Return all the SDMDataSubsets contained in this.
int64_t ACTUALTIMESTYPE
Type of actual times.
AutoDataBinaryPart()
An empty constructor.
bool valid_
Is the SDMDataObject actually properly filled with valid data.
A subclass of binaryPart to describe the autodata.
unsigned int scanNum() const
Returns the number of the scan.
std::vector< Baseband > basebands_
void tpBinAttachToXML(std::ostringstream &oss)
~ZeroLagsBinaryPart()
The destructor.
unsigned int numAntenna() const
Returns the number of antenna.
std::string projectPath() const
Returns the project path.
SpectralWindow()
An empty constructor.
SDMDataObject::SpectralWindow:: declarations.
const BinaryPart & actualDurations() const
void actualTimes(const BinaryPart& value);
const std::vector< AtmPhaseCorrectionMod::AtmPhaseCorrection > & apc() const
Returns the radiometric atmospheric phase correction codes.
void append(const SDMDataSubset &value)
int32_t INTCROSSDATATYPE
Type of cross data when those are encoded as 32bits unsigned integers.
A subclass of binaryPart to describe the zeroLags.
std::vector< AtmPhaseCorrectionMod::AtmPhaseCorrection > apc_
const BinaryPart & flags() const
void basebands(const vector<Baseband>& value);
OptionalSpectralResolutionType spectralResolutionType_
SDMDataSubset(SDMDataObject *owner=0)
const ByteOrder * byteOrder() const
Returns the byte order of the binary parts.
unsigned long int zeroLags(const ZEROLAGSTYPE *&ptr) const
Set ptr to the adress of the array of ZeroLags and returns the number of ZeroLags.
bool present() const
Test of presence.
static std::string toString(Enum l)
const std::string & strImage() const
A class to represent an exception thrown during an access to an SDMDataObject.
void binAttachToXML(const std::string &name, std::ostringstream &oss)
Enum literal() const
Returns the optional value.
uint64_t crossDataPosition() const
Returns the position (0-based, relative to the beginning of the file) of this part when it has been r...
unsigned int dimensionality() const
Dimensionality of the binary content.
std::string toString(unsigned int N=10) const
Returns a description of this SDMDataSubset.
bool aborted() const
Returns true if the observation has been aborted.
uint64_t actualDurationsPosition_
SDMDataSubset & operator=(const SDMDataSubset &sdmDataSubset)
static std::string quote(const std::string &s)
std::string execBlockUID_
unsigned long int nCrossData_
static const ByteOrder * Machine_Endianity
unsigned long int nActualTimes_
std::string toXML()
Returns an XML representation of the global header of this SDMDataObject.
void owner(const SDMDataObject *o)
static const boost::regex SPWID
unsigned long int actualTimes(const ACTUALTIMESTYPE *&ptr) const
Set ptr to the adress of the array of ActualTimes and returns the number of ActualTimes.
std::string actualTimesREF_
uint32_t FLAGSTYPE
Type of flags.
PrimitiveDataTypeMod::PrimitiveDataType crossDataType_
unsigned int execBlockNum_
std::string execBlockUID() const
Returns the UID of the ExecBlock.
virtual CorrelatorTypeMod::CorrelatorType correlatorType() const
Returns the correlator type.
A class to represent byte order information.
const ZEROLAGSTYPE * zeroLags_
unsigned int dimensionality_
static void cXML(const std::string &elementName, std::ostringstream &oss)
const std::vector< StokesParameterMod::StokesParameter > & sdPolProducts() const
void crossPolProducts(const vector<StokesParameter>& value);
const SDMDataSubset & tpDataSubset() const
Returns the binary data for a subscan.
virtual ~SDMDataObjectException()
The destructor.
const SDMDataObject * owner_
std::string toString() const
Returns a string representation of the global header of this SDMDataObject.
static std::vector< std::string > axes
ByteOrder(const std::string &name)
const SHORTCROSSDATATYPE * shortCrossData_
ProcessorTypeMod::ProcessorType processorType_
std::vector< AxisNameMod::AxisName > axes_
uint64_t actualDurationsPosition() const
Returns the position (0-based, relative to the beginning of the file) of this part when it has been r...
void owner(const SDMDataObject *o)
bool isWVR() const
Returns true if the data are wvr data and false otherwise.
std::string crossDataREF_
bool aborted() const
Returns true if and only if this corresponds to an aborted [sub]integration.
unsigned int numSpectralPoint() const
void scaleFactor(float value);
ZeroLagsBinaryPart zeroLags_
PrimitiveDataTypeMod::PrimitiveDataType crossDataType() const
Return the type of cross data values.
BasebandNameMod::BasebandName name() const
Returns the name of the baseband.
void dataStructToXML(std::ostringstream &oss)
const SDMDataSubset & sdmDataSubset(const std::string &projectPath) const
Returns a reference to a SDMDataSubset given its projectPath.
std::string dataOID() const
Returns the dataOID.
void divorceSPW(unsigned int ibb, unsigned int ispw)
bool isCorrelation() const
Returns true if the data are correlator data and false otherwise.
uint64_t actualTimesPosition_
A class to read a MIME message containing ALMA binary data and provide a view on these binary data th...
NetSidebandMod::NetSideband sideband() const
void numBin(unsigned int value);
unsigned int execBlockNum() const
Returns the number of the ExecBlock.
const AutoDataBinaryPart & autoData() const
void crossData(const BinaryPart& value);
void imageOfSPW(unsigned int ibb, unsigned int ispw1, unsigned int ispw2)
Defines an association "spw1 is image of spw2" between two spectral windows spw1 and spw2...
void imageSPW(unsigned int ibb, unsigned int ispw1, unsigned int ispw2)
void autoData(const BinaryPart& value);
TableExprNode regex(const TableExprNode &node)
Functions for regular expression matching and pattern matching.
const FLOATCROSSDATATYPE * floatCrossData_
void owner(const SDMDataObject *o)
const int SCHEMAVERSION
The XML schema version of the XML instances that those classes claim to be compatible with...
std::map< std::string, std::string > imageSPW_
const ACTUALDURATIONSTYPE * actualDurations_
std::string abortReason() const
Returns the reason, as a string, why the observation has been aborted.
float ZEROLAGSTYPE
Type of zero lags.
virtual ~BinaryPart()
The destructor.
bool hasPackedData() const
hasPackedData returns true if all the integrations are grouped in one subset for all the timestamps a...
static std::vector< std::string > correlationModeRefs
const BinaryPart & actualTimes() const
void flags(const BinaryPart& value);
CorrelationModeMod::CorrelationMode correlationMode() const
Returns the correlation mode.
unsigned long long int abortTime_
BinaryPart()
An empty constructor.
std::vector< std::string > projectPaths() const
Returns the projects paths of all the data subsets present in this SDMDataObject. ...
static std::vector< Enum > enumvec(const std::string &strliterals)
A generic utility to return a vector of <Enum> out of a string of <Enum> literals separated by space ...
SDMDataObjectException()
An empty contructor.
const SDMDataObject * owner() const
BasebandNameMod::BasebandName name_
std::map< std::string, std::string > imageOfSPW_
CorrelationModeMod::CorrelationMode ref_
SDMDataObject::BinaryPart:: declarations.
const DataStruct & dataStruct() const
Returns the structure of the data.
unsigned long int actualDurations(const ACTUALDURATIONSTYPE *&ptr) const
Set ptr to the adress of the array of ActualDurations and returns the number of actualDurations.
bool inTitle(const std::string &what) const
Returns true is the string passed as an argument is found in the title of this.
uint64_t crossDataPosition_
std::vector< SDMDataSubset > dataSubsets_
uint64_t autoDataPosition_
DataStruct()
An empty constructor.
static std::vector< std::string > types
const BinaryPart & crossData() const
void zeroLags(const BinaryPart& value);
void owns()
Declares itself as the owner of all its parts.
const std::vector< Baseband > & basebands() const
void apc(const vector<AtmPhaseCorrectionMod::AtmPhaseCorrection>& value);
uint64_t zeroLagsPosition() const
Returns the position (0-based, relative to the beginning of the file) of this part when it has been r...
CorrelatorTypeMod::CorrelatorType correlatorType() const
Returns the correlator type.
virtual const std::vector< AxisNameMod::AxisName > & axes() const
virtual void size (unsigned int value);
uint64_t flagsPosition() const
Returns the position (0-based, relative to the beginning of the file) of this part when it has been r...
virtual ~SpectralWindow()
The destructor.
unsigned long int crossData(const SHORTCROSSDATATYPE *&ptr) const
Set ptr to the adress of the array of short int CrossData and returns the number of short int CrossDa...
const INTCROSSDATATYPE * longCrossData_
const SDMDataObject * owner_
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
unsigned long long startTime() const
Returns the start time.
std::string title_
Global header variables.
SDMDataObject::DataStruct:: declarations.
virtual bool normalized() const
Returns true (resp.false) if auto data are normalized (resp.
const SDMDataObject * owner_
ProcessorTypeMod::ProcessorType processorType() const
Returns the processor type.
virtual ~DataStruct()
The destructor.
int64_t ACTUALDURATIONSTYPE
Type of actual durations.
const SDMDataObject * owner_
static void toXML(const std::string &elementName, int value, std::ostringstream &oss)
unsigned long int nActualDurations_
~AutoDataBinaryPart()
The destructor.