Isis Developer Reference
Isis::KernelDb Class Reference

KernelDb class. More...

#include <KernelDb.h>

Collaboration diagram for Isis::KernelDb:
Collaboration graph

Public Member Functions

 KernelDb (const unsigned int allowedKernelTypes)
 Constructs a new KernelDb object with a given integer value representing the Kernel::Type enumerations that are allowed. More...
 
 KernelDb (const QString &dbName, const unsigned int allowedKernelTypes)
 Constructs a new KernelDb object with the given file name and integer value representing the Kernel::Type enumerations that are allowed. More...
 
 KernelDb (std::istream &dbStream, const unsigned int allowedKernelTypes)
 Constructs a new KernelDb object from the given stream and integer value representing the Kernel::Type enumerations that are allowed. More...
 
 ~KernelDb ()
 Destructs KernelDb object. More...
 
Kernel leapSecond (Pvl &lab)
 This method finds the top priority of all Leap Second kernels (lsk) identified by the database and the allowed kernel types. More...
 
Kernel targetAttitudeShape (Pvl &lab)
 This method finds the highest version of all Target Attitude Shape kernels (pck) identified by the database and the allowed kernel types. More...
 
Kernel targetPosition (Pvl &lab)
 This method finds the highest version of all Target Position kernels (tspk) identified by the database and the allowed kernel types. More...
 
QList< std::priority_queue< Kernel > > spacecraftPointing (Pvl &lab)
 This method finds a list of the highest versions of all Spacecraft Pointing kernels (ck) identified by the databases and the allowed Kernel types. More...
 
Kernel spacecraftClock (Pvl &lab)
 This method finds the highest version of all Spacecraft Clock kernels (sclk) identified by the database and the allowed kernel types. More...
 
Kernel spacecraftPosition (Pvl &lab)
 This method finds the highest version of all Spacecraft Position kernels (spk) identified by the database and the allowed kernel types. More...
 
Kernel instrument (Pvl &lab)
 This method finds the last Instrument kernel found that matches the (ik) criteria in the database and the allowed kernel types. More...
 
Kernel frame (Pvl &lab)
 This method finds the highest version of all Frame kernels (fk) identified by the database and the allowed kernel types. More...
 
Kernel instrumentAddendum (Pvl &lab)
 This method finds the highest version of all Instrument Addendum kernels (iak) identified by the database and the allowed kernel types. More...
 
Kernel dem (Pvl &lab)
 This method finds the highest version of all Digital Terrain Models (DEMs) found that match the criteria in the database. More...
 
Kernel findLast (const QString &entry, Pvl &lab)
 Finds the highest priority Kernel object for the given entry based on the allowed Kernel types. More...
 
QList< std::priority_queue< Kernel > > findAll (const QString &entry, Pvl &lab)
 Finds all of the Kernel objects for the given entry value based on the allowed Kernel types. More...
 
void loadSystemDb (const QString &mission, const Pvl &lab)
 Loads the appropriate kernel database files with the defined BASE and MISSION info for each type of kernel. More...
 
QList< FileNamekernelDbFiles ()
 Accessor method to retrieve the list of kernel database files that were read in when loadSystemDb() is called. More...
 

Static Public Member Functions

static bool matches (const Pvl &lab, PvlGroup &kernelDbGrp, iTime timeToMatch, int cameraVersion)
 This static method determines whether the given cube label matches the given criteria. More...
 

Detailed Description

KernelDb class.

This class handles kernel database files. Once the database files have been loaded into a Pvl, the highest version of each kernel can be found by calling methods with corresponding kernel names, as shown below.

KernelDb baseKernels(0);

baseKernels.loadSystemDb(mission, lab);

Kernel lk, pck, targetSpk, fk, ik, sclk, spk, iak, dem, exk; priority_queue< Kernel > ck; lk = baseKernels.leapSecond(lab); pck = baseKernels.targetAttitudeShape(lab); targetSpk = baseKernels.targetPosition(lab); ik = baseKernels.instrument(lab); sclk = baseKernels.spacecraftClock(lab); iak = baseKernels.instrumentAddendum(lab); fk = ckKernels.frame(lab); ck = ckKernels.spacecraftPointing(lab); spk = spkKernels.spacecraftPosition(lab);

Author
????-??-?? Unknown

