Isis Developer Reference
Isis::PvlContainer Class Reference

Contains more than one keyword-value pair. More...

#include <PvlContainer.h>

Inheritance diagram for Isis::PvlContainer:
Inheritance graph
Collaboration diagram for Isis::PvlContainer:
Collaboration graph

Public Types

enum  InsertMode { Append, Replace }
 Contains both modes: Append or Replace. More...
 
typedef QList< PvlKeyword >::iterator PvlKeywordIterator
 The keyword iterator. More...
 
typedef QList< PvlKeyword >::const_iterator ConstPvlKeywordIterator
 The const keyword iterator. More...
 

Public Member Functions

 PvlContainer (const QString &type)
 Constructs a PvlContainer object with a type. More...
 
 PvlContainer (const QString &type, const QString &name)
 Constructs a PvlContainer object with a keyword name and a container name. More...
 
 PvlContainer (const PvlContainer &other)
 
void setName (const QString &name)
 Set the name of the container. More...
 
QString name () const
 Returns the container name. More...
 
bool isNamed (const QString &match) const
 Returns whether the given string is equal to the container name or not. More...
 
QString type () const
 Returns the container type. More...
 
int keywords () const
 Returns the number of keywords contained in the PvlContainer. More...
 
void clear ()
 Clears PvlKeywords. More...
 
void addKeyword (const PvlKeyword &keyword, const InsertMode mode=Append)
 Add a keyword to the container. More...
 
void operator+= (const PvlKeyword &keyword)
 When you use the += operator with a PvlKeyword, it will call the addKeyword() method. More...
 
PvlKeywordfindKeyword (const QString &name)
 Find a keyword with a specified name. More...
 
PvlKeywordoperator[] (const QString &name)
 When you use the [] operator with a (string) name, it will call the findKeyword() method. More...
 
PvlKeywordoperator[] (const int index)
 Return the PvlKeyword object at the specified index. More...
 
PvlKeywordoperator[] (const char *name)
 When you use the [] operator with a (char) name, it will call the findKeyword() method. More...
 
const PvlKeywordfindKeyword (const QString &name) const
 Find a keyword with a specified name. More...
 
const PvlKeywordoperator[] (const QString &name) const
 When you use the [] operator with a (string) name, it will call the findKeyword() method. More...
 
const PvlKeywordoperator[] (const int index) const
 Return the PvlKeyword object at the specified index. More...
 
PvlKeyword operator[] (const char *name) const
 When you use the [] operator with a (char) name, it will call the findKeyword() method. More...
 
bool hasKeyword (const QString &name) const
 Check to see if a keyword exists. More...
 
PvlKeywordIterator findKeyword (const QString &name, PvlKeywordIterator beg, PvlKeywordIterator end)
 Find the index of a keyword, using iterators. More...
 
ConstPvlKeywordIterator findKeyword (const QString &name, ConstPvlKeywordIterator beg, ConstPvlKeywordIterator end) const
 Find the index of a keyword, using iterators. More...
 
PvlKeywordIterator addKeyword (const PvlKeyword &keyword, PvlKeywordIterator pos)
 Insert a keyword at the specified iterator position. More...
 
PvlKeywordIterator begin ()
 Return the beginning iterator. More...
 
ConstPvlKeywordIterator begin () const
 Return the const beginning iterator. More...
 
PvlKeywordIterator end ()
 Return the ending iterator. More...
 
ConstPvlKeywordIterator end () const
 Return the const ending iterator. More...
 
void deleteKeyword (const QString &name)
 Remove a specified keyword. More...
 
void deleteKeyword (const int index)
 Remove the specified keyword. More...
 
bool cleanDuplicateKeywords ()
 Removes keywords from the container that have BOTH the same name and value. More...
 
void operator-= (const QString &name)
 When you use the -= operator with a (string) name, it will call the deleteKeyword() method. More...
 
void operator-= (const PvlKeyword &key)
 When you use the -= operator with a PvlKeyword object, it will call the deleteKeyword() method. More...
 
QString fileName () const
 Returns the filename used to initialise the Pvl object. More...
 
void setFormatTemplate (PvlContainer &ref)
 
bool hasFormatTemplate ()
 
PvlContainerformatTemplate ()
 
