USGS

Isis 3.0 Developer's Reference (API)

Home

Isis::PvlContainer Class Reference
[Parsing]

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

#include <PvlContainer.h>

Inherited by Isis::PvlGroup, and Isis::PvlObject.

List of all members.

Public Types

enum  InsertMode { Append, Replace }
 

Contains both modes: Append or Replace.

More...
typedef QList< PvlKeyword >
::iterator 
PvlKeywordIterator
 The keyword iterator.
typedef QList< PvlKeyword >
::const_iterator 
ConstPvlKeywordIterator
 The const keyword iterator.

Public Member Functions

 PvlContainer (const std::string &type)
 Constructs a PvlContainer object with a type.
 PvlContainer (const std::string &type, const std::string &name)
 Constructs a PvlContainer object with a keyword name and a container name.
 PvlContainer (const PvlContainer &other)
void SetName (const std::string &name)
 Set the name of the container.
std::string Name () const
 Returns the container name.
bool IsNamed (const std::string &match) const
 Returns whether the given string is equal to the container name or not.
std::string Type () const
 Returns the container type.
int Keywords () const
 Returns the number of keywords contained in the PvlContainer.
void Clear ()
 Clears PvlKeywords.
void AddKeyword (const PvlKeyword &keyword, const InsertMode mode=Append)
 Add a keyword to the container.
void operator+= (const PvlKeyword &keyword)
 When you use the += operator with a PvlKeyword, it will call the AddKeyword() method.
PvlKeywordFindKeyword (const std::string &name)
 Find a keyword with a specified name.
PvlKeywordoperator[] (const std::string &name)
 When you use the [] operator with a (string) name, it will call the FindKeyword() method.
PvlKeywordoperator[] (const int index)
 Return the PvlKeyword object at the specified index.
PvlKeywordoperator[] (const char *name)
 When you use the [] operator with a (char) name, it will call the FindKeyword() method.
const PvlKeywordFindKeyword (const std::string &name) const
 Find a keyword with a specified name.
const PvlKeywordoperator[] (const std::string &name) const
 When you use the [] operator with a (string) name, it will call the FindKeyword() method.
const PvlKeywordoperator[] (const int index) const
 Return the PvlKeyword object at the specified index.
PvlKeyword operator[] (const char *name) const
 When you use the [] operator with a (char) name, it will call the FindKeyword() method.
bool HasKeyword (const std::string &name) const
 Check to see if a keyword exists.
PvlKeywordIterator FindKeyword (const std::string &name, PvlKeywordIterator beg, PvlKeywordIterator end)
 Find the index of a keyword, using iterators.
ConstPvlKeywordIterator FindKeyword (const std::string &name, ConstPvlKeywordIterator beg, ConstPvlKeywordIterator end) const
 Find the index of a keyword, using iterators.
PvlKeywordIterator AddKeyword (const PvlKeyword &keyword, PvlKeywordIterator pos)
 Insert a keyword at the specified iterator position.
PvlKeywordIterator Begin ()
 Return the beginning iterator.
ConstPvlKeywordIterator Begin () const
 Return the const beginning iterator.
PvlKeywordIterator End ()
 Return the ending iterator.
ConstPvlKeywordIterator End () const
 Return the const ending iterator.
void DeleteKeyword (const std::string &name)
 Remove a specified keyword.
void DeleteKeyword (const int index)
 Remove the specified keyword.
bool CleanDuplicateKeywords ()
 Removes keywords from the container that have BOTH the same name and value.
void operator-= (const std::string &name)
 When you use the -= operator with a (string) name, it will call the DeleteKeyword() method.
void operator-= (const PvlKeyword &key)
 When you use the -= operator with a PvlKeyword object, it will call the DeleteKeyword() method.
std::string Filename () const
 Returns the filename used to initialise the Pvl object.
void SetFormatTemplate (PvlContainer &ref)
bool HasFormatTemplate ()
PvlContainerFormatTemplate ()
PvlFormatGetFormat ()
void SetFormat (PvlFormat *format)
int Indent ()
void SetIndent (int indent)
int Comments () const
std::string Comment (const int index) const
void AddComment (const std::string &comment)
PvlKeywordGetNameKeyword ()
const PvlKeywordGetNameKeyword () const
const PvlContaineroperator= (const PvlContainer &other)
 This is an assignment operator.

Protected Member Functions

void Init ()
 Sets the filename to blank.
void SetFilename (const std::string &filename)
 Sets the filename to the specified string.
void ValidateAllKeywords (PvlContainer &pPvlCont)
 Validate All the Keywords in a Container comparing with the Template.
