Isis 3 Programmer Reference
Isis::CubeAttributeInput Class Reference

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

#include <CubeAttribute.h>

Inheritance diagram for Isis::CubeAttributeInput:
Inheritance graph
Collaboration diagram for Isis::CubeAttributeInput:
Collaboration graph

Public Member Functions

 CubeAttributeInput ()
 Constructs an empty CubeAttributeInput. More...
 
 CubeAttributeInput (const FileName &fileName)
 Constructs a CubeAttributeInput and initialized it with the contents of the string parameter. More...
 
 ~CubeAttributeInput ()
 Destroys the object. More...
 
std::vector< QString > bands () const
 Return a vector of the input bands specified. More...
 
QString bandsString () const
 Return a string representation of all the bands. More...
 
void setBands (const std::vector< QString > &bands)
 Set the band attribute according to the list of bands. More...
 
QString toString () const
 Return a string-representation of this cube attributes. More...
 
void addAttribute (QString attribute)
 Add a single attribute to these attributes. More...
 
void addAttributes (const FileName &fileNameWithAtts)
 Append the attributes found in the filename to these cube attributes. More...
 
void addAttributes (const char *attributesString)
 Append the attributes in the string to these cube attributes. More...
 
void addAttributes (const QString &attributesString)
 Append the attributes in the string to these cube attributes. More...
 
void setAttributes (const FileName &fileName)
 Replaces the current attributes with the attributes in the given file name. More...
 

Protected Member Functions

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

Private Member Functions

bool isBandRange (QString attribute) const
 

Static Private Member Functions

static QString toString (const std::vector< QString > &bands)
 
static QList< bool(CubeAttributeInput::*)(QString) const > testers ()
 

Private Attributes

std::vector< QString > m_bands
 A list of the specified bands. More...
 

Detailed Description

Manipulate and parse attributes of input cube filenames.

This class provides parsing and manipulation of attributes associated with input cube filenames. Input cube filenames can have an attribute of "band(s) specification"

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

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

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

2006-01-05 Stuart Sides - Fixed bug when the input attribute was "+7-10". In this case the Write members were not putting the "+" at the beginning.

2012-07-02 Steven Lambright and Stuart Sides - Uses a refactored CubeAttribute parent class now. Updated to match current coding standards. Added safety checks for unrecognized attributes. References #961.

2018-07-27 Kaitlyn Lee - Added "+" in setBands() because without it, setAttributes() was skipping the list of band indices.

Definition at line 397 of file CubeAttribute.h.

Constructor & Destructor Documentation

◆ CubeAttributeInput() [1/2]

Isis::CubeAttributeInput::CubeAttributeInput ( )

Constructs an empty CubeAttributeInput.

Definition at line 41 of file CubeAttribute.cpp.

◆ CubeAttributeInput() [2/2]

Isis::CubeAttributeInput::CubeAttributeInput ( const FileName fileName)

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

The string is parsed to obtain any band specifiers. Any attribute information that is not valid for an input cube will throw an error.

Parameters
attThe attribute string to be parsed.

Definition at line 45 of file CubeAttribute.cpp.

◆ ~CubeAttributeInput()

Isis::CubeAttributeInput::~CubeAttributeInput ( )

Destroys the object.

Definition at line 50 of file CubeAttribute.cpp.

Member Function Documentation

◆ addAttribute()

void Isis::CubeAttribute< CubeAttributeInput >::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 194 of file CubeAttribute.h.

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

◆ addAttributes() [1/3]

void Isis::CubeAttribute< CubeAttributeInput >::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 238 of file CubeAttribute.h.

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

◆ addAttributes() [2/3]

void Isis::CubeAttribute< CubeAttributeInput >::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 251 of file CubeAttribute.h.

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

◆ addAttributes() [3/3]

void Isis::CubeAttribute< CubeAttributeInput >::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 264 of file CubeAttribute.h.

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

◆ attributeList()

QStringList Isis::CubeAttribute< CubeAttributeInput >::attributeList ( bool(CubeAttributeInput ::*)(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 296 of file CubeAttribute.h.

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

◆ bands()

vector< QString > Isis::CubeAttributeInput::bands ( ) const

Return a vector of the input bands specified.

Parse the string parameter and populate the private variable accordinly.

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

Definition at line 98 of file CubeAttribute.cpp.

References Isis::toInt(), Isis::CubeAttribute< CubeAttributeInput >::toString(), and Isis::toString().

Referenced by Isis::Workspace::addCubeViewport(), Isis::Workspace::addCubeViewportFromList(), bandsString(), Isis::CubeManager::OpenCube(), Isis::FileTool::saveAsReducedCube(), setBands(), and Isis::Process::SetInputCube().

◆ bandsString()

QString Isis::CubeAttributeInput::bandsString ( ) const

Return a string representation of all the bands.

History:
Stuart Sides 2005-01-2005 ???

Combines all the specified bands numbers into a single string with commas between each band number

Returns
A comma delimited string of all bands from the input attribute

Definition at line 128 of file CubeAttribute.cpp.

References bands(), and Isis::CubeAttribute< CubeAttributeInput >::toString().

◆ setAttribute()

void Isis::CubeAttribute< CubeAttributeInput >::setAttribute ( QString  newValue,
bool(CubeAttributeInput ::*)(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 321 of file CubeAttribute.h.

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

◆ setAttributes()

void Isis::CubeAttribute< CubeAttributeInput >::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 278 of file CubeAttribute.h.

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

Referenced by setBands().

◆ setBands()

void Isis::CubeAttributeInput::setBands ( const std::vector< QString > &  bands)

Set the band attribute according to the list of bands.

Definition at line 133 of file CubeAttribute.cpp.

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

◆ toString()

QString Isis::CubeAttribute< CubeAttributeInput >::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 174 of file CubeAttribute.h.

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

Referenced by bands(), bandsString(), and setBands().

Member Data Documentation

◆ m_bands

std::vector<QString> Isis::CubeAttributeInput::m_bands
private

A list of the specified bands.

Definition at line 449 of file CubeAttribute.h.


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