PvlFormatformat ()
 
void setFormat (PvlFormat *format)
 
int indent ()
 
void setIndent (int indent)
 
int comments () const
 
QString comment (const int index) const
 
void addComment (const QString &comment)
 
PvlKeywordnameKeyword ()
 
const PvlKeywordnameKeyword () const
 
const PvlContaineroperator= (const PvlContainer &other)
 This is an assignment operator. More...
 

Protected Member Functions

void init ()
 Sets the filename to blank. More...
 
void setFileName (const QString &filename)
 Sets the filename to the specified string. More...
 
void validateAllKeywords (PvlContainer &pPvlCont)
 Validate All the Keywords in a Container comparing with the Template. More...
 
void validateRepeatOption (PvlKeyword &pPvlTmplKwrd, PvlContainer &pPvlCont)
 Validate the Repeat Option for a Keyword. More...
 

Protected Attributes

QString m_filename
 This contains the filename used to initialize the pvl object. More...
 
PvlKeyword m_name
 This is the name keyword. More...
 
QList< PvlKeywordm_keywords
 This is the vector of PvlKeywords the container is holding. More...
 
PvlContainerm_formatTemplate
 

Detailed Description

Contains more than one keyword-value pair.

This is the container for PvlKeywords. It holds information about more than one set of PvlKeywords.

Author
2002-10-11 Jeff Anderson

Member Typedef Documentation

◆ ConstPvlKeywordIterator

The const keyword iterator.

◆ PvlKeywordIterator

The keyword iterator.

Member Enumeration Documentation

◆ InsertMode

Contains both modes: Append or Replace.

Enumerator
Append 
Replace 

Constructor & Destructor Documentation

◆ PvlContainer() [1/3]

Isis::PvlContainer::PvlContainer ( const QString &  type)

Constructs a PvlContainer object with a type.

Parameters
typeThe type of the container.

◆ PvlContainer() [2/3]

Isis::PvlContainer::PvlContainer ( const QString &  type,
const QString &  name 
)

Constructs a PvlContainer object with a keyword name and a container name.

Parameters
typeThe type of container.
nameThe name of the container.

◆ PvlContainer() [3/3]

Isis::PvlContainer::PvlContainer ( const PvlContainer other)

Member Function Documentation

◆ addComment()

void Isis::PvlContainer::addComment ( const QString &  comment)
inline

◆ addKeyword() [1/2]

void Isis::PvlContainer::addKeyword ( const PvlKeyword keyword,
const InsertMode  mode = Append 
)

◆ addKeyword() [2/2]

PvlContainer::PvlKeywordIterator Isis::PvlContainer::addKeyword ( const PvlKeyword keyword,
PvlKeywordIterator  pos 
)

Insert a keyword at the specified iterator position.

This method provides the capability to insert a keyword at the specified iterator position. The process follows the description of the STL vector definition along with all the caveats (e.g., invalidation of iterators upon insert operations).

This method will not perform any checks for the existance of the keyword. This could lead to multiple instances of the same keyword in the same container. It is up to the caller to manage this issue.

Parameters
keyKeyword to insert
posIterator position where to insert the new keyword
Returns
PvlContainer::PvlKeywordIterator Returns the position of the inserted keyword per the STL vector documentation.

◆ begin() [1/2]

◆ begin() [2/2]

ConstPvlKeywordIterator Isis::PvlContainer::begin ( ) const
inline

Return the const beginning iterator.

Returns
The const beginning iterator.

References m_keywords.

◆ cleanDuplicateKeywords()

bool Isis::PvlContainer::cleanDuplicateKeywords ( )

Removes keywords from the container that have BOTH the same name and value.

Returns
bool True if one or more keywords were deleted; False if no keywords were deleted.

◆ clear()

void Isis::PvlContainer::clear ( )
inline

Clears PvlKeywords.

References m_keywords.

Referenced by Isis::PvlObject::clear().

◆ comment()

QString Isis::PvlContainer::comment ( const int  index) const
inline

◆ comments()

int Isis::PvlContainer::comments ( ) const
inline

◆ deleteKeyword() [1/2]

void Isis::PvlContainer::deleteKeyword ( const int  index)

Remove the specified keyword.

