Isis 3 Programmer Reference
Isis::CubeAttributeOutput Class Reference

Manipulate and parse attributes of output cube filenames. More...

#include <CubeAttribute.h>

Inheritance diagram for Isis::CubeAttributeOutput:
Inheritance graph
Collaboration diagram for Isis::CubeAttributeOutput:
Collaboration graph

Public Member Functions

 CubeAttributeOutput ()
 Constructs an empty CubeAttributeOutput.
 
 CubeAttributeOutput (const FileName &fileName)
 Constructs a CubeAttributeOutput and initialized it with the contents of the string parameter.
 
 ~CubeAttributeOutput ()
 Destroys the object.
 
bool propagatePixelType () const
 Return true if the pixel type is to be propagated from an input cube.
 
bool propagateMinimumMaximum () const
 Return true if the min/max are to be propagated from an input cube.
 
Cube::Format fileFormat () const
 Return the file format an Cube::Format.
 
QString fileFormatString () const
 Return the file format as a string.
 
void setFileFormat (Cube::Format fmt)
 Set the format to the fmt parameter.
 
ByteOrder byteOrder () const
 Return the byte order as an Isis::ByteOrder.
 
QString byteOrderString () const
 Return the byte order as a string.
 
void setByteOrder (ByteOrder order)
 Set the order according to the parameter order.
 
double minimum () const
 Return the output cube attribute minimum.
 
double maximum () const
 Return the output cube attribute maximum.
 
void setMinimum (double min)
 Set the output cube attribute minimum.
 
void setMaximum (double max)
 Set the output cube attribute maximum.
 
PixelType pixelType () const
 Return the pixel type as an Isis::PixelType.
 
void setPixelType (PixelType type)
 Set the pixel type to that given by the parameter.
 
void setLabelAttachment (LabelAttachment attachment)
 Set the label attachment type to the parameter value.
 
LabelAttachment labelAttachment () const
 
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 Types

enum  RangeType { PropagateRange , RangeSet }
 Output cube range tracker. More...
 

Private Member Functions

bool isByteOrder (QString attribute) const
 
bool isFileFormat (QString attribute) const
 
bool isLabelAttachment (QString attribute) const
 
bool isPixelType (QString attribute) const
 
bool isRange (QString attribute) const
 

Static Private Member Functions

static QString toString (Cube::Format)
 
static QList< bool(CubeAttributeOutput::*)(QString) const > testers ()
 

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

Manipulate and parse attributes of output cube filenames.

This class provides parsing and manipulation of attributes associated with output cube filenames. Output cube filenames can have an attributes of "minimum:maximum", "pixel type", "file format", "byte order", and "label placement"

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

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 - Uses a refactored CubeAttribute parent class now. Updated to match current coding standards. Added the "+External+ attribute. Added safety checks for unrecognized attributes. References #961.

2018-07-27 Kaitlyn Lee - Added unsigned/signed integer handling.

Definition at line 473 of file CubeAttribute.h.

Member Enumeration Documentation

◆ RangeType

Output cube range tracker.

This enumeration and its functions are for the output range of a cube.

Enumerator
PropagateRange 

Propagate the range from an input cube.

RangeSet 

The range has been set.

Definition at line 564 of file CubeAttribute.h.

Constructor & Destructor Documentation

◆ CubeAttributeOutput() [1/2]

Isis::CubeAttributeOutput::CubeAttributeOutput ( )

Constructs an empty CubeAttributeOutput.

Definition at line 152 of file CubeAttribute.cpp.

◆ CubeAttributeOutput() [2/2]

Isis::CubeAttributeOutput::CubeAttributeOutput ( const FileName & fileName)

Constructs a CubeAttributeOutput and initialized it with the contents of the string parameter.

The string is parased to obtain any min/max, pixel type, byte order, file format or label placement. Any attribute information that is not valie for an output cube will throw an error.

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

Definition at line 156 of file CubeAttribute.cpp.

◆ ~CubeAttributeOutput()