void ValidateRepeatOption (PvlKeyword &pPvlTmplKwrd, PvlContainer &pPvlCont)
 Validate the Repeat Option for a Keyword.

Protected Attributes

std::string p_filename
 This contains the filename used to initialize the pvl object.
PvlKeyword p_name
 This is the name keyword.
QList< PvlKeywordp_keywords
 This is the vector of PvlKeywords the container is holding.
PvlContainerp_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

The const keyword iterator.

The keyword iterator.


Member Enumeration Documentation

Contains both modes: Append or Replace.

Enumerator:
Append 
Replace 

Constructor & Destructor Documentation

Isis::PvlContainer::PvlContainer ( const std::string &  type  ) 

Constructs a PvlContainer object with a type.

Parameters:
type The type of the container.

References Init(), p_name, and Isis::PvlKeyword::SetName().

Isis::PvlContainer::PvlContainer ( const std::string &  type,
const std::string &  name 
)

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

Parameters:
type The type of container.
name The name of the container.

References Init(), p_name, SetName(), and Isis::PvlKeyword::SetName().

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

Member Function Documentation

void Isis::PvlContainer::AddComment ( const std::string &  comment  )  [inline]
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:
key Keyword to insert
pos Iterator position where to insert the new keyword
Returns:
PvlContainer::PvlKeywordIterator Returns the position of the inserted keyword per the STL vector documentation.

References p_keywords.

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

Add a keyword to the container.

Add a keyword to the PvlContainer object.

Parameters:
keyword The PvlKeyword object to append.
mode Using the InsertMode value of Append.
key The PvlKeyword object to add.
mode The enum InsertMode has two possible values, Append or Replace. Use Append if you just want to add it to the end, Replace if you want to replace it.

References Append, FindKeyword(), HasKeyword(), Isis::PvlKeyword::Name(), and p_keywords.

Referenced by Isis::PvlFormat::Add(), Isis::ProjectionFactory::CreateForCube(), operator+=(), Isis::operator<<(), Isis::operator>>(), Isis::StripPolygonSeeder::PluginParameters(), Isis::LimitPolygonSeeder::PluginParameters(), Isis::GridPolygonSeeder::PluginParameters(), Isis::Stretch::Save(), Isis::ProcessMapMosaic::SetOutputCube(), Isis::Projection::SetUpperLeftCorner(), Isis::Spice::storeValue(), Isis::SubArea::UpdateLabel(), Isis::CubeTileHandler::updateLabels(), Isis::CubeBsqHandler::updateLabels(), and Isis::ControlNetFileV0002::Write().

ConstPvlKeywordIterator Isis::PvlContainer::Begin (  )  const [inline]

Return the const beginning iterator.

Returns:
The const beginning iterator.

References p_keywords.

PvlKeywordIterator Isis::PvlContainer::Begin (  )  [inline]
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.

References Begin(), End(), and p_keywords.

void Isis::PvlContainer::Clear (  )  [inline]

Clears PvlKeywords.

Reimplemented in Isis::PvlObject.

References p_keywords.

Referenced by Isis::Cube::open().

std::string Isis::PvlContainer::Comment ( const int  index  )  const [inline]

References Isis::PvlKeyword::Comment(), and p_name.

Referenced by Isis::operator<<().

int Isis::PvlContainer::Comments (  )  const [inline]

References Isis::PvlKeyword::Comments(), and p_name.

Referenced by Isis::operator<<().

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

Remove the specified keyword.

Parameters:
index The index of the keyword to remove.
Exceptions:
iException::Pvl Keyword doesn't exist.

References _FILEINFO_, Begin(), Isis::iException::Message(), Name(), p_filename, p_keywords, Isis::iException::Pvl, and Type().

void Isis::PvlContainer::DeleteKeyword ( const std::string &  name  ) 
ConstPvlKeywordIterator Isis::PvlContainer::End (  )  const [inline]

Return the const ending iterator.

Returns:
The const ending iterator.

References p_keywords.

PvlKeywordIterator Isis::PvlContainer::End (  )  [inline]
std::string Isis::PvlContainer::Filename (  )  const [inline]
PvlContainer::ConstPvlKeywordIterator Isis::PvlContainer::FindKeyword ( const std::string &  name,
PvlContainer::ConstPvlKeywordIterator  beg,
PvlContainer::ConstPvlKeywordIterator  end 
) const

Find the index of a keyword, using iterators.