Parameters
indexThe index of the keyword to remove.
Exceptions
iException::PvlKeyword doesn't exist.

References _FILEINFO_.

◆ deleteKeyword() [2/2]

◆ end() [1/2]

◆ end() [2/2]

ConstPvlKeywordIterator Isis::PvlContainer::end ( ) const
inline

Return the const ending iterator.

Returns
The const ending iterator.

References m_keywords.

◆ fileName()

◆ findKeyword() [1/4]

◆ findKeyword() [2/4]

const Isis::PvlKeyword & Isis::PvlContainer::findKeyword ( const QString &  name) const

Find a keyword with a specified name.

Parameters
nameThe name of the keyword to look for.
Returns
The PvlKeyword object.
Exceptions
IExceptionThe keyword doesn't exist.

References _FILEINFO_.

◆ findKeyword() [3/4]

PvlContainer::ConstPvlKeywordIterator Isis::PvlContainer::findKeyword ( const QString &  name,
PvlContainer::ConstPvlKeywordIterator  beg,
PvlContainer::ConstPvlKeywordIterator  end 
) const

Find the index of a keyword, using iterators.

Parameters
nameThe name of the keyword.
begThe beginning iterator.
endThe ending iterator.
Returns
The keyword index.

◆ findKeyword() [4/4]

PvlContainer::PvlKeywordIterator Isis::PvlContainer::findKeyword ( const QString &  name,
PvlContainer::PvlKeywordIterator  beg,
PvlContainer::PvlKeywordIterator  end 
)

Find the index of a keyword, using iterators.

Parameters
nameThe name of the keyword.
begThe beginning iterator.
endThe ending iterator.
Returns
The keyword index.

◆ format()

◆ formatTemplate()

PvlContainer* Isis::PvlContainer::formatTemplate ( )
inline

References m_formatTemplate.

Referenced by Isis::operator<<().

◆ hasFormatTemplate()

bool Isis::PvlContainer::hasFormatTemplate ( )
inline

References m_formatTemplate.

Referenced by Isis::operator<<().

◆ hasKeyword()

bool Isis::PvlContainer::hasKeyword ( const QString &  name) const

Check to see if a keyword exists.

Parameters
nameThe name of the keyword to check for.
Returns
True if the keyword exists, false if it doesn't.