Isis::CubeAttributeOutput::~CubeAttributeOutput ( )

Destroys the object.

Definition at line 161 of file CubeAttribute.cpp.

Member Function Documentation

◆ addAttribute()

void Isis::CubeAttribute< CubeAttributeOutput >::addAttribute ( QString attribute)
inlineinherited

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.

◆ addAttributes() [1/3]

void Isis::CubeAttribute< CubeAttributeOutput >::addAttributes ( const char * attributesString)
inlineinherited

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.

◆ addAttributes() [2/3]

void Isis::CubeAttribute< CubeAttributeOutput >::addAttributes ( const FileName & fileNameWithAtts)
inlineinherited

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.

◆ addAttributes() [3/3]

void Isis::CubeAttribute< CubeAttributeOutput >::addAttributes ( const QString & attributesString)
inlineinherited

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.

◆ attributeList()

QStringList Isis::CubeAttribute< CubeAttributeOutput >::attributeList ( bool(ChildClass::*)(QString) const tester) const
inlineprotectedinherited

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.

◆ byteOrder()

ByteOrder Isis::CubeAttributeOutput::byteOrder ( ) const

Return the byte order as an Isis::ByteOrder.

Definition at line 455 of file CubeAttribute.cpp.

References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), and Isis::IsLsb().

Referenced by byteOrderString().

◆ byteOrderString()

QString Isis::CubeAttributeOutput::byteOrderString ( ) const

Return the byte order as a string.

Definition at line 469 of file CubeAttribute.cpp.

References byteOrder().

◆ fileFormat()

Cube::Format Isis::CubeAttributeOutput::fileFormat ( ) const

Return the file format an Cube::Format.

Definition at line 267 of file CubeAttribute.cpp.

References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), Isis::Cube::Bsq, and Isis::Cube::Tile.

Referenced by fileFormatString().

◆ fileFormatString()

QString Isis::CubeAttributeOutput::fileFormatString ( ) const

Return the file format as a string.

Definition at line 283 of file CubeAttribute.cpp.

References fileFormat(), and Isis::CubeAttribute< CubeAttributeOutput >::toString().

◆ isByteOrder()

bool Isis::CubeAttributeOutput::isByteOrder ( QString attribute) const
private

Definition at line 417 of file CubeAttribute.cpp.

◆ isFileFormat()

bool Isis::CubeAttributeOutput::isFileFormat ( QString attribute) const
private

Definition at line 422 of file CubeAttribute.cpp.

◆ isLabelAttachment()

bool Isis::CubeAttributeOutput::isLabelAttachment ( QString attribute) const
private

Definition at line 427 of file CubeAttribute.cpp.

◆ isPixelType()

bool Isis::CubeAttributeOutput::isPixelType ( QString attribute) const
private

Definition at line 432 of file CubeAttribute.cpp.

◆ isRange()

bool Isis::CubeAttributeOutput::isRange ( QString attribute) const
private

Definition at line 440 of file CubeAttribute.cpp.

◆ labelAttachment()

LabelAttachment Isis::CubeAttributeOutput::labelAttachment ( ) const

Definition at line 400 of file CubeAttribute.cpp.

◆ maximum()

double Isis::CubeAttributeOutput::maximum ( ) const

Return the output cube attribute maximum.

Definition at line 309 of file CubeAttribute.cpp.

References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), Isis::Null, propagateMinimumMaximum(), and Isis::toDouble().

Referenced by setMinimum().

◆ minimum()

double Isis::CubeAttributeOutput::minimum ( ) const

Return the output cube attribute minimum.

Definition at line 294 of file CubeAttribute.cpp.

References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), Isis::Null, propagateMinimumMaximum(), and Isis::toDouble().

Referenced by setMaximum().

◆ pixelType()

PixelType Isis::CubeAttributeOutput::pixelType ( ) const

Return the pixel type as an Isis::PixelType.

Definition at line 360 of file CubeAttribute.cpp.

