Isis Developer Reference
Isis::ControlNetDiff Class Reference

Compares two Control Networks and reports their differences. More...

#include <ControlNetDiff.h>

Collaboration diagram for Isis::ControlNetDiff:
Collaboration graph

Public Member Functions

 ControlNetDiff ()
 Create a ControlNetDiff without any tolerances. More...
 
 ControlNetDiff (Pvl &diffFile)
 Create a ControlNetDiff with persistent tolerances. More...
 
virtual ~ControlNetDiff ()
 Destroy the ControlNetDiff. More...
 
void addTolerances (Pvl &diffFile)
 Add the given ignore keys and tolerances to the persisent collections of such values. More...
 
Pvl compare (FileName &net1Name, FileName &net2Name)
 Compare two Control Networks given their file names, and return their differences. More...
 

Protected Member Functions

void compare (PvlObject &point1Pvl, PvlObject &point2Pvl, PvlObject &report)
 Compare two Control Points stored as PvlObjects, and add any differences to the report object. More...
 
void compareGroups (PvlContainer &g1, PvlContainer &g2, PvlObject &report)
 Compare two collections, or groupings, of PvlKeywords. More...
 
void compare (PvlKeyword &k1, PvlKeyword &k2, PvlContainer &report)
 Compare two keywords and report the differences to the given report container. More...
 
void diff (QString name, PvlObject &o1, PvlObject &o2, PvlContainer &report)
 Add a new difference keyword to the given report if the PvlObjects have different values for the keyword with the given name. More...
 
void diff (QString name, QString v1, QString v2, PvlContainer &report)
 Add a new difference keyword to the given report if the two string are not equal. More...
 
PvlKeyword makeKeyword (QString name, QString v1, QString v2)
 Create a new keyword with the given label name and the given values. More...
 
void diff (QString name, double v1, double v2, double tol, PvlContainer &report)
 Add a new difference keyword to the given report if the two numerical values are not equal within the given tolerance. More...
 
PvlKeyword makeKeyword (QString name, double v1, double v2, double tol)
 Create a new keyword with the given label name and the given values. More...
 
void addUniquePoint (QString label, QString v1, QString v2, PvlObject &parent)
 Add a new keyword for the given point to the parent object. More...
 
void addUniqueMeasure (QString label, QString v1, QString v2, PvlObject &parent)
 Add a new keyword for the given measure to the parent object. More...
 

Detailed Description

Compares two Control Networks and reports their differences.

This class opens two Control Networks from Filenames and returns their differences as a PVL structure. It is generally stateless, able to compare multiple networks in succession without needing to reset anything. However, the tolerances that are added are persistent.

Differences will be reported as PvlKeywords with two to three values. The first value is from the first network, the second from the second network, and the third the failed tolerance (if provided). Control Point PVL Objects and Control Measure PVL Groups will only be reported if there are differences, or they appear in only one of the two networks. The number of points and measures will similarly only be reported if they differ. The tolerances are stored in a PVL structure containing an IgnoreKeys group with keywords to ignore completely, and a Tolerances group to ignore if the (numerical) values are different within the given tolerance.

Author
2012-04-25 Travis Addair

Constructor & Destructor Documentation

◆ ControlNetDiff() [1/2]

Isis::ControlNetDiff::ControlNetDiff ( )

Create a ControlNetDiff without any tolerances.

◆ ControlNetDiff() [2/2]

Isis::ControlNetDiff::ControlNetDiff ( Pvl diffFile)
explicit

Create a ControlNetDiff with persistent tolerances.

Parameters
diffFileThe PVL of ignore keywords and tolerance values

References addTolerances().

◆ ~ControlNetDiff()

Isis::ControlNetDiff::~ControlNetDiff ( )
virtual

Destroy the ControlNetDiff.

Does not own any passed-in data.

Member Function Documentation

◆ addTolerances()

void Isis::ControlNetDiff::addTolerances ( Pvl diffFile)

Add the given ignore keys and tolerances to the persisent collections of such values.

Does not clear any previously added ignore keys or tolerances. The DateTime keyword is always ignored

Parameters
diffFileThe PVL of ignore keywords and tolerance values

References Isis::PvlObject::findGroup(), Isis::PvlObject::hasGroup(), Isis::PvlContainer::keywords(), Isis::PvlContainer::name(), and Isis::toDouble().

Referenced by ControlNetDiff().

◆ addUniqueMeasure()

void Isis::ControlNetDiff::addUniqueMeasure ( QString  label,
QString  v1,
QString  v2,
PvlObject parent 
)
protected

Add a new keyword for the given measure to the parent object.

It is assumed that one of the two values provided represents a missing SerialNumber.

Parameters
nameThe label of the measure uniquely identifying it
v1The first measure's value for the unique label
v2The second measure's value for the unique label
parentContainer for the measure group

References Isis::PvlObject::addGroup(), Isis::PvlContainer::addKeyword(), and Isis::PvlKeyword::addValue().

Referenced by compare().

◆ addUniquePoint()

void Isis::ControlNetDiff::addUniquePoint ( QString  label,
QString  v1,
QString  v2,
PvlObject parent 
)
protected

Add a new keyword for the given point to the parent object.

It is assumed that one of the two values provided represents a missing PointId.

Parameters
nameThe label of the point uniquely identifying it
v1The first points's value for the unique label
v2The second points's value for the unique label
parentContainer for the point object

References Isis::PvlContainer::addKeyword(), Isis::PvlObject::addObject(), and Isis::PvlKeyword::addValue().

Referenced by compare().

◆ compare() [1/3]

Pvl Isis::ControlNetDiff::compare ( FileName net1Name,
FileName net2Name 
)