Constructor & Destructor Documentation

◆ KernelDb() [1/3]

Isis::KernelDb::KernelDb ( const unsigned int  allowedKernelTypes)

Constructs a new KernelDb object with a given integer value representing the Kernel::Type enumerations that are allowed.

The filename is set to "None" if this constructor is used.

The allowed kernel types is stored as the sum of the enumerations of the allowed Kernel Types. The following enumeriations currently exist: 0001 = 1 = Predicted 0010 = 2 = Nadir 0100 = 4 = Reconstructed 1000 = 8 = Smithed

So, for example, if allowedKernelTypes is 11, then we can represent it as 1011. In this case, Predicted, Nadir, and Smithed kernels are allowed, but not Reconstructed.

Parameters
allowedKernelTypesInteger value representing Kernel::Type enumerations that are allowed.

◆ KernelDb() [2/3]

Isis::KernelDb::KernelDb ( const QString &  dbName,
const unsigned int  allowedKernelTypes 
)

Constructs a new KernelDb object with the given file name and integer value representing the Kernel::Type enumerations that are allowed.

The allowed kernel types is stored as the sum of the enumerations of the allowed Kernel Types. The following enumeriations currently exist: 0001 = 1 = Predicted 0010 = 2 = Nadir 0100 = 4 = Reconstructed 1000 = 8 = Smithed

So, for example, if allowedKernelTypes is 11, then we can represent it as 1011. In this case, Predicted, Nadir, and Smithed kernels are allowed, but not Reconstructed.

Parameters
dbNameString containing the name of the kernel database
allowedKernelTypesInteger value representing Kernel::Type enumerations that are allowed.
See also
KernelDb(int)

◆ KernelDb() [3/3]

Isis::KernelDb::KernelDb ( std::istream &  dbStream,
const unsigned int  allowedKernelTypes 
)

Constructs a new KernelDb object from the given stream and integer value representing the Kernel::Type enumerations that are allowed.

The filename is set to "internal stream" if this constructor is used.

The allowed kernel types is stored as the sum of the enumerations of the allowed Kernel Types. The following enumeriations currently exist: 0001 = 1 = Predicted 0010 = 2 = Nadir 0100 = 4 = Reconstructed 1000 = 8 = Smithed

So, for example, if allowedKernelTypes is 11, then we can represent it as 1011. In this case, Predicted, Nadir, and Smithed kernels are allowed, but not Reconstructed.

Parameters
dbStreamAn input stream containing kernel database Pvl objects
allowedKernelTypesInteger value representing Kernel::Type enumerations that are allowed.
See also
KernelDb(int)

◆ ~KernelDb()

Isis::KernelDb::~KernelDb ( )

Destructs KernelDb object.

Member Function Documentation

◆ dem()

Kernel Isis::KernelDb::dem ( Pvl lab)

This method finds the highest version of all Digital Terrain Models (DEMs) found that match the criteria in the database.

If no database file or stream was provided to the constructor, the loadSystemDb() method should be called prior to this accessor.

If no DEM is found, this method will return an empty Kernel object.

Parameters
labPvl label containing an IsisCube with needed times and IDs.
Returns
Kernel Highest version of all DEMs

References findLast().

◆ findAll()

QList< std::priority_queue< Kernel > > Isis::KernelDb::findAll ( const QString &  entry,
Pvl lab 
)

Finds all of the Kernel objects for the given entry value based on the allowed Kernel types.

This method returns a list of priority queues. Each priority queue corresponds to a kernel db file object of the same name as the entry in the kernelData pvl.

Parameters
entryThe name of the kernel, dem, or entry that will be searched for
labThe Pvl label containing an IsisCube object with times and instrument ID.
Returns
QList< priority_queue<Kernel> > List of queues of Kernel objects for the given entry

References Isis::CameraFactory::CameraVersion(), Isis::PvlObject::findGroup(), Isis::PvlObject::findObject(), Isis::PvlObject::group(), Isis::PvlObject::groups(), Isis::PvlObject::hasGroup(), Isis::PvlContainer::hasKeyword(), Isis::PvlObject::hasObject(), Isis::PvlContainer::isNamed(), Isis::PvlKeyword::isNamed(), Isis::PvlContainer::keywords(), matches(), Isis::PvlObject::object(), Isis::PvlObject::objects(), and Isis::Kernel::typeEnum().