Referenced by Isis::Latitude::add(), Isis::SerialNumberList::add(), Isis::PvlTranslationTable::AddTable(), Isis::Albedo::Albedo(), Isis::AlbedoAtm::AlbedoAtm(), Isis::AtmosModel::AtmosModel(), Isis::BulletShapeModel::BulletShapeModel(), Isis::BundleObservationSolveSettings::BundleObservationSolveSettings(), Isis::Camera::Camera(), Isis::CameraFactory::CameraVersion(), Isis::ClipperNacRollingShutterCamera::ClipperNacRollingShutterCamera(), IsisAml::CommandLine(), Isis::ControlNetDiff::compareGroups(), Isis::ControlPointV0001::ControlPointV0001(), Isis::ControlPointV0002::ControlPointV0002(), Isis::ControlPointV0003::ControlPointV0003(), Isis::CameraFactory::Create(), Isis::Gui::Create(), Isis::PhotoModelFactory::Create(), Isis::AtmosModelFactory::Create(), Isis::NormModelFactory::Create(), Isis::ShapeModelFactory::create(), Isis::ProcessExportPds4::createUnitMap(), Isis::ControlNetFilter::CubeConvexHullFilter(), Isis::ControlNetFilter::CubeDistanceFilter(), Isis::ControlNetFilter::CubeNameExpressionFilter(), Isis::ControlNetFilter::CubeNumPointsFilter(), Isis::DemShape::DemShape(), Isis::PvlToPvlTranslationManager::DoTranslation(), Isis::PvlToXmlTranslationManager::doTranslation(), Isis::EmbreeShapeModel::EmbreeShapeModel(), Isis::Equirectangular::Equirectangular(), Isis::KernelDb::findAll(), Isis::CubeViewport::getBandFilterName(), Isis::UniversalGroundMap::GroundRange(), Isis::Camera::GroundRange(), Isis::Hapke::Hapke(), Isis::PvlTranslationTable::hasInputDefault(), Isis::Spice::hasKernels(), Isis::HiLab::HiLab(), Isis::IdealCamera::IdealCamera(), Isis::Equalization::importStatistics(), Isis::PvlTranslationTable::InputDefault(), Isis::PvlToPvlTranslationManager::InputHasKeyword(), Isis::PvlToXmlTranslationManager::InputHasKeyword(), Isis::PvlToPvlTranslationManager::InputKeyword(), Isis::PvlToXmlTranslationManager::InputKeyword(), Isis::PvlTranslationTable::InputKeywordName(), Isis::PvlTranslationTable::IsAuto(), Isis::PvlTranslationTable::IsOptional(), Isis::LambertConformal::LambertConformal(), Isis::Latitude::Latitude(), Isis::Preference::Load(), Isis::LoMediumCamera::LoMediumCamera(), Isis::LunarLambert::LunarLambert(), Isis::LunarLambertEmpirical::LunarLambertEmpirical(), Isis::RingPlaneProjection::Mapping(), Isis::TProjection::Mapping(), Isis::KernelDb::matches(), Isis::Mercator::Mercator(), Isis::Minnaert::Minnaert(), Isis::MinnaertEmpirical::MinnaertEmpirical(), Isis::Mixed::Mixed(), Isis::Mollweide::Mollweide(), Isis::MoonAlbedo::MoonAlbedo(), Isis::NaifDskShape::NaifDskShape(), Isis::ObliqueCylindrical::ObliqueCylindrical(), Isis::operator<<(), Isis::Orthographic::Orthographic(), Isis::OsirisRexOcamsCamera::OsirisRexOcamsCamera(), Isis::PvlTranslationTable::OutputName(), Isis::PvlTranslationTable::OutputPosition(), Isis::AutoReg::Parse(), Isis::GridPolygonSeeder::Parse(), Isis::LimitPolygonSeeder::Parse(), Isis::PolygonSeeder::Parse(), Isis::StripPolygonSeeder::Parse(), Isis::PhotoModel::PhotoModel(), Isis::Planar::Planar(), Isis::ControlNetFilter::PointDistanceFilter(), Isis::ControlNetFilter::PointEditLockFilter(), Isis::ControlNetFilter::PointGoodnessOfFitFilter(), Isis::ControlNetFilter::PointLatLonFilter(), Isis::ControlNetFilter::PointMeasurePropertiesFilter(), Isis::ControlNetFilter::PointMeasuresFilter(), Isis::ControlNetFilter::PointNumMeasuresEditLockFilter(), Isis::PointPerspective::PointPerspective(), Isis::ControlNetFilter::PointPixelShiftFilter(), Isis::ControlNetFilter::PointPropertiesFilter(), Isis::ControlNetFilter::PointResMagnitudeFilter(), Isis::PolarStereographic::PolarStereographic(), Isis::Projection::Projection(), Isis::Target::radiiGroup(), Isis::AutoReg::RegTemplate(), Isis::RingCylindrical::RingCylindrical(), Isis::RingPlaneProjection::RingPlaneProjection(), Isis::Camera::ringRange(), Isis::ProcessMapMosaic::RingsSetOutputCube(), Isis::Robinson::Robinson(), Isis::ProcessImportFits::setFitsFile(), Isis::ProcessMapMosaic::SetOutputCube(), Isis::ProcessImportFits::setProcessFileStructure(), Isis::ControlNet::SetTarget(), Isis::Shade::Shade(), Isis::ShadeAtm::ShadeAtm(), Isis::SimpleCylindrical::SimpleCylindrical(), Isis::Sinusoidal::Sinusoidal(), Isis::ProcessExportPds::StandardAllMapping(), Isis::ProcessImportFits::standardInstrumentGroup(), Isis::Target::Target(), Isis::ThemisIrCamera::ThemisIrCamera(), Isis::Topo::Topo(), Isis::TopoAtm::TopoAtm(), Isis::IException::toString(), Isis::TProjection::TProjection(), Isis::PvlTranslationTable::Translate(), Isis::PvlToPvlTranslationManager::Translate(), Isis::XmlToPvlTranslationManager::Translate(), Isis::PvlToXmlTranslationManager::Translate(), Isis::ProcessExportPds4::translateBandBinSpectrumBinSet(), Isis::ProcessExportPds4::translateBandBinSpectrumUniform(), Isis::TransverseMercator::TransverseMercator(), Isis::SubArea::UpdateLabel(), Isis::SpectralPlotTool::updateTool(), validateAllKeywords(), Isis::PvlObject::validateObject(), Isis::Pvl::validatePvl(), Isis::ControlNetValidMeasure::ValidatePvlDN(), Isis::ControlNetValidMeasure::ValidatePvlEmissionAngle(), Isis::ControlNetValidMeasure::ValidatePvlFromEdge(), Isis::ControlNetValidMeasure::ValidatePvlIncidenceAngle(), Isis::ControlNetValidMeasure::ValidatePvlResidualTolerances(), Isis::ControlNetValidMeasure::ValidatePvlResolution(), and Isis::ControlNetValidMeasure::ValidatePvlShiftTolerances().

