Isis 3 Programmer Reference
Isis::CubeAttribute< ChildClass > Class Template Reference

Parent class for CubeAttributeInput and CubeAttributeOutput. More...

#include <CubeAttribute.h>

Collaboration diagram for Isis::CubeAttribute< ChildClass >:
Collaboration graph

Public Member Functions

 CubeAttribute (QList< bool(ChildClass::*)(QString) const > testers)
 Constructs an empty CubeAttribute.
 
 CubeAttribute (QList< bool(ChildClass::*)(QString) const > testers, const FileName &fileName)
 Constructs a CubeAttribute using the argument.
 
virtual ~CubeAttribute ()
 Destroys the object.
 
QString toString () const
 Return a string-representation of this cube attributes.
 
void addAttribute (QString attribute)
 Add a single attribute to these attributes.
 
void addAttributes (const FileName &fileNameWithAtts)
 Append the attributes found in the filename to these cube attributes.
 
void addAttributes (const char *attributesString)
 Append the attributes in the string to these cube attributes.
 
void addAttributes (const QString &attributesString)
 Append the attributes in the string to these cube attributes.
 
void setAttributes (const FileName &fileName)
 Replaces the current attributes with the attributes in the given file name.
 

Protected Member Functions

QStringList attributeList (bool(ChildClass::*tester)(QString) const) const
 Get a list of attributes that the tester returns true on.
 
void setAttribute (QString newValue, bool(ChildClass::*tester)(QString) const)
 Set the attribute(s) for which tester returns true to newValue.
 

Private Attributes

QStringList m_attributes
 These are the attributes that this cube attribute stores.
 
QList< bool(ChildClass::*)(QString) const > m_attributeTypeTesters
 These testers determine if an attribute looks like a particular option.
 

Detailed Description

template<typename ChildClass>
class Isis::CubeAttribute< ChildClass >

Parent class for CubeAttributeInput and CubeAttributeOutput.

This class provides common functionality for the CubeAttributeInput and CubeAttributeOutput classes. These classes are used to parse and manipulate attribute information attached to the end of a cube filename.

See also
IsisAml IsisGui
Author
2003-07-09 Stuart Sides
History

2003-07-17 Stuart Sides - Added input file band attribute capabilities.

2003-07-29 Stuart Sides - Separated the input and output attributes into two separated class deriving off a base class, instead of one class for all cases.

2003-10-03 Stuart Sides - Added members HasPixelType. It was needed by the IsisCube so it could do an easy check. Added IsMsb, IsLsb, HasOrder, ByteOrderStr, ByteOrderType, Order and Order. These were needed to allow users to specify a byte order for output cubes.

2004-02-03 Stuart Sides - Refactor for IsisProcess and cube changes

2004-03-03 Stuart Sides - Modified IsisCubeAttributeOutput::Write so min and max don't get written when the pixel type is real.

2012-07-02 Steven Lambright and Stuart Sides - Refactored to minimize code duplication. Updated to match current coding standards. Added safety check capabilities for unrecognized attributes. References #961.

2016-04-21 Makayla Shepherd - Added cases for UnsignedWord pixel type

Definition at line 118 of file CubeAttribute.h.

Constructor & Destructor Documentation

◆ CubeAttribute() [1/2]

template<typename ChildClass >
Isis::CubeAttribute< ChildClass >::CubeAttribute ( QList< bool(ChildClass::*)(QString) const > testers)
inline

Constructs an empty CubeAttribute.

Definition at line 122 of file CubeAttribute.h.

References Isis::CubeAttribute< ChildClass >::m_attributeTypeTesters.

◆ CubeAttribute() [2/2]

template<typename ChildClass >
Isis::CubeAttribute< ChildClass >::CubeAttribute ( QList< bool(ChildClass::*)(QString) const > testers,
const FileName & fileName )
inline

Constructs a CubeAttribute using the argument.

Constructs a CubeAttribute and initializes it with the contents of the string parameter. Minimal error checking is done to see if the string looks like an attribute.

Parameters
attA string containing the file attributes. All characters before the first "+" are assumed to be the filename and are ignored.

Definition at line 138 of file CubeAttribute.h.

References Isis::CubeAttribute< ChildClass >::m_attributeTypeTesters, and Isis::CubeAttribute< ChildClass >::setAttributes().

◆ ~CubeAttribute()

template<typename ChildClass >
virtual Isis::CubeAttribute< ChildClass >::~CubeAttribute ( )
inlinevirtual

Destroys the object.

Definition at line 146 of file CubeAttribute.h.

Member Function Documentation

◆ addAttribute()

template<typename ChildClass >
void Isis::CubeAttribute< ChildClass >::addAttribute ( QString attribute)
inline

Add a single attribute to these attributes.

This attribute should NOT have a '+' in it. For example, if you wanted to add BandSequential to the CubeAttributeOutput class, you could call addAttribute("BSQ") or addAttribute("BandSequential") or any valid deviation of that string. This will preserve existing attributes unless it's of the same type (if Tile was already set, then this will overwrite Tile). If the attribute is unrecognized or ambiguous, then an exception will be thrown.

Parameters
attributeThe attribute we're adding to the current cube attributes

Definition at line 178 of file CubeAttribute.h.

References Isis::CubeAttribute< ChildClass >::m_attributes, Isis::CubeAttribute< ChildClass >::m_attributeTypeTesters, and Isis::IException::Unknown.

Referenced by Isis::CubeAttribute< ChildClass >::setAttributes().

◆ addAttributes() [1/3]

template<typename ChildClass >
void Isis::CubeAttribute< ChildClass >::addAttributes ( const char * attributesString)
inline