References Isis::CubeAttribute< CubeAttributeOutput >::attributeList(), and propagatePixelType().

◆ propagateMinimumMaximum()

bool Isis::CubeAttributeOutput::propagateMinimumMaximum ( ) const

Return true if the min/max are to be propagated from an input cube.

Definition at line 177 of file CubeAttribute.cpp.

References Isis::CubeAttribute< CubeAttributeOutput >::attributeList().

Referenced by maximum(), and minimum().

◆ propagatePixelType()

bool Isis::CubeAttributeOutput::propagatePixelType ( ) const

Return true if the pixel type is to be propagated from an input cube.

Definition at line 165 of file CubeAttribute.cpp.

References Isis::CubeAttribute< CubeAttributeOutput >::attributeList().

Referenced by pixelType().

◆ setAttribute()

void Isis::CubeAttribute< CubeAttributeOutput >::setAttribute ( QString newValue,
bool(ChildClass::*)(QString) const tester )
inlineprotectedinherited

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()

void Isis::CubeAttribute< CubeAttributeOutput >::setAttributes ( const FileName & fileName)
inlineinherited

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.

◆ setByteOrder()

void Isis::CubeAttributeOutput::setByteOrder ( ByteOrder order)

Set the order according to the parameter order.

Definition at line 474 of file CubeAttribute.cpp.

References Isis::CubeAttribute< CubeAttributeOutput >::setAttribute().

◆ setFileFormat()

void Isis::CubeAttributeOutput::setFileFormat ( Cube::Format fmt)

Set the format to the fmt parameter.

Definition at line 288 of file CubeAttribute.cpp.

References Isis::CubeAttribute< CubeAttributeOutput >::setAttribute(), and Isis::Cube::Tile.

◆ setLabelAttachment()

void Isis::CubeAttributeOutput::setLabelAttachment ( LabelAttachment attachment)

Set the label attachment type to the parameter value.

Definition at line 395 of file CubeAttribute.cpp.

References Isis::LabelAttachmentName(), and Isis::CubeAttribute< CubeAttributeOutput >::setAttribute().

◆ setMaximum()

void Isis::CubeAttributeOutput::setMaximum ( double max)

Set the output cube attribute maximum.

Definition at line 342 of file CubeAttribute.cpp.

References Isis::IsSpecial(), minimum(), Isis::CubeAttribute< CubeAttributeOutput >::setAttribute(), and Isis::toString().

◆ setMinimum()

void Isis::CubeAttributeOutput::setMinimum ( double min)

Set the output cube attribute minimum.

Definition at line 324 of file CubeAttribute.cpp.

References Isis::IsSpecial(), maximum(), Isis::CubeAttribute< CubeAttributeOutput >::setAttribute(), and Isis::toString().

◆ setPixelType()

void Isis::CubeAttributeOutput::setPixelType ( PixelType type)

Set the pixel type to that given by the parameter.

Definition at line 390 of file CubeAttribute.cpp.

References Isis::PixelTypeName(), and Isis::CubeAttribute< CubeAttributeOutput >::setAttribute().

◆ testers()

QList< bool(CubeAttributeOutput::*)(QString) const > Isis::CubeAttributeOutput::testers ( )
staticprivate

Definition at line 480 of file CubeAttribute.cpp.

◆ toString() [1/2]

QString Isis::CubeAttribute< CubeAttributeOutput >::toString ( ) const
inlineinherited

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.

◆ toString() [2/2]

QString Isis::CubeAttributeOutput::toString ( Cube::Format format)
staticprivate

Definition at line 445 of file CubeAttribute.cpp.

Member Data Documentation

◆ m_attributes

QStringList Isis::CubeAttribute< CubeAttributeOutput >::m_attributes
privateinherited

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.

◆ m_attributeTypeTesters

QList< bool (ChildClass::*)(QString) const > Isis::CubeAttribute< CubeAttributeOutput >::m_attributeTypeTesters
privateinherited

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.


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