Referenced by findLast(), and spacecraftPointing().

◆ findLast()

Kernel Isis::KernelDb::findLast ( const QString &  entry,
Pvl lab 
)

Finds the highest priority Kernel object for the given entry based on the allowed Kernel types.

This method calls findAll() to get a list of priority queues. The top priority of the first queue is returned, if it exists. If not, an empty Kernel object is returned.

Parameters
entryThe name of the kernel, dem, or other entry that will be searched for
labThe label containing the IsisCube object with times and instrument ID.
Returns
Kernel Highest version of the given kernel or DEM entry

References findAll().

Referenced by dem(), frame(), instrument(), instrumentAddendum(), leapSecond(), spacecraftClock(), spacecraftPosition(), targetAttitudeShape(), and targetPosition().

◆ frame()

Kernel Isis::KernelDb::frame ( Pvl lab)

This method finds the highest version of all Frame kernels (fk) identified by the database and the allowed kernel types.

If no database file or stream was provided to the constructor, the loadSystemDb() method should be called prior to this accessor.

If no FK is found, this method will return an empty Kernel object.

Parameters
labPvl label containing an IsisCube with needed times and IDs.
Returns
Kernel Highest version of all frame kernels

References findLast().

◆ instrument()

Kernel Isis::KernelDb::instrument ( Pvl lab)

This method finds the last Instrument kernel found that matches the (ik) criteria in the database and the allowed kernel types.

If no database file or stream was provided to the constructor, the loadSystemDb() method should be called prior to this accessor.

If no IK is found, this method will return an empty Kernel object.

Parameters
labPvl label containing an IsisCube with needed times and IDs.
Returns
Kernel Highest version of all instrument kernels

References findLast().

◆ instrumentAddendum()

Kernel Isis::KernelDb::instrumentAddendum ( Pvl lab)

This method finds the highest version of all Instrument Addendum kernels (iak) identified by the database and the allowed kernel types.

If no database file or stream was provided to the constructor, the loadSystemDb() method should be called prior to this accessor.

If no IAK is found, this method will return an empty Kernel object.

Parameters
labPvl label containing an IsisCube with needed times and IDs.
Returns
Kernel Highest version of all instrument addendum kernels

References findLast().

◆ kernelDbFiles()

QList< FileName > Isis::KernelDb::kernelDbFiles ( )

Accessor method to retrieve the list of kernel database files that were read in when loadSystemDb() is called.

Returns
QList<FileName> A list containing the kernel database file names

◆ leapSecond()

Kernel Isis::KernelDb::leapSecond ( Pvl lab)

This method finds the top priority of all Leap Second kernels (lsk) identified by the database and the allowed kernel types.

If no database file or stream was provided to the constructor, the loadSystemDb() method should be called prior to this accessor.

If no LSK is found, this method will return an empty Kernel object.

Parameters
labPvl label containing an IsisCube with needed times and IDs.
Returns
Kernel Highest version of all leap second kernels

References findLast().

◆ loadSystemDb()

void Isis::KernelDb::loadSystemDb ( const QString &  mission,
const Pvl lab 
)

Loads the appropriate kernel database files with the defined BASE and MISSION info for each type of kernel.

This method always gets the following from the mission directory:

  • ck
  • fk
  • ik
  • sclk
  • spk
  • iak

For the following, this method looks for appropriate kernels in the mission directory first, then if not found, uses the kernels in the base directory:

  • pck
  • tspk

The following are always found in the base directory

  • lsk
  • dems

To check which kernel database files have been loaded, file names may be accessed by calling kernelDbFiles().

Parameters
missionA QString containing the name of the mission whose kernel database files will be loaded.
labReference to the labels of a cube. This is used match the appropriate InstrumentId value, if needed.
See also
readKernelDbFiles()
kernelDbFiles()

References Isis::FileName::fileExists(), Isis::PvlObject::findGroup(), and Isis::Preference::Preferences().

◆ matches()

bool Isis::KernelDb::matches ( const Pvl lab,
PvlGroup grp,
iTime  timeToMatch,
int  cameraVersion 
)
static

This static method determines whether the given cube label matches the given criteria.