Compare two Control Networks given their file names, and return their differences.

Parameters
net1NameName of the first Control Network
net2NameName of the second Control Network
Returns
Pvl The collection of all differences

References Isis::PvlObject::addObject(), addUniquePoint(), diff(), Isis::PvlObject::findKeyword(), Isis::PvlObject::findObject(), Isis::FileName::name(), Isis::ControlNetVersioner::netId(), Isis::ControlNetVersioner::numPoints(), Isis::PvlObject::object(), Isis::ControlNetVersioner::targetName(), Isis::ControlNetVersioner::toPvl(), and Isis::toString().

Referenced by compareGroups().

◆ compare() [2/3]

void Isis::ControlNetDiff::compare ( PvlKeyword k1,
PvlKeyword k2,
PvlContainer report 
)
protected

Compare two keywords and report the differences to the given report container.

If a tolerance value exists for the keyword name, the difference will only be reported if the numerical difference magnitude between the values is greater than the tolerance. Otherwise, the keywords must have equal values. At present, only the first value of the keywords is compared. Keywords with multiple values are not considered, nor are their units.

Parameters
k1The first keyword
k2The second keyword
reportContainer for reporting all differences between these keywords

References diff(), Isis::PvlKeyword::name(), and Isis::toDouble().

◆ compare() [3/3]

void Isis::ControlNetDiff::compare ( PvlObject point1Pvl,
PvlObject point2Pvl,
PvlObject report 
)
protected

Compare two Control Points stored as PvlObjects, and add any differences to the report object.

A new Point object will only be added to the report if there were top-level point data differences or measure differences.

Parameters
point1PvlContainer for the first Control Point
point2PvlContainer for the second Control Point
reportContainer for reporting all differences between these points

References Isis::PvlContainer::addKeyword(), Isis::PvlObject::addObject(), addUniqueMeasure(), compareGroups(), diff(), Isis::PvlObject::findKeyword(), Isis::PvlContainer::findKeyword(), Isis::PvlObject::group(), Isis::PvlObject::groups(), Isis::PvlContainer::keywords(), makeKeyword(), and Isis::toString().

◆ compareGroups()

void Isis::ControlNetDiff::compareGroups ( PvlContainer g1,
PvlContainer g2,
PvlObject report 
)
protected

Compare two collections, or groupings, of PvlKeywords.

If the container has the keyword "SerialNumber", we assume it is a Control Measure, and thus create a PvlGroup to add to our report containing all the differences. Otherwise we add differences directly to the given report object. The measure PvlGroup will only be added if there are data differences.

Parameters
g1Container for the first keyword collection
g2Container for the second keyword collection
reportContainer for reporting all differences between these groupings

References Isis::PvlObject::addGroup(), Isis::PvlContainer::addKeyword(), compare(), diff(), Isis::PvlContainer::findKeyword(), Isis::PvlContainer::hasKeyword(), Isis::PvlContainer::keywords(), and makeKeyword().

Referenced by compare().

◆ diff() [1/3]

void Isis::ControlNetDiff::diff ( QString  name,
double  v1,
double  v2,
double  tol,
PvlContainer report 
)
protected

Add a new difference keyword to the given report if the two numerical values are not equal within the given tolerance.

The two values represent values of keywords to be directly compared. The first name string is the label of the keyword.

Parameters
nameThe label of the keyword whose values are being compared
v1The first keyword's value
v2The second keyword's value
tolThe tolerance to compare against the values
reportContainer for reporting differences between these values for the keyword with the given name

References Isis::PvlContainer::addKeyword(), and makeKeyword().

◆ diff() [2/3]

void Isis::ControlNetDiff::diff ( QString  name,
PvlObject o1,
PvlObject o2,
PvlContainer report 
)
protected

Add a new difference keyword to the given report if the PvlObjects have different values for the keyword with the given name.

Parameters
nameThe name of the keyword to be compared
o1The first object
o2The second object
reportContainer for reporting differences between these objects for the keyword with the given name

Referenced by compare(), and compareGroups().

◆ diff() [3/3]

void Isis::ControlNetDiff::diff ( QString  name,
QString  v1,
QString  v2,
PvlContainer report 
)
protected

Add a new difference keyword to the given report if the two string are not equal.

The two value strings represent values of keywords to be directly compared. The first name string is the label of the keyword.

Parameters
nameThe label of the keyword whose values are being compared
v1The first keyword's value
v2The second keyword's value
reportContainer for reporting differences between these values for the keyword with the given name

References Isis::PvlContainer::addKeyword(), and makeKeyword().

◆ makeKeyword() [1/2]

PvlKeyword Isis::ControlNetDiff::makeKeyword ( QString  name,
double  v1,
double  v2,
double  tol 
)
protected

Create a new keyword with the given label name and the given values.

If the two values are equal within the given tolerance, only add one of them to the keyword.

Parameters
nameThe label of the keyword whose values are being compared
v1The first keyword's value
v2The second keyword's value
tolThe tolerance to compare against the values
Returns
PvlKeyword Container for the two values

References Isis::PvlKeyword::addValue(), and Isis::toString().

◆ makeKeyword() [2/2]

PvlKeyword Isis::ControlNetDiff::makeKeyword ( QString  name,
QString  v1,
QString  v2 
)
protected

Create a new keyword with the given label name and the given values.

If the two values are equal, only add one of them to the keyword.

Parameters
nameThe label of the keyword whose values are being compared
v1The first keyword's value
v2The second keyword's value
Returns
PvlKeyword Container for the two values

References Isis::PvlKeyword::addValue().

Referenced by compare(), compareGroups(), and diff().


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