Parameters:
name The name of the keyword.
beg The beginning iterator.
end The ending iterator.
Returns:
The keyword index.
PvlContainer::PvlKeywordIterator Isis::PvlContainer::FindKeyword ( const std::string &  name,
PvlContainer::PvlKeywordIterator  beg,
PvlContainer::PvlKeywordIterator  end 
)

Find the index of a keyword, using iterators.

Parameters:
name The name of the keyword.
beg The beginning iterator.
end The ending iterator.
Returns:
The keyword index.
const Isis::PvlKeyword & Isis::PvlContainer::FindKeyword ( const std::string &  name  )  const

Find a keyword with a specified name.

Parameters:
name The name of the keyword to look for.
Returns:
The PvlKeyword object.
Exceptions:
iException::Pvl The keyword doesn't exist.

References _FILEINFO_, Begin(), End(), FindKeyword(), Isis::iException::Message(), Name(), p_filename, Isis::iException::Pvl, and Type().

Isis::PvlKeyword & Isis::PvlContainer::FindKeyword ( const std::string &  name  ) 
PvlContainer* Isis::PvlContainer::FormatTemplate (  )  [inline]

References p_formatTemplate.

Referenced by Isis::operator<<().

PvlFormat* Isis::PvlContainer::GetFormat (  )  [inline]
const PvlKeyword& Isis::PvlContainer::GetNameKeyword (  )  const [inline]

References p_name.

PvlKeyword& Isis::PvlContainer::GetNameKeyword (  )  [inline]

References p_name.

Referenced by Isis::operator<<().

bool Isis::PvlContainer::HasFormatTemplate (  )  [inline]

References p_formatTemplate.

Referenced by Isis::operator<<().

bool Isis::PvlContainer::HasKeyword ( const std::string &  name  )  const

Check to see if a keyword exists.

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

References Begin(), End(), and FindKeyword().

Referenced by AddKeyword(), Isis::PvlTranslationTable::AddTable(), Isis::AlbedoAtm::AlbedoAtm(), Isis::AtmosModel::AtmosModel(), Isis::Camera::Camera(), IsisAml::CommandLine(), Isis::ControlNetFilter::CubeConvexHullFilter(), Isis::ControlNetFilter::CubeDistanceFilter(), Isis::ControlNetFilter::CubeNameExpressionFilter(), Isis::ControlNetFilter::CubeNumPointsFilter(), Isis::Equirectangular::Equirectangular(), KernelDb::FindAll(), Isis::CubeViewport::getBandFilterName(), Isis::GroundGrid::GroundGrid(), Isis::Camera::GroundRange(), Isis::Hapke::Hapke(), Isis::Spice::HasKernels(), HiLab::HiLab(), Isis::IdealCamera::IdealCamera(), Isis::PvlTranslationTable::InputDefault(), Isis::PvlTranslationManager::InputHasKeyword(), Isis::PvlTranslationManager::InputKeyword(), Isis::PvlTranslationTable::InputKeywordName(), Isis::PvlTranslationTable::IsAuto(), Isis::PvlTranslationTable::IsOptional(), Isis::LambertConformal::LambertConformal(), Isis::Preference::Load(), Isis::LoMediumCamera::LoMediumCamera(), Isis::Projection::Mapping(), Isis::ProcessMosaic::MatchBandBinGroup(), Isis::ProcessMosaic::MatchDEMShapeModel(), KernelDb::Matches(), Isis::Mercator::Mercator(), Isis::iException::Message(), Isis::ObliqueCylindrical::ObliqueCylindrical(), Isis::Orthographic::Orthographic(), Isis::PvlTranslationTable::OutputName(), Isis::PvlTranslationTable::OutputPosition(), Isis::AutoReg::Parse(), Isis::PhotoModel::PhotoModel(), 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::SpectralPlotTool::refreshPlot(), Isis::AutoReg::RegTemplate(), Isis::Sensor::Sensor(), Isis::ProcessMapMosaic::SetOutputCube(), Isis::Shade::Shade(), Isis::ShadeAtm::ShadeAtm(), Isis::SimpleCylindrical::SimpleCylindrical(), Isis::Sinusoidal::Sinusoidal(), Isis::Projection::TargetRadii(), Isis::Filename::Temporary(), Isis::ThemisIrCamera::ThemisIrCamera(), Isis::Topo::Topo(), Isis::TopoAtm::TopoAtm(), Isis::ControlNetFileV0002::ToPvl(), Isis::PvlTranslationTable::Translate(), Isis::PvlTranslationManager::Translate(), 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(), Isis::ControlNetValidMeasure::ValidatePvlShiftTolerances(), and ValidateRepeatOption().