The method can check for three criteria types: (1) Time, (2) CameraVersion, and/or (3) the Match keyword values in the given PvlGroup. All three are optional. If any of the given criteria are not met, the method will return false.

(1) If the given PvlGroup does not have a "Time" keyword, then the time will not be compared.

(2) If the given PvlGroup does not have a "CameraTime" keyword, then the time will not be compared.

(3) If the given PvlGroup does not have a "Match" keyword, then individual keywords will not be compared. If the "Match" keyword exists in the given PvlGroup, it will have the form:

Object = ObjectName Group = grp Match = (MatchGroup, MatchKeyword, MatchKeywordValue) EndGroup EndObject

The first entry of the vector passed into the Match keyword of this Pvl represents the name of a group in the labels. This group will be searched for the keyword name passed in as the second entry of the Match keyword. This criteria is met if the keyword value in the labels matches the third entry of the Match keyword.

Parameters
labThe labels of an IsisCube to be searched, usually for times and InstrumentId.
grpA PvlGroup from the kernel database containing values to compare to the labels
timeToMatchThe time value (if time is not being compared, "iTime()" may be passed in for this value)
cameraVersionThe camera version to be matched with the cube labels (if camera version is not being compared, "1" may be passed in for this parameter)
Returns
bool Indicates whether all of the given criteria was matched.

References Isis::PvlObject::findGroup(), Isis::PvlObject::findObject(), Isis::PvlContainer::hasKeyword(), Isis::PvlKeyword::isNamed(), Isis::PvlContainer::keywords(), Isis::PvlKeyword::size(), Isis::IString::ToInteger(), and Isis::IString::Token().

Referenced by findAll().

◆ spacecraftClock()

Kernel Isis::KernelDb::spacecraftClock ( Pvl lab)

This method finds the highest version of all Spacecraft Clock kernels (sclk) identified by the database and the allowed kernel types.

If no database file or stream was provided to the constructor, the loadSystemDb() method should be called prior to this accessor.

If no SCLK is found, this method will return an empty Kernel object.

Parameters
labPvl label containing an IsisCube with needed times and IDs.
Returns
Kernel Highest version of all spacecraft clock kernels

References findLast().

◆ spacecraftPointing()

QList< std::priority_queue< Kernel > > Isis::KernelDb::spacecraftPointing ( Pvl lab)

This method finds a list of the highest versions of all Spacecraft Pointing kernels (ck) identified by the databases and the allowed Kernel types.

If no database file or stream was provided ot the constructor, the loadSystemDb() method should be called prior to this accessor.

If no CKs are found, and a list with one empty queue will be returned.

Parameters
labPvl label containing an IsisCube with needed times and IDs.
Returns
QList< priority_queue<Kernel> > List of queues of Kernel objects for the given entry

References findAll().

◆ spacecraftPosition()

Kernel Isis::KernelDb::spacecraftPosition ( Pvl lab)

This method finds the highest version of all Spacecraft Position kernels (spk) identified by the database and the allowed kernel types.

If no database file or stream was provided to the constructor, the loadSystemDb() method should be called prior to this accessor.

If no SPK is found, this method will return an empty Kernel object.

Parameters
labPvl label containing an IsisCube with needed times and IDs.
Returns
Kernel Highest version of all spacecraft position kernels

References findLast().

◆ targetAttitudeShape()

Kernel Isis::KernelDb::targetAttitudeShape ( Pvl lab)

This method finds the highest version of all Target Attitude Shape kernels (pck) identified by the database and the allowed kernel types.

If no database file or stream was provided to the constructor, the loadSystemDb() method should be called prior to this accessor.

If no PCK is found, this method will return an empty Kernel object.

Parameters
labPvl label containing an IsisCube with needed times and IDs.
Returns
Kernel Highest version of all target attitude shape kernels

References findLast().

◆ targetPosition()

Kernel Isis::KernelDb::targetPosition ( Pvl lab)

This method finds the highest version of all Target Position kernels (tspk) identified by the database and the allowed kernel types.

If no database file or stream was provided to the constructor, the loadSystemDb() method should be called prior to this accessor.

If no TSPK is found, this method will return an empty Kernel object.

Parameters
labPvl label containing an IsisCube with needed times and IDs.
Returns
Kernel Highest version of all target position kernels

References findLast().


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