casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
asdm::SourceTable Class Reference

The SourceTable class is an Alma table. More...

#include <SourceTable.h>

Inheritance diagram for asdm::SourceTable:
asdm::Representable

Public Member Functions

virtual ~SourceTable ()
 
ASDMgetContainer () const
 Return the container to which this table belongs. More...
 
unsigned int size () const
 Return the number of rows in the table. More...
 
std::string getName () const
 Return the name of this table. More...
 
std::string getVersion () const
 Return the version information about this table. More...
 
Entity getEntity () const
 Return this table's Entity. More...
 
void setEntity (Entity e)
 Set this table's Entity. More...
 
std::string toXML ()
 Produces an XML representation conform to the schema defined for Source (SourceTable.xsd). More...
 
asdmIDL::SourceTableIDL * toIDL ()
 Conversion Methods. More...
 
void toIDL (asdmIDL::SourceTableIDL &x) const
 Fills the CORBA data structure passed in parameter with the content of this table. More...
 
void fromIDL (asdmIDL::SourceTableIDL x)
 Populate this table from the content of a SourceTableIDL Corba structure. More...
 
SourceRownewRow ()
 ====> Row creation. More...
 
SourceRownewRow (ArrayTimeInterval timeInterval, Tag spectralWindowId, std::string code, std::vector< Angle > direction, std::vector< AngularRate > properMotion, std::string sourceName)
 Create a new row initialized to the specified values. More...
 
SourceRownewRow (SourceRow *row)
 Create a new row using a copy constructor mechanism. More...
 
SourceRowadd (SourceRow *x)
 ====> Append a row to its table. More...
 
std::vector< SourceRow * > get ()
 ====> Methods returning rows. More...
 
const std::vector< SourceRow * > & get () const
 Get a const reference on the collection of rows pointers internally hold by the table. More...
 
SourceRowgetRowByKey (int sourceId, ArrayTimeInterval timeInterval, Tag spectralWindowId)
 Returns a SourceRow* given a key. More...
 
std::vector< SourceRow * > getRowBySourceId (int)
 Returns a vector of pointers on rows whose key element sourceId is equal to the parameter sourceId. More...
 
SourceRowlookup (ArrayTimeInterval timeInterval, Tag spectralWindowId, std::string code, std::vector< Angle > direction, std::vector< AngularRate > properMotion, std::string sourceName)
 Look up the table for a row whose all attributes except the autoincrementable one are equal to the corresponding parameters of the method. More...
 