◆ indent()

int Isis::PvlContainer::indent ( )
inline

References Isis::PvlKeyword::indent(), and m_name.

Referenced by Isis::operator<<(), and setIndent().

◆ init()

void Isis::PvlContainer::init ( )
protected

Sets the filename to blank.

◆ isNamed()

bool Isis::PvlContainer::isNamed ( const QString &  match) const
inline

Returns whether the given string is equal to the container name or not.

Parameters
matchThe string to compare to the name.
Returns
True if the name and string are the same, false if they are not.

References m_name, and Isis::PvlKeyword::stringEqual().

Referenced by Isis::SessionLog::AddError(), Isis::Cube::attachSpiceFromIsd(), Isis::Cube::copy(), Isis::Blob::Find(), Isis::KernelDb::findAll(), Isis::Cube::hasBlob(), Isis::IsBlob(), Isis::Image::isFootprintable(), Isis::Shape::isFootprintable(), Isis::RemoveHiBlobs(), Isis::Process::SetOutputCube(), and Isis::Process::WriteHistory().

◆ keywords()

◆ name()

◆ nameKeyword() [1/2]

PvlKeyword& Isis::PvlContainer::nameKeyword ( )
inline

◆ nameKeyword() [2/2]

const PvlKeyword& Isis::PvlContainer::nameKeyword ( ) const
inline

References m_name.

◆ operator+=()

void Isis::PvlContainer::operator+= ( const PvlKeyword keyword)
inline

When you use the += operator with a PvlKeyword, it will call the addKeyword() method.

Parameters
keywordThe PvlKeyword to be added.

◆ operator-=() [1/2]

void Isis::PvlContainer::operator-= ( const PvlKeyword key)
inline

When you use the -= operator with a PvlKeyword object, it will call the deleteKeyword() method.

Parameters
keyThe PvlKeyword object to remove.

References deleteKeyword(), and Isis::PvlKeyword::name().

◆ operator-=() [2/2]

void Isis::PvlContainer::operator-= ( const QString &  name)
inline

When you use the -= operator with a (string) name, it will call the deleteKeyword() method.

Parameters
nameThe name of the keyword to remove.

References deleteKeyword(), and name().

◆ operator=()

const PvlContainer & Isis::PvlContainer::operator= ( const PvlContainer other)

This is an assignment operator.

References m_filename, m_formatTemplate, m_keywords, and m_name.

Referenced by Isis::PvlGroup::operator=(), and Isis::PvlObject::operator=().

◆ operator[]() [1/6]

PvlKeyword& Isis::PvlContainer::operator[] ( const char *  name)
inline

When you use the [] operator with a (char) name, it will call the findKeyword() method.

Parameters
nameThe name of the keyword to find.

References name(), and operator[]().

◆ operator[]() [2/6]

PvlKeyword Isis::PvlContainer::operator[] ( const char *  name) const
inline

When you use the [] operator with a (char) name, it will call the findKeyword() method.

Parameters
nameThe name of the keyword to find.

References name(), and operator[]().

◆ operator[]() [3/6]

PvlKeyword & Isis::PvlContainer::operator[] ( const int  index)

Return the PvlKeyword object at the specified index.

Parameters
indexThe index to use.
Returns
The PvlKeyword at the specified index.
Exceptions
iException::MessageThe index is out of bounds.

