Isis 3 Programmer Reference
|
Compares two Control Networks and reports their differences. More...
#include <ControlNetDiff.h>
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... | |
Private Member Functions | |
void | init () |
Initialize the persistent structures used to maintain the state of this instance: its ignore keys and tolerances. More... | |
Private Attributes | |
QMap< QString, double > * | m_tolerances |
The map of tolerances going from keyword name to tolerance value. More... | |
QSet< QString > * | m_ignoreKeys |
The set of keywords to ignore by name. More... | |
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.
Definition at line 53 of file ControlNetDiff.h.
Isis::ControlNetDiff::ControlNetDiff | ( | ) |
Create a ControlNetDiff without any tolerances.
Definition at line 33 of file ControlNetDiff.cpp.
References init().
|
explicit |
Create a ControlNetDiff with persistent tolerances.
diffFile | The PVL of ignore keywords and tolerance values |
Definition at line 43 of file ControlNetDiff.cpp.
References addTolerances(), and init().
|
virtual |
Destroy the ControlNetDiff.
Does not own any passed-in data.
Definition at line 52 of file ControlNetDiff.cpp.
References m_ignoreKeys, and m_tolerances.
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
diffFile | The PVL of ignore keywords and tolerance values |
Definition at line 68 of file ControlNetDiff.cpp.
References Isis::PvlObject::findGroup(), Isis::PvlObject::hasGroup(), Isis::PvlContainer::keywords(), m_ignoreKeys, m_tolerances, Isis::PvlContainer::name(), and Isis::toDouble().
Referenced by ControlNetDiff().
|
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.
name | The label of the measure uniquely identifying it |
v1 | The first measure's value for the unique label |
v2 | The second measure's value for the unique label |
parent | Container for the measure group |
Definition at line 400 of file ControlNetDiff.cpp.
References Isis::PvlObject::addGroup(), Isis::PvlContainer::addKeyword(), and Isis::PvlKeyword::addValue().
Referenced by compare().
|
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.
name | The label of the point uniquely identifying it |
v1 | The first points's value for the unique label |
v2 | The second points's value for the unique label |
parent | Container for the point object |
Definition at line 378 of file ControlNetDiff.cpp.
References Isis::PvlContainer::addKeyword(), Isis::PvlObject::addObject(), and Isis::PvlKeyword::addValue().
Referenced by compare().
Compare two Control Networks given their file names, and return their differences.
Definition at line 92 of file ControlNetDiff.cpp.
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().
|
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.
k1 | The first keyword |
k2 | The second keyword |
report | Container for reporting all differences between these keywords |
Definition at line 266 of file ControlNetDiff.cpp.
References diff(), m_tolerances, Isis::PvlKeyword::name(), and Isis::toDouble().
|
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.
point1Pvl | Container for the first Control Point |
point2Pvl | Container for the second Control Point |
report | Container for reporting all differences between these points |
Definition at line 157 of file ControlNetDiff.cpp.
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().
|
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.
g1 | Container for the first keyword collection |
g2 | Container for the second keyword collection |
report | Container for reporting all differences between these groupings |
Definition at line 214 of file ControlNetDiff.cpp.
References Isis::PvlObject::addGroup(), Isis::PvlContainer::addKeyword(), compare(), diff(), Isis::PvlContainer::findKeyword(), Isis::PvlContainer::hasKeyword(), Isis::PvlContainer::keywords(), m_ignoreKeys, and makeKeyword().
Referenced by compare().
|
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.
name | The label of the keyword whose values are being compared |
v1 | The first keyword's value |
v2 | The second keyword's value |
tol | The tolerance to compare against the values |
report | Container for reporting differences between these values for the keyword with the given name |
Definition at line 340 of file ControlNetDiff.cpp.
References Isis::PvlContainer::addKeyword(), m_ignoreKeys, and makeKeyword().
|
protected |
Add a new difference keyword to the given report if the PvlObjects have different values for the keyword with the given name.
name | The name of the keyword to be compared |
o1 | The first object |
o2 | The second object |
report | Container for reporting differences between these objects for the keyword with the given name |
Definition at line 285 of file ControlNetDiff.cpp.
Referenced by compare(), and compareGroups().
|
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.
name | The label of the keyword whose values are being compared |
v1 | The first keyword's value |
v2 | The second keyword's value |
report | Container for reporting differences between these values for the keyword with the given name |
Definition at line 303 of file ControlNetDiff.cpp.
References Isis::PvlContainer::addKeyword(), m_ignoreKeys, and makeKeyword().
|
private |
Initialize the persistent structures used to maintain the state of this instance: its ignore keys and tolerances.
Automatically ignore the "DateTime" keyword.
Definition at line 417 of file ControlNetDiff.cpp.
References m_ignoreKeys, and m_tolerances.
Referenced by ControlNetDiff().
|
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.
name | The label of the keyword whose values are being compared |
v1 | The first keyword's value |
v2 | The second keyword's value |
tol | The tolerance to compare against the values |
Definition at line 358 of file ControlNetDiff.cpp.
References Isis::PvlKeyword::addValue(), and Isis::toString().
|
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.
name | The label of the keyword whose values are being compared |
v1 | The first keyword's value |
v2 | The second keyword's value |
Definition at line 319 of file ControlNetDiff.cpp.
References Isis::PvlKeyword::addValue().
Referenced by compare(), compareGroups(), and diff().
|
private |
The set of keywords to ignore by name.
Definition at line 87 of file ControlNetDiff.h.
Referenced by addTolerances(), compareGroups(), diff(), init(), and ~ControlNetDiff().
|
private |
The map of tolerances going from keyword name to tolerance value.
Definition at line 84 of file ControlNetDiff.h.
Referenced by addTolerances(), compare(), init(), and ~ControlNetDiff().