DP3
Public Member Functions | List of all members
dp3::parmdb::SourceDB Class Referencefinal

Envelope class for a table holding source parameters. More...

#include <SourceDB.h>

Inheritance diagram for dp3::parmdb::SourceDB:
dp3::parmdb::SourceDBBase

Public Member Functions

 SourceDB (const ParmDBMeta &ptm, bool mustExist, bool forceNew)
 
 SourceDB (const SourceDB &)
 Copy contructor has reference semantics. More...
 
 ~SourceDB () override
 Delete underlying object if no more references to it. More...
 
unsigned int addPatch (const std::string &patchName, int catType, double apparentBrightness, double ra, double dec, bool check) override
 
void addSource (const SourceInfo &sourceInfo, const std::string &patchName, int catType, double apparentBrightness, const ParmMap &defaultParameters, double ra, double dec, bool check) override
 Add a source which forms a patch in itself (with the same name). More...
 
bool atEnd ()
 Tell if we are the end of the file. More...
 
void checkDuplicates () const
 
void clearTables ()
 Clear database tables (i.e. remove all rows from all tables). More...
 
void deleteSources (const std::string &sourceNamePattern)
 Delete the sources records matching the given (filename like) pattern. More...
 
std::vector< std::string > findDuplicatePatches () const
 Find non-unique patch names. More...
 
std::vector< std::string > findDuplicateSources () const
 Find non-unique source names. More...
 
void getNextSource (SourceData &src)
 
ParmDBgetParmDB ()
 Get the associated ParmDB. More...
 
const ParmDBMetagetParmDBMeta () const
 Get the name and type of the SourceDB. More...
 
std::vector< std::string > getPatches (int category=-1, const std::string &pattern=std::string(), double minBrightness=-1, double maxBrightness=-1) const
 
std::vector< PatchInfogetPatchInfo (int category=-1, const std::string &pattern=std::string(), double minBrightness=-1, double maxBrightness=-1) const
 Get the info of all patches (name, ra, dec). More...
 
std::vector< SourceDatagetPatchSourceData (const std::string &patchName) const
 Get all data of the sources belonging to the given patch. More...
 
std::vector< SourceInfogetPatchSources (const std::string &patchName) const
 Get the info of the sources belonging to the given patch. More...
 
SourceInfo getSource (const std::string &sourceName) const
 Get the source info of the given source. More...
 
std::vector< SourceInfogetSources (const std::string &sourceNamePattern) const
 Get the info of all sources matching the given (filename like) pattern. More...
 
SourceDBoperator= (const SourceDB &)
 Assignment has reference semantics. More...
 
bool patchExists (const std::string &patchName) const
 Test if the patch already exists. More...
 
void rewind ()
 Reset to the beginning of the file. More...
 
bool sourceExists (const std::string &sourceName) const
 Test if the source already exists. More...
 
void updatePatch (unsigned int patchId, double apparentBrightness, double ra, double dec) override
 Update the ra/dec and apparent brightness of a patch. More...
 
void lock (bool lockForWrite=true)
 
void unlock ()
 
void addSource (const SourceInfo &sourceInfo, const std::string &patchName, const ParmMap &defaultParameters, double ra, double dec, bool check) override
 
void addSource (const SourceData &source, bool check=true)
 
- Public Member Functions inherited from dp3::parmdb::SourceDBBase
virtual ~SourceDBBase ()=default
 
virtual void updatePatch (unsigned patch_id, double apparent_brightness, double ra, double dec)=0
 

Detailed Description

Envelope class for a table holding source parameters.

Constructor & Destructor Documentation

◆ SourceDB() [1/2]

dp3::parmdb::SourceDB::SourceDB ( const ParmDBMeta ptm,
bool  mustExist,
bool  forceNew 
)
explicit

Create the SourceDB object for the given database type. It gets added to the map of open sourceDBs.

Parameters
mustExistif true and the file does not exist, an exception will be thrown
forceNewif true, an empty file will be created even if the file exists.

◆ SourceDB() [2/2]

dp3::parmdb::SourceDB::SourceDB ( const SourceDB )

Copy contructor has reference semantics.

◆ ~SourceDB()

dp3::parmdb::SourceDB::~SourceDB ( )
override

Delete underlying object if no more references to it.

Member Function Documentation

◆ addPatch()

unsigned int dp3::parmdb::SourceDB::addPatch ( const std::string &  patchName,
int  catType,
double  apparentBrightness,
double  ra,
double  dec,
bool  check 
)
inlineoverridevirtual

Add a patch and return its patchId. Normally ra and dec should be filled in, but for moving patches (e.g. sun) this is not needed.
Optionally it is checked if the patch already exists.

Implements dp3::parmdb::SourceDBBase.

◆ addSource() [1/3]

void dp3::parmdb::SourceDB::addSource ( const SourceData source,
bool  check = true 
)
inline

◆ addSource() [2/3]