void setUnknownAttributeBinaryReader (const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
 
BinaryAttributeReaderFunctorgetUnknownAttributeBinaryReader (const std::string &attributeName) const
 
- Public Member Functions inherited from asdm::Representable
virtual ~Representable ()
 

Static Public Member Functions

static const std::vector
< std::string > & 
getKeyName ()
 Return the list of field names that make up key key as an array of strings. More...
 
static std::string name ()
 Return the name of this table. More...
 
static const std::vector
< std::string > & 
getAttributesNames ()
 Return the names of the attributes of this table. More...
 
static const std::vector
< std::string > & 
defaultAttributesNamesInBin ()
 Return the default sorted list of attributes names in the binary representation of the table. More...
 

Private Types

typedef std::vector
< std::vector< SourceRow * > > 
ID_TIME_ROWS
 

Private Member Functions

 SourceTable (ASDM &container)
 Create a SourceTable. More...
 
SourceRowcheckAndAdd (SourceRow *x, bool skipCheckUniqueness=false)
 If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and throw exception if not. More...
 
void append (SourceRow *x)
 Brutally append an SourceRow x to the collection of rows already stored in this table. More...
 
void addWithoutCheckingUnique (SourceRow *x)
 Brutally append an SourceRow x to the collection of rows already stored in this table. More...
 
SourceRowinsertByStartTime (SourceRow *x, std::vector< SourceRow * > &row)
 Insert a SourceRow* in a vector of SourceRow* so that it's ordered by ascending time. More...
 
std::string Key (Tag spectralWindowId)
 Returns a string built by concatenating the ascii representation of the parameters values suffixed with a "_" character. More...
 
void getByKeyNoAutoIncNoTime (std::vector< SourceRow * > &vin, std::vector< SourceRow * > &vout, Tag spectralWindowId)
 Fills the vector vout (passed by reference) with pointers on elements of vin whose attributes are equal to the corresponding parameters of the method. More...
 
void error ()
 
void fromXML (std::string &xmlDoc)
 Populate this table from the content of a XML document that is required to be conform to the XML schema defined for a Source (SourceTable.xsd). More...
 
void setFromMIMEFile (const std::string &directory)
 Private methods involved during the build of this table out of the content of file(s) containing an external representation of a Source table. More...
 
void setFromXMLFile (const std::string &directory)
 
std::string toMIME (const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
 Serialize this into a stream of bytes and encapsulates that stream into a MIME message. More...
 
void setFromMIME (const std::string &mimeMsg)
 Extracts the binary part of a MIME message and deserialize its content to fill this with the result of the deserialization. More...
 
std::string MIMEXMLPart (const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
 Private methods involved during the export of this table into disk file(s). More...
 
void toFile (std::string directory)
 Stores a representation (binary or XML) of this table into a file. More...
 
void checkPresenceInMemory ()
 
void setFromFile (const std::string &directory)
 Reads and parses a file containing a representation of a SourceTable as those produced by the toFile method. More...
 

Private Attributes

ASDMcontainer
 
bool archiveAsBin
 
bool fileAsBin
 
std::string version
 
Entity entity
 
std::map< const std::string, int > name2id_m
 
std::vector< SourceRow * > privateRows
 A data structure to store the pointers on the table's rows. More...
 
std::map< std::string,
ID_TIME_ROWS
context
 
std::map< std::string,
BinaryAttributeReaderFunctor * > 
unknownAttributes2Functors
 
bool loadInProgress
 Load the table in memory if necessary. More...
 

Friends

class ASDM
 

Additional Inherited Members

- Protected Attributes inherited from asdm::Representable
bool presentInMemory
 
bool loadInProgress
 
uint32_t declaredSize
 

Detailed Description

The SourceTable class is an Alma table.


Role
Summary of astromomical source information.

Generated from model's revision "-1", branch ""

Attributes of Source
Name Type Expected shape

Comment

Key

sourceId

int  

 identifies a collection of rows in the table.

timeInterval

ArrayTimeInterval  

  the time interval of validity of the row's content.

spectralWindowId

Tag  

 refers to a unique row in SpectralWindowTable.

Value
(Mandatory)

code std::string  

 indicates the nature of the source.

direction std::vector<Angle > 2

 the direction of the source.

properMotion std::vector<AngularRate > 2

 the proper motion of the source.

sourceName std::string  

 the name of the source.

Value
(Optional)

directionCode DirectionReferenceCodeMod::DirectionReferenceCode  

  identifies the direction reference frame associated to direction.

directionEquinox ArrayTime  

  the equinox associated to the direction reference frame (if required).

calibrationGroup int  

  the calibration group number.

catalog std::string  

  the name of the catalog.

deltaVel Speed  

  the velocity resolution.

position std::vector<Length > 3

  the position of the source.

numLines(numLines) int  

  the number of line transitions.

transition std::vector<std::string > numLines

  the names of the transitions.

restFrequency std::vector<Frequency > numLines

  the rest frequencies (one value per transition line).

sysVel std::vector<Speed > numLines

  the systemic velocity.

rangeVel std::vector<Speed > 2

  the velocity range.

sourceModel SourceModelMod::SourceModel  

  identifies the source model.

frequencyRefCode FrequencyReferenceCodeMod::FrequencyReferenceCode  

  the frequency reference code.

numFreq(numFreq) int  

  the number of frequencies.

numStokes(numStokes) int  

  the number of Stokes parameters.

frequency std::vector<Frequency > numFreq

  the array of frequencies (one value per frequency).

frequencyInterval std::vector<Frequency > numFreq

  an array of frequency intervals (one value per interval).

stokesParameter std::vector<StokesParameterMod::StokesParameter > numStokes

  the array of Stokes parameters (one value per parameter).

flux std::vector<std::vector<Flux > > numFreq, numStokes

  the array of flux densities expressed in Jansky (Jy).

fluxErr std::vector<std::vector<Flux > > numFreq, numStokes

  the array of uncertainties on flux densities.

positionAngle std::vector<Angle > numFreq

  the major axis position angles (one value per frequency).

positionAngleErr std::vector<Angle > numFreq

  the uncertainties on major axis position angles.

size std::vector<std::vector<Angle > > numFreq, 2

  the sizes of source (one pair of values per frequency).

sizeErr std::vector<std::vector<Angle > > numFreq, 2

  the uncertainties on the source sizes (one pair of value per frequency).

velRefCode RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode  

  the velocity reference code for velocities: sysVel, rangeVel, deltaVel.

dopplerVelocity std::vector<Speed > numLines

  the systemic velocity.

dopplerReferenceSystem RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode  

  the velocity reference code for velocities: sysVel, rangeVel, deltaVel.

dopplerCalcType DopplerReferenceCodeMod::DopplerReferenceCode  

  the velocity reference code for velocities: sysVel, rangeVel, deltaVel.

parallax std::vector<Angle > numFreq

  the sizes of source (one pair of values per frequency).

Definition at line 475 of file SourceTable.h.

Member Typedef Documentation

typedef std::vector<std::vector <SourceRow* > > asdm::SourceTable::ID_TIME_ROWS
private

Definition at line 821 of file SourceTable.h.

Constructor & Destructor Documentation

virtual asdm::SourceTable::~SourceTable ( )
virtual
asdm::SourceTable::SourceTable ( ASDM container)
private

Create a SourceTable.

This constructor is private because only the container can create tables. All tables must know the container to which they belong.

Parameters
containerThe container to which this table belongs.

Member Function Documentation

SourceRow* asdm::SourceTable::add ( SourceRow x)

====> Append a row to its table.

Add a row. If there table contains a row whose key's fields except² sourceId are equal to x's ones then return a pointer on this row (i.e. no actual insertion is performed) otherwise add x to the table and return x.

Parameters
x. A pointer on the row to be added.
Returns
a pointer to a SourceRow.
void asdm::SourceTable::addWithoutCheckingUnique ( SourceRow x)
private

Brutally append an SourceRow x to the collection of rows already stored in this table.

No uniqueness check is done !

Parameters
SourceRow*x a pointer onto the SourceRow to be appended.
void asdm::SourceTable::append ( SourceRow x)
private

Brutally append an SourceRow x to the collection of rows already stored in this table.

No uniqueness check is done !

Parameters
SourceRow*x a pointer onto the SourceRow to be appended.
SourceRow* asdm::SourceTable::checkAndAdd ( SourceRow x,
bool  skipCheckUniqueness = false 
)
private

If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and throw exception if not.

Check if *x verifies the key uniqueness rule and throw an exception if not. Append x to its table.

Exceptions
DuplicateKey
UniquenessViolationException
void asdm::SourceTable::checkPresenceInMemory ( )
inlineprivate
static const std::vector<std::string>& asdm::SourceTable::defaultAttributesNamesInBin ( )
static

Return the default sorted list of attributes names in the binary representation of the table.

Returns
a const reference to a vector of string
void asdm::SourceTable::error ( )
private
void asdm::SourceTable::fromIDL ( asdmIDL::SourceTableIDL  x)

Populate this table from the content of a SourceTableIDL Corba structure.

Exceptions
DuplicateKeyThrown if the method tries to add a row having a key that is already in the table.
ConversionException
void asdm::SourceTable::fromXML ( std::string &  xmlDoc)
privatevirtual

Populate this table from the content of a XML document that is required to be conform to the XML schema defined for a Source (SourceTable.xsd).

Exceptions
ConversionException

Implements asdm::Representable.

std::vector<SourceRow *> asdm::SourceTable::get ( )

====> Methods returning rows.

Get a collection of pointers on the rows of the table.

Returns
Alls rows in a vector of pointers of SourceRow. The elements of this vector are stored in the order in which they have been added to the SourceTable.
const std::vector<SourceRow *>& asdm::SourceTable::get ( ) const

Get a const reference on the collection of rows pointers internally hold by the table.

Returns
A const reference of a vector of pointers of SourceRow. The elements of this vector are stored in the order in which they have been added to the SourceTable.
static const std::vector<std::string>& asdm::SourceTable::getAttributesNames ( )
static

Return the names of the attributes of this table.

Returns
a vector of string
void asdm::SourceTable::getByKeyNoAutoIncNoTime ( std::vector< SourceRow * > &  vin,
std::vector< SourceRow * > &  vout,
Tag  spectralWindowId 
)
private

Fills the vector vout (passed by reference) with pointers on elements of vin whose attributes are equal to the corresponding parameters of the method.

ASDM& asdm::SourceTable::getContainer ( ) const

Return the container to which this table belongs.

Returns
the ASDM containing this table.

Referenced by checkPresenceInMemory().

Entity asdm::SourceTable::getEntity ( ) const
virtual

Return this table's Entity.

Implements asdm::Representable.

static const std::vector<std::string>& asdm::SourceTable::getKeyName ( )
static

Return the list of field names that make up key key as an array of strings.

Returns
a vector of string.
std::string asdm::SourceTable::getName ( ) const
virtual

Return the name of this table.

This is a instance method of the class.

Returns
the name of this table in a string.

Implements asdm::Representable.

SourceRow* asdm::SourceTable::getRowByKey ( int  sourceId,
ArrayTimeInterval  timeInterval,
Tag  spectralWindowId 
)

Returns a SourceRow* given a key.

Returns
a pointer to the row having the key whose values are passed as parameters, or 0 if no row exists for that key.
Parameters
sourceId
timeInterval
spectralWindowId
std::vector<SourceRow *> asdm::SourceTable::getRowBySourceId ( int  )

Returns a vector of pointers on rows whose key element sourceId is equal to the parameter sourceId.

Returns
a vector of vector <SourceRow *>. A returned vector of size 0 means that no row has been found.
Parameters
sourceIdint contains the value of the autoincrementable attribute that is looked up in the table.
BinaryAttributeReaderFunctor* asdm::SourceTable::getUnknownAttributeBinaryReader ( const std::string &  attributeName) const
std::string asdm::SourceTable::getVersion ( ) const

Return the version information about this table.

SourceRow* asdm::SourceTable::insertByStartTime ( SourceRow x,
std::vector< SourceRow * > &  row 
)
private

Insert a SourceRow* in a vector of SourceRow* so that it's ordered by ascending time.

Parameters
SourceRow*x . The pointer to be inserted.
vector<SourceRow*>& row . A reference to the vector where to insert x.
std::string asdm::SourceTable::Key ( Tag  spectralWindowId)
private

Returns a string built by concatenating the ascii representation of the parameters values suffixed with a "_" character.

SourceRow* asdm::SourceTable::lookup ( ArrayTimeInterval  timeInterval,
Tag  spectralWindowId,
std::string  code,
std::vector< Angle direction,
std::vector< AngularRate properMotion,
std::string  sourceName 
)

Look up the table for a row whose all attributes except the autoincrementable one are equal to the corresponding parameters of the method.

Returns
a pointer on this row if any, null otherwise.
Parameters
timeInterval
spectralWindowId
code
direction
properMotion
sourceName
std::string asdm::SourceTable::MIMEXMLPart ( const asdm::ByteOrder byteOrder = asdm::ByteOrder::Machine_Endianity)
private

Private methods involved during the export of this table into disk file(s).

static std::string asdm::SourceTable::name ( )
static

Return the name of this table.

This is a static method of the class.

Returns
the name of this table in a string.
SourceRow* asdm::SourceTable::newRow ( )

====> Row creation.

Create a new row with default values.

Returns
a pointer on a SourceRow
SourceRow* asdm::SourceTable::newRow ( ArrayTimeInterval  timeInterval,
Tag  spectralWindowId,
std::string  code,
std::vector< Angle direction,
std::vector< AngularRate properMotion,
std::string  sourceName 
)

Create a new row initialized to the specified values.

Returns
a pointer on the created and initialized row.
Parameters
timeInterval
spectralWindowId
code
direction
properMotion
sourceName
SourceRow* asdm::SourceTable::newRow ( SourceRow row)

Create a new row using a copy constructor mechanism.

The method creates a new SourceRow owned by this. Each attribute of the created row is a (deep) copy of the corresponding attribute of row. The method does not add the created row to this, its simply parents it to this, a call to the add method has to be done in order to get the row added (very likely after having modified some of its attributes). If row is null then the method returns a new SourceRow with default values for its attributes.

Parameters
rowthe row which is to be copied.
void asdm::SourceTable::setEntity ( Entity  e)
virtual

Set this table's Entity.

Parameters
eAn entity.

Implements asdm::Representable.

void asdm::SourceTable::setFromFile ( const std::string &  directory)
private

Reads and parses a file containing a representation of a SourceTable as those produced by the toFile method.

This table is populated with the result of the parsing.

Parameters
directoryThe name of the directory containing the file te be read and parsed.
Exceptions
ConversionExceptionIf any error occurs while reading the files in the directory or parsing them.

Referenced by checkPresenceInMemory().

void asdm::SourceTable::setFromMIME ( const std::string &  mimeMsg)
private

Extracts the binary part of a MIME message and deserialize its content to fill this with the result of the deserialization.

Parameters
mimeMsgthe string containing the MIME message.
Exceptions
ConversionException
void asdm::SourceTable::setFromMIMEFile ( const std::string &  directory)
private

Private methods involved during the build of this table out of the content of file(s) containing an external representation of a Source table.

void asdm::SourceTable::setFromXMLFile ( const std::string &  directory)
private
void asdm::SourceTable::setUnknownAttributeBinaryReader ( const std::string &  attributeName,
BinaryAttributeReaderFunctor barFctr 
)
unsigned int asdm::SourceTable::size ( ) const
virtual

Return the number of rows in the table.

Returns
the number of rows in an unsigned int.

Implements asdm::Representable.

void asdm::SourceTable::toFile ( std::string  directory)
private

Stores a representation (binary or XML) of this table into a file.

Depending on the boolean value of its private field fileAsBin a binary serialization of this (fileAsBin==true) will be saved in a file "Source.bin" or an XML representation (fileAsBin==false) will be saved in a file "Source.xml". The file is always written in a directory whose name is passed as a parameter.

Parameters
directoryThe name of directory where the file containing the table's representation will be saved.
asdmIDL::SourceTableIDL* asdm::SourceTable::toIDL ( )

Conversion Methods.

Convert this table into a SourceTableIDL CORBA structure.

Returns
a pointer to a SourceTableIDL
void asdm::SourceTable::toIDL ( asdmIDL::SourceTableIDL &  x) const

Fills the CORBA data structure passed in parameter with the content of this table.

Parameters
xa reference to the asdmIDL::SourceTableIDL to be populated with the content of this.
std::string asdm::SourceTable::toMIME ( const asdm::ByteOrder byteOrder = asdm::ByteOrder::Machine_Endianity)
private

Serialize this into a stream of bytes and encapsulates that stream into a MIME message.

Returns
a string containing the MIME message.
Parameters
byteOrdera const pointer to a static instance of the class ByteOrder.
std::string asdm::SourceTable::toXML ( )
virtual

Produces an XML representation conform to the schema defined for Source (SourceTable.xsd).

Returns
a string containing the XML representation.
Exceptions
ConversionException

Implements asdm::Representable.

Friends And Related Function Documentation

friend class ASDM
friend

Definition at line 476 of file SourceTable.h.

Member Data Documentation

bool asdm::SourceTable::archiveAsBin
private

Definition at line 750 of file SourceTable.h.

ASDM& asdm::SourceTable::container
private

Definition at line 748 of file SourceTable.h.

std::map<std::string, ID_TIME_ROWS > asdm::SourceTable::context
private

Definition at line 822 of file SourceTable.h.

Entity asdm::SourceTable::entity
private

Definition at line 755 of file SourceTable.h.

bool asdm::SourceTable::fileAsBin
private

Definition at line 751 of file SourceTable.h.

bool asdm::SourceTable::loadInProgress
private

Load the table in memory if necessary.

Definition at line 902 of file SourceTable.h.

Referenced by checkPresenceInMemory().

std::map<const std::string, int> asdm::SourceTable::name2id_m
private

Definition at line 763 of file SourceTable.h.

std::vector<SourceRow * > asdm::SourceTable::privateRows
private

A data structure to store the pointers on the table's rows.

In all cases we maintain a private vector of SourceRow s.

Definition at line 812 of file SourceTable.h.

std::map<std::string, BinaryAttributeReaderFunctor *> asdm::SourceTable::unknownAttributes2Functors
private

Definition at line 853 of file SourceTable.h.

std::string asdm::SourceTable::version
private

Definition at line 753 of file SourceTable.h.


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