References _FILEINFO_, and Isis::Message::ArraySubscriptNotInRange().

◆ operator[]() [4/6]

const Isis::PvlKeyword & Isis::PvlContainer::operator[] ( const int  index) const

Return the PvlKeyword object at the specified index.

Parameters
indexThe index to use.
Returns
The PvlKeyword at the specified index.
Exceptions
iException::MessageThe index is out of bounds.

References _FILEINFO_, and Isis::Message::ArraySubscriptNotInRange().

◆ operator[]() [5/6]

PvlKeyword& Isis::PvlContainer::operator[] ( const QString &  name)
inline

When you use the [] operator with a (string) name, it will call the findKeyword() method.

Parameters
nameThe name of the keyword to find.

References findKeyword(), and name().

Referenced by operator[]().

◆ operator[]() [6/6]

const PvlKeyword& Isis::PvlContainer::operator[] ( const QString &  name) const
inline

When you use the [] operator with a (string) name, it will call the findKeyword() method.

Parameters
nameThe name of the keyword to find.

References findKeyword(), and name().

◆ setFileName()

void Isis::PvlContainer::setFileName ( const QString &  filename)
inlineprotected

Sets the filename to the specified string.

Parameters
filenameThe new filename to use.

References m_filename.

◆ setFormat()

void Isis::PvlContainer::setFormat ( PvlFormat format)
inline

◆ setFormatTemplate()

void Isis::PvlContainer::setFormatTemplate ( PvlContainer ref)
inline

◆ setIndent()

void Isis::PvlContainer::setIndent ( int  indent)
inline

◆ setName()

void Isis::PvlContainer::setName ( const QString &  name)
inline

◆ type()

QString Isis::PvlContainer::type ( ) const
inline

Returns the container type.

Returns
The container type.

References m_name, and Isis::PvlKeyword::name().

Referenced by Isis::PvlObject::deleteGroup(), Isis::PvlObject::deleteObject(), and Isis::operator<<().

◆ validateAllKeywords()

void Isis::PvlContainer::validateAllKeywords ( PvlContainer pPvlCont)
protected

Validate All the Keywords in a Container comparing with the Template.

Validate all the PvlKeywords in this container.

Author
Sharmila Prasad (9/24/2010)
Parameters
pPvlCont- Container to be Validated
History:
2010-10-18 Sharmila Prasad - Added options "Type", "Range", "Value" for the keyword validation

References _FILEINFO_, deleteKeyword(), findKeyword(), hasKeyword(), Isis::PvlKeyword::name(), and Isis::PvlKeyword::validateKeyword().

Referenced by Isis::PvlGroup::validateGroup(), Isis::PvlObject::validateObject(), and Isis::Pvl::validatePvl().

◆ validateRepeatOption()

void Isis::PvlContainer::validateRepeatOption ( PvlKeyword pPvlTmplKwrd,
PvlContainer pPvlCont 
)
protected

Validate the Repeat Option for a Keyword.

Validate Repeat Option in the Template Group.

This option indicates that a particular keyname can be repeated several times

Author
Sharmila Prasad (9/24/2010)
Parameters
pPvlTmplKwrd- Template Keyword wit
pPvlCont- Container with all the Keywords
History:
2010-10-18 Sharmila Prasad - Added option "Type" for the keyword validation

References deleteKeyword(), keywords(), Isis::PvlKeyword::name(), and Isis::PvlKeyword::validateKeyword().

Member Data Documentation

◆ m_filename

QString Isis::PvlContainer::m_filename
protected

This contains the filename used to initialize the pvl object.

If the object was not initialized using a filename the string is empty.

Referenced by Isis::PvlObject::deleteGroup(), Isis::PvlObject::deleteObject(), fileName(), Isis::PvlObject::findGroup(), Isis::PvlObject::findKeyword(), Isis::PvlObject::findObject(), operator=(), Isis::Pvl::read(), and setFileName().

◆ m_formatTemplate

◆ m_keywords

QList<PvlKeyword> Isis::PvlContainer::m_keywords
protected

This is the vector of PvlKeywords the container is holding.

Referenced by begin(), clear(), end(), keywords(), and operator=().

◆ m_name

PvlKeyword Isis::PvlContainer::m_name
protected

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