USGS

Isis 3.0 Developer's Reference (API)

Home

Isis::ControlNetVersioner Class Reference

Handle Various Control Network Versions. More...

#include <ControlNetVersioner.h>

Static Public Member Functions

static LatestControlNetFileRead (const FileName &file)
 Read the control network from disk.
 
static void Write (const FileName &file, const LatestControlNetFile &, bool pvl=false)
 This will write a control net file object to disk.
 

Detailed Description

Handle Various Control Network Versions.

This class is used to read any and all control networks.

All publicly released versions of binary control networks should be supported if possible.

                  ControlNetVersioner::Read
                 /                         \
             [If Pvl]                    [If Binary]
               /                             \
           Pvl::Read                         |
              |          [If not latest]     |
       Update To Latest <-- ToPvl --- ControlNetFileV????::Read
              |                              |  [If latest]
              |                              |
          Latest Pvl  ------------> Latest ControlNetFile
                                             |
                                             |
                                      Isis::ControlNet

We used to have the 4 conversions: Pvl -> Isis::ControlNet Binary -> Isis::ControlNet Pvl <- Isis::ControlNet Binary <- Isis::ControlNet

But maintaining these causes us to need the old ControlNet code around. These conversions are used instead: Pvl -> Binary *Latest version only Binary -> Pvl *All versions Binary -> Isis::ControlNet *Latest version only Binary <- Isis::ControlNet *Latest version only

The log data classes are still used to understand what log data is what, so these classes must remain backwards compatible. Otherwise all of the versioning code is here. I encourage the use of log data to avoid needing to make any changes in this code.

The reason the update cycle is only in Pvl form is because of how much simpler and less error-prone the code is to convert between versions in a generic file format. You don't need to do things like new.setNetworkId(old.getNetworkId()) in Pvl. Hopefully the speed cost is not significant enough to need an update cycle in binary form. It is a one-time cost per network, timed at about 5 minutes for our currently largest network (120MB protocol buffer file).

This class is the reason Isis::ControlNet only need to work with the latest version. Also, we only need 1-way conversions for old file formats (ControlNetFile::ToPvl).

If you want to change the Pvl format, you must update the following: Update LATEST_PVL_VERSION Write ConvertVersionAToVersionB Update ReadPvlNetwork Update LatestPvlToBinary

If you want to change the Binary format, you must update the following: Update LATEST_BINARY_VERSION Write ControlNetFileV???? Update ControlNetFile.h Update ReadBinaryNetwork Update LatestPvlToBinary

Author
2011-04-05 Steven Lambright

Member Function Documentation

LatestControlNetFile * Isis::ControlNetVersioner::Read ( const FileName networkFileName)
static

Read the control network from disk.

This will always return the network in its "latest version" binary form. Generally this will only be called by ControlNet but a conversion from binary to pvl can make use out of this also.

Parameters
networkFileNameThe filename of the cnet to be read

References _FILEINFO_, Isis::FileName::expanded(), and Isis::FileName::name().

Referenced by Isis::ControlNetDiff::compare().

void Isis::ControlNetVersioner::Write ( const FileName file,
const LatestControlNetFile fileData,
bool  pvl = false 
)
static

This will write a control net file object to disk.

Parameters
filefile The output filename that will be written to
fileDataThe ControlNetFile representation to write
pvlTrue if the output format should be Pvl, false if not

References Isis::FileName::expanded(), Isis::ControlNetFileV0002::toPvl(), Isis::ControlNetFileV0002::Write(), and Isis::Pvl::write().


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