27 #include <QSharedPointer> 31 #include <boost/foreach.hpp> 86 m_discard( other.m_discard ) {
100 m_discard( other.m_discard ) {
101 if ( deepcopy ) {
m_data.detach(); }
132 return (
m_data->m_name );
142 m_data->m_name = identity;
143 add(
"Identity", identity);
160 return (
name().toLower() == other.
name().toLower() );
173 return (
m_data->m_keys.exists(keywordName) );
187 return (
m_data->m_keys.count(keywordName) );
205 return (
m_data->m_keys.isNull(keywordName, index) );
216 return (
m_data->m_keys );
242 return (
m_data->m_keys.get(keywordName, index) );
269 const int &index)
const {
270 QString keywordValue(defaultValue);
271 if ( !
isNull(keywordName, index) ) {
272 keywordValue =
value(keywordName, index);
274 return (keywordValue);
288 if (
m_data->m_keys.exists(keywordName) ) {
289 return (
m_data->m_keys.keyword(keywordName) );
303 void Resource::add(
const QString &keywordName,
const QString &keywordValue) {
304 m_data->m_keys.add(keywordName, keywordValue);
345 m_data->m_keys.append(keywordName, keywordValue);
359 return (
m_data->m_keys.erase(keywordName) );
396 return ( !
m_data->m_geom.isNull() );
408 return ( !
m_data->m_geom->isEmpty() );
421 return (
m_data->m_geom );
470 return (
m_data->m_assets.contains(assetName.toLower()) );
481 m_data->m_assets.insert(assetName.toLower(), assetValue);
495 return (
m_data->m_assets.remove(assetName.toLower()) );
505 int n =
m_data->m_assets.size();
524 "Requested asset " + assetName +
" does not exist.",
527 return (
m_data->m_assets.value(assetName.toLower()) );
586 while ( key !=
m_data->m_keys.end() ) {
587 object.addKeyword(key.value());
int count(const QString &keywordName) const
Counts the number of values the PVL keyword with the given name has, if it exists in this Resource...
QMap< QString, PvlKeyword >::const_iterator ConstPvlFlatMapIterator
A const iterator for the underling QMap that PvlFlatMap is built on.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Contains more than one keyword-value pair.
QString value(const QString &keywordName, const int &keywordIndex=0) const
Gets the value of the PVL keyword with the given name at the given index.
virtual ~Resource()
Destroys the Resource object.
PvlKeyword keyword(const QString &keywordName) const
Gets the PvlKeyword object with the given name, if it exists in this Resource.
virtual PvlObject toPvl(const QString &pvlName="Resource") const
Transfer all keywords in map to a PvlObject.
bool isActive() const
Accessor method to determine whether this Resource is to be discarded.
virtual Resource * clone(const QString &name, const bool &withAssets=false) const
Clone this resource for additional specialized use.
Namespace for the standard library.
bool isDiscarded() const
Accessor method to determine whether this Resource is to be discarded.
const PvlFlatMap & keys() const
Accessor method for the PVL keywords associated with this Resource.
int removeAsset(const QString &assetName)
Removes all of the assets in this Resource that are mapped to the given name.
SharedGisGeometry geometry() const
Accessor method for this Resource's GIS geometry.
This error is for when a programmer made an API call that was illegal.
bool m_discard
A flag to indicate whether the Resource is inactive.
QString name() const
Accessor for a string containing the Resource's name.
void append(const QString &keywordName, const QString &keywordValue)
Appends the given value to the PVL keyword with the given name.
bool hasValidGeometry() const
This method is used to determine whether a valid GIS geometry has been set for this Resource...
bool isEqual(const Resource &other) const
Checks for equality of another Resource.
Provides a flat map of PvlKeywords.
QSharedPointer< GisGeometry > SharedGisGeometry
Definition for a SharedGisGeometry, a shared pointer to a GisGeometry.
QVariant asset(const QString &assetName) const
Retrieves the value of the asset in this Resource that is mapped to the given name.
This class provides a resource of PVL keywords for Strategy classes.
#define _FILEINFO_
Macro for the filename and line number.
void activate()
Activate a resource.
A single keyword-value pair.
virtual Resource * copy() const
Copy this resource for distinct management of its status.
int erase(const QString &keywordName)
Removes all of the PVL keywords in this Resource that are associated with the given name...
void addAsset(const QString &assetName, QVariant &assetValue)
Inserts an asset with the given name and value into this Resource's VariantList.
bool isNull(const QString &keywordName, const int keywordIndex=0) const
Determines whether the PVL keyword with the given name at the given index is null.
Shared Resource data pointer.
bool hasAsset(const QString &assetName) const
This method is used to determine whether an asset with the given name is in this Resource.
void discard()
Discard a resource.
Namespace for ISIS/Bullet specific routines.
bool hasGeometry() const
This method is used to determine whether the GIS geometry has been set for this Resource.
Resource()
Default constructor for a Resource object.
void add(const QString &keywordName, const QString &keywordValue)
Adds a PVL keyword with the given name and value to this Resource.
void setName(const QString &identity)
A mutator to set the Resource's name.
QExplicitlySharedDataPointer< ResourceData > m_data
Explicitly managed pointer to Resource data.
Contains Pvl Groups and Pvl Objects.
Encapsulation class provides support for GEOS-C API.
bool exists(const QString &keywordName) const
Determines whether a PVL keyword with the given name is in this Resource.
int clearAssets()
Clears the assets from this Resource's VariantList.