void dp3::parmdb::SourceDB::addSource ( const SourceInfo sourceInfo,
const std::string &  patchName,
const ParmMap defaultParameters,
double  ra,
double  dec,
bool  check 
)
inlineoverridevirtual

Add a source to a patch. Its ra and dec and default parameters will be stored as default values in the associated ParmDB tables. The names of the parameters will be succeeded by a colon and the source name. The map should contain the parameters belonging to the source type. Not all parameters need to be present. The ParmDB classes will use a default of 0 for missing ones.

Implements dp3::parmdb::SourceDBBase.

◆ addSource() [3/3]

void dp3::parmdb::SourceDB::addSource ( const SourceInfo sourceInfo,
const std::string &  patchName,
int  catType,
double  apparentBrightness,
const ParmMap defaultParameters,
double  ra,
double  dec,
bool  check 
)
inlineoverridevirtual

Add a source which forms a patch in itself (with the same name).

Implements dp3::parmdb::SourceDBBase.

◆ atEnd()

bool dp3::parmdb::SourceDB::atEnd ( )
inline

Tell if we are the end of the file.

◆ checkDuplicates()

void dp3::parmdb::SourceDB::checkDuplicates ( ) const
inline

Check for duplicate patches or sources. An exception is thrown if that is the case.

◆ clearTables()

void dp3::parmdb::SourceDB::clearTables ( )
inline

Clear database tables (i.e. remove all rows from all tables).

◆ deleteSources()

void dp3::parmdb::SourceDB::deleteSources ( const std::string &  sourceNamePattern)
inline

Delete the sources records matching the given (filename like) pattern.

◆ findDuplicatePatches()

std::vector<std::string> dp3::parmdb::SourceDB::findDuplicatePatches ( ) const
inline

Find non-unique patch names.

◆ findDuplicateSources()

std::vector<std::string> dp3::parmdb::SourceDB::findDuplicateSources ( ) const
inline

Find non-unique source names.

◆ getNextSource()

void dp3::parmdb::SourceDB::getNextSource ( SourceData src)
inline

Get the next source from the table. An exception is thrown if there are no more sources.

◆ getParmDB()

ParmDB& dp3::parmdb::SourceDB::getParmDB ( )
inline

Get the associated ParmDB.

◆ getParmDBMeta()

const ParmDBMeta& dp3::parmdb::SourceDB::getParmDBMeta ( ) const
inline

Get the name and type of the SourceDB.

◆ getPatches()

std::vector<std::string> dp3::parmdb::SourceDB::getPatches ( int  category = -1,
const std::string &  pattern = std::string(),
double  minBrightness = -1,
double  maxBrightness = -1 
) const
inline

Get patch names in order of category and decreasing apparent flux. category < 0 means all categories. A brightness < 0 means no test on brightness.

◆ getPatchInfo()

std::vector<PatchInfo> dp3::parmdb::SourceDB::getPatchInfo ( int  category = -1,
const std::string &  pattern = std::string(),
double  minBrightness = -1,
double  maxBrightness = -1 
) const
inline

Get the info of all patches (name, ra, dec).

◆ getPatchSourceData()

std::vector<SourceData> dp3::parmdb::SourceDB::getPatchSourceData ( const std::string &  patchName) const
inline

Get all data of the sources belonging to the given patch.

◆ getPatchSources()

std::vector<SourceInfo> dp3::parmdb::SourceDB::getPatchSources ( const std::string &  patchName) const
inline

Get the info of the sources belonging to the given patch.

◆ getSource()

SourceInfo dp3::parmdb::SourceDB::getSource ( const std::string &  sourceName) const
inline

Get the source info of the given source.

◆ getSources()

std::vector<SourceInfo> dp3::parmdb::SourceDB::getSources ( const std::string &  sourceNamePattern) const
inline

Get the info of all sources matching the given (filename like) pattern.

◆ lock()

void dp3::parmdb::SourceDB::lock ( bool  lockForWrite = true)
inline

Lock and unlock the database tables. The user does not need to lock/unlock, but it can increase performance if many small accesses have to be done.

◆ operator=()

SourceDB& dp3::parmdb::SourceDB::operator= ( const SourceDB )

Assignment has reference semantics.

◆ patchExists()

bool dp3::parmdb::SourceDB::patchExists ( const std::string &  patchName) const
inline

Test if the patch already exists.

◆ rewind()

void dp3::parmdb::SourceDB::rewind ( )
inline

Reset to the beginning of the file.

◆ sourceExists()

bool dp3::parmdb::SourceDB::sourceExists ( const std::string &  sourceName) const
inline

Test if the source already exists.

◆ unlock()

void dp3::parmdb::SourceDB::unlock ( )
inline

◆ updatePatch()

void dp3::parmdb::SourceDB::updatePatch ( unsigned int  patchId,
double  apparentBrightness,
double  ra,
double  dec 
)
inlineoverride

Update the ra/dec and apparent brightness of a patch.


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