Isis 3 Programmer Reference
Isis::PvlSequence Class Reference

Parse and return elements of a Pvl sequence. More...

#include <PvlSequence.h>

Collaboration diagram for Isis::PvlSequence:
Collaboration graph

Public Member Functions

 PvlSequence ()
 Construct an empty sequence.
 
 ~PvlSequence ()
 Destruct sequence.
 
PvlSequenceoperator= (PvlKeyword &key)
 Load a sequence using a Pvl keyword.
 
PvlSequenceoperator+= (const QString &array)
 Add a string array to the sequence.
 
PvlSequenceoperator+= (std::vector< QString > &array)
 Add a vector of strings to the sequence.
 
PvlSequenceoperator+= (std::vector< int > &array)
 Add a vector of ints to the sequence.
 
PvlSequenceoperator+= (std::vector< double > &array)
 Add a vector of ints to the sequence.
 
std::vector< QString > & operator[] (int i)
 Return the ith Array of the sequence.
 
int Size () const
 Number of arrays in the sequence.
 
void Clear ()
 Clear the sequence.
 

Private Attributes

std::vector< std::vector< QString > > p_sequence
 A vector of Strings that contains the values for the keyword.
 

Detailed Description

Parse and return elements of a Pvl sequence.

A Pvl sequence is essentially an array of arrays. For example,

Keyword = ((a,b,c), (d,e))

To extract the invidual arrays from a PvlKeyword you must use a PvlSequence.

Here is an example of how to use PvlSequence

k += "(a,b,c)";
k += "(d,e)";
cout << s.Size() << endl; // should be 2
cout << s[0][0] << endl; // should be a
cout << s[1][1] << endl; // should be e
A single keyword-value pair.
Definition PvlKeyword.h:87
Parse and return elements of a Pvl sequence.
Definition PvlSequence.h:46
int Size() const
Number of arrays in the sequence.
Definition PvlSequence.h:70
Author
2005-02-16 Jeff Anderson
Todo
Add PvlSequence(PvlKeyword) constructor so that we can code PvlSequence s = k; where k is a PvlKeyword.

Definition at line 46 of file PvlSequence.h.

Constructor & Destructor Documentation

◆ PvlSequence()

Isis::PvlSequence::PvlSequence ( )
inline

Construct an empty sequence.

Definition at line 49 of file PvlSequence.h.

◆ ~PvlSequence()

Isis::PvlSequence::~PvlSequence ( )
inline

Destruct sequence.

Definition at line 52 of file PvlSequence.h.

Member Function Documentation

◆ Clear()

void Isis::PvlSequence::Clear ( )
inline

Clear the sequence.

Definition at line 75 of file PvlSequence.h.

References p_sequence.

◆ operator+=() [1/4]

PvlSequence & Isis::PvlSequence::operator+= ( const QString & array)

Add a string array to the sequence.

The values in the string must be enclosed in parens and comma separated. For example, (1,2,3).

Parameters
arrayA string representing an array.

Definition at line 39 of file PvlSequence.cpp.

References p_sequence, and Isis::PvlKeyword::size().

Referenced by operator=().

◆ operator+=() [2/4]

PvlSequence & Isis::PvlSequence::operator+= ( std::vector< double > & array)

Add a vector of ints to the sequence.

This adds another array to the sequence whose values are all doubles.

Parameters
arrayvector of doubles

Definition at line 89 of file PvlSequence.cpp.

References p_sequence, and Isis::toString().

◆ operator+=() [3/4]

PvlSequence & Isis::PvlSequence::operator+= ( std::vector< int > & array)

Add a vector of ints to the sequence.

This adds another array to the sequence whose values are all integers.

Parameters
arrayvector of integers

Definition at line 74 of file PvlSequence.cpp.

References p_sequence, and Isis::toString().

◆ operator+=() [4/4]

PvlSequence & Isis::PvlSequence::operator+= ( std::vector< QString > & array)

Add a vector of strings to the sequence.

This adds another array to the sequence whose values are all strings

Parameters
arrayvector of strings

Definition at line 59 of file PvlSequence.cpp.

References p_sequence.

◆ operator=()

PvlSequence & Isis::PvlSequence::operator= ( PvlKeyword & key)

Load a sequence using a Pvl keyword.

Each value of the PvlKeyword will be treated as an array for a sequence. Typically, the values in the PvlKeyword should be enclosed in parens and comma separated. For example, (a,b,c).

Parameters
keykeyword containing sequence

Definition at line 25 of file PvlSequence.cpp.

References operator+=(), and Isis::PvlKeyword::size().

◆ operator[]()

std::vector< QString > & Isis::PvlSequence::operator[] ( int i)
inline

Return the ith Array of the sequence.

Definition at line 65 of file PvlSequence.h.

References p_sequence.

◆ Size()

int Isis::PvlSequence::Size ( ) const
inline

Number of arrays in the sequence.

Definition at line 70 of file PvlSequence.h.

References p_sequence.

Member Data Documentation

◆ p_sequence

std::vector<std::vector<QString> > Isis::PvlSequence::p_sequence
private

A vector of Strings that contains the values for the keyword.

Definition at line 80 of file PvlSequence.h.

Referenced by Clear(), operator+=(), operator+=(), operator+=(), operator+=(), operator[](), and Size().


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