int Isis::PvlContainer::Indent (  )  [inline]

References Isis::PvlKeyword::Indent(), and p_name.

Referenced by Isis::operator<<().

void Isis::PvlContainer::Init (  )  [protected]

Sets the filename to blank.

References p_filename, and p_formatTemplate.

Referenced by PvlContainer().

bool Isis::PvlContainer::IsNamed ( const std::string &  match  )  const [inline]

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

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

References p_name, and Isis::PvlKeyword::StringEqual().

Referenced by KernelDb::FindAll(), Isis::Cube::hasTable(), Isis::IsBlob(), Isis::Process::SetOutputCube(), and Isis::Process::WriteHistory().

int Isis::PvlContainer::Keywords (  )  const [inline]
std::string Isis::PvlContainer::Name (  )  const [inline]
void Isis::PvlContainer::operator+= ( const PvlKeyword keyword  )  [inline]

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

Parameters:
keyword The PvlKeyword to be added.

References AddKeyword().

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

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

Parameters:
key The PvlKeyword object to remove.

References DeleteKeyword(), and Isis::PvlKeyword::Name().

void Isis::PvlContainer::operator-= ( const std::string &  name  )  [inline]

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

Parameters:
name The name of the keyword to remove.

References DeleteKeyword().

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

This is an assignment operator.

References p_filename, p_formatTemplate, p_keywords, and p_name.

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:
name The name of the keyword to find.

References operator[]().

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

Return the PvlKeyword object at the specified index.

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

References _FILEINFO_, Isis::Message::ArraySubscriptNotInRange(), Isis::iException::Message(), p_keywords, and Isis::iException::Programmer.

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

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

Parameters:
name The name of the keyword to find.

References FindKeyword().

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

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

Parameters:
name The name of the keyword to find.

References operator[]().

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

Return the PvlKeyword object at the specified index.

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

References _FILEINFO_, Isis::Message::ArraySubscriptNotInRange(), Isis::iException::Message(), p_keywords, and Isis::iException::Programmer.

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

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

Parameters:
name The name of the keyword to find.

References FindKeyword().

Referenced by operator[]().

void Isis::PvlContainer::SetFilename ( const std::string &  filename  )  [inline, protected]

Sets the filename to the specified string.

Parameters:
filename The new filename to use.

References p_filename.

void Isis::PvlContainer::SetFormat ( PvlFormat format  )  [inline]
void Isis::PvlContainer::SetFormatTemplate ( PvlContainer ref  )  [inline]

References p_formatTemplate.

Referenced by Isis::operator<<().

void Isis::PvlContainer::SetIndent ( int  indent  )  [inline]

References p_name, and Isis::PvlKeyword::SetIndent().

Referenced by Isis::operator<<().

void Isis::PvlContainer::SetName ( const std::string &  name  )  [inline]

Set the name of the container.

References p_name, and Isis::PvlKeyword::SetValue().

Referenced by Isis::operator>>(), PvlContainer(), and Isis::MosaicSceneWidget::toPvl().

std::string Isis::PvlContainer::Type (  )  const [inline]

Returns the container type.

Returns:
The container type.

References Isis::PvlKeyword::Name(), and p_name.

Referenced by Isis::PvlObject::DeleteGroup(), DeleteKeyword(), Isis::PvlObject::DeleteObject(), and FindKeyword().

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(), Keywords(), Isis::iException::Message(), Isis::PvlKeyword::Name(), Isis::iException::User, Isis::PvlKeyword::ValidateKeyword(), and ValidateRepeatOption().

Referenced by Isis::PvlGroup::ValidateGroup(), Isis::PvlObject::ValidateObject(), and Isis::Pvl::ValidatePvl().

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(), FindKeyword(), HasKeyword(), Keywords(), Isis::PvlKeyword::Name(), and Isis::PvlKeyword::ValidateKeyword().

Referenced by ValidateAllKeywords().


Member Data Documentation

std::string Isis::PvlContainer::p_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(), DeleteKeyword(), Isis::PvlObject::DeleteObject(), Filename(), Isis::PvlObject::FindGroup(), Isis::PvlObject::FindKeyword(), FindKeyword(), Isis::PvlObject::FindObject(), Init(), operator=(), Isis::Pvl::Read(), and SetFilename().

This is the vector of PvlKeywords the container is holding.

Referenced by AddKeyword(), Begin(), CleanDuplicateKeywords(), Clear(), DeleteKeyword(), End(), Keywords(), operator=(), and operator[]().


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