Append the attributes in the string to these cube attributes.

This will call addAttribute() for every attribute in the string. The initial "+" is not expected but allowed. This should NOT be called with a file name.

Parameters
attributesStringA string of recognizable attributes, for example "+Bsq+Real" or "Bsq+Real"

Definition at line 235 of file CubeAttribute.h.

References Isis::CubeAttribute< ChildClass >::addAttributes().

◆ addAttributes() [2/3]

template<typename ChildClass >
void Isis::CubeAttribute< ChildClass >::addAttributes ( const FileName & fileNameWithAtts)
inline

Append the attributes found in the filename to these cube attributes.

This will call addAttribute() for every attribute found in the file name.

See also
FileName::attributes()
Parameters
fileNameWithAttsA filename with attributes appended, for example FileName("out.cub+Bsq")

Definition at line 222 of file CubeAttribute.h.

References Isis::CubeAttribute< ChildClass >::addAttributes().

Referenced by Isis::CubeAttribute< ChildClass >::addAttributes(), and Isis::CubeAttribute< ChildClass >::addAttributes().

◆ addAttributes() [3/3]

template<typename ChildClass >
void Isis::CubeAttribute< ChildClass >::addAttributes ( const QString & attributesString)
inline

Append the attributes in the string to these cube attributes.

See also
addAttributes(const char *)
Parameters
attributesStringA string of recognizable attributes, for example "+Bsq+Real" or "Bsq+Real"

Definition at line 248 of file CubeAttribute.h.

References Isis::CubeAttribute< ChildClass >::setAttributes(), and Isis::CubeAttribute< ChildClass >::toString().

◆ attributeList()

template<typename ChildClass >
QStringList Isis::CubeAttribute< ChildClass >::attributeList ( bool(ChildClass::*)(QString) const tester) const
inlineprotected

Get a list of attributes that the tester returns true on.

This is helpful for accessing the values of existing attributes. The strings will always be the UPPER CASE version of the attribute, i.e. not Bsq but BSQ. The returned attributes do not contain delimiters.

Parameters
testerA method that determines whether the attribute should be returned/is relevant
Returns
A list of attributes for which the tester returns true on.

Definition at line 280 of file CubeAttribute.h.

◆ setAttribute()

template<typename ChildClass >
void Isis::CubeAttribute< ChildClass >::setAttribute ( QString newValue,
bool(ChildClass::*)(QString) const tester )
inlineprotected

Set the attribute(s) for which tester returns true to newValue.

If multiple attributes match (tester returns true on them), only the first one is preserved and it's value becomes newValue. Subsequent matching attributes are removed/deleted. This is done to simplify the resulting attribute string to be minimal with this particular attribute.

Parameters
newValueThe string to set the attribute to... tester(newValue) really ought to return true.
testerA method that determines if an attribute is of the same type of newValue, so that existing attributes can be overwritten.

Definition at line 305 of file CubeAttribute.h.

◆ setAttributes()

template<typename ChildClass >
void Isis::CubeAttribute< ChildClass >::setAttributes ( const FileName & fileName)
inline

Replaces the current attributes with the attributes in the given file name.

This will call addAttribute() for every attribute in the file name.

See also
FileName::attributes()
addAttributes(const char *)
Parameters
fileNameA file name with (or without) attributes on the end, for example FileName("out.cub+Bsq")

Definition at line 262 of file CubeAttribute.h.

References Isis::CubeAttribute< ChildClass >::addAttribute(), Isis::FileName::attributes(), and Isis::CubeAttribute< ChildClass >::m_attributes.

Referenced by Isis::CubeAttribute< ChildClass >::addAttributes(), and Isis::CubeAttribute< ChildClass >::CubeAttribute().

◆ toString()

template<typename ChildClass >
QString Isis::CubeAttribute< ChildClass >::toString ( ) const
inline

Return a string-representation of this cube attributes.

This will typically be exactl the string passed in if you used setAttributes(...). This can be an empty string ("") or if there are attributes then it will be +att1+att2+... The result of this method could be used to re-create this instance.

Returns
The cube attributes in string form

Definition at line 158 of file CubeAttribute.h.

References Isis::CubeAttribute< ChildClass >::m_attributes.

Referenced by Isis::CubeAttribute< ChildClass >::addAttributes().

Member Data Documentation

◆ m_attributes

template<typename ChildClass >
QStringList Isis::CubeAttribute< ChildClass >::m_attributes
private

These are the attributes that this cube attribute stores.

These attributes do not contain any delimiters, are not formatted and often are exactly what a user has typed in. Everything in this list will return true when given to exactly one of the testers.

Definition at line 339 of file CubeAttribute.h.

Referenced by Isis::CubeAttribute< ChildClass >::addAttribute(), Isis::CubeAttribute< ChildClass >::setAttributes(), and Isis::CubeAttribute< ChildClass >::toString().

◆ m_attributeTypeTesters

template<typename ChildClass >
QList< bool (ChildClass::*)(QString) const > Isis::CubeAttribute< ChildClass >::m_attributeTypeTesters
private

These testers determine if an attribute looks like a particular option.

For example, "Bsq" looks like a cube format so that tester would return true. However, the pixel type tester would return false. This is used to validate that every attribute looks like one and only one data type (is unambiguous and is known). This list will not change after this class is instantiated.

Definition at line 348 of file CubeAttribute.h.

Referenced by Isis::CubeAttribute< ChildClass >::addAttribute(), Isis::CubeAttribute< ChildClass >::CubeAttribute(), and Isis::CubeAttribute< ChildClass >::CubeAttribute().


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