Loading isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.cpp +219 −25 Original line number Diff line number Diff line Loading @@ -28,6 +28,199 @@ using namespace std; namespace Isis { ControlNetVersioner::ControlNetVersioner(QSharedPointer<ControlNet> net) { } ControlNetVersioner::ControlNetVersioner(const FileName netFile) { } ControlNetVersioner::~ControlNetVersioner() { } QString ControlNetVersioner::netId() const{ } QString ControlNetVersioner::targetName() const{ } QString ControlNetVersioner::creationDate() const{ } QString ControlNetVersioner::lastModificationDate() const{ } QString ControlNetVersioner::description() const{ } QString ControlNetVersioner::userName() const{ } QSharedPointer<ControlPoint> ControlNetVersioner::takeFirstPoint(){ } void ControlNetVersioner::write(FileName netFile){ } Pvl &ControlNetVersioner::toPvl(){ } void ControlNetVersioner::read(const FileName netFile){ } void ControlNetVersioner::readPvl(const Pvl &network){ } void ControlNetVersioner::readPvlV0001(const Pvl &network){ } void ControlNetVersioner::readPvlV0002(const Pvl &network){ } void ControlNetVersioner::readPvlV0003(const Pvl &network){ } void ControlNetVersioner::readPvlV0004(const Pvl &network){ } void ControlNetVersioner::readProtobuf(const Pvl &header, const FileName netFile){ } void ControlNetVersioner::readProtobufV0001(const FileName netFile){ } void ControlNetVersioner::readProtobufV0002(const FileName netFile){ } void ControlNetVersioner::readProtobufV0007(const FileName netFile){ } QSharedPointer<ControlPoint> ControlNetVersioner::createPointFromV0001(const ControlPointV0001 point){ } QSharedPointer<ControlPoint> ControlNetVersioner::createPointFromV0002(const ControlPointV0002 point){ } QSharedPointer<ControlPoint> ControlNetVersioner::createPointFromV0003(const ControlPointV0003 point){ } QSharedPointer<ControlPoint> ControlNetVersioner::createPointFromV0004(const ControlPointV0004 point){ } QSharedPointer<ControlPoint> ControlNetVersioner::createPointFromV0005(const ControlPointV0005 point){ } QSharedPointer<ControlPoint> ControlNetVersioner::createPointFromV0006(const ControlPointV0006 point){ } QSharedPointer<ControlPoint> ControlNetVersioner::createPointFromV0007(const ControlPointV0007 point){ } void ControlNetVersioner::createHeaderFromV0001(const ControlNetHeaderV0001){ } void ControlNetVersioner::createHeaderFromV0002(const ControlNetHeaderV0002){ } void ControlNetVersioner::createHeaderFromV0003(const ControlNetHeaderV0003){ } void ControlNetVersioner::createHeaderFromV0004(const ControlNetHeaderV0004){ } void ControlNetVersioner::createHeaderFromV0005(const ControlNetHeaderV0005){ } void ControlNetVersioner::createHeaderFromV0006(const ControlNetHeaderV0006){ } void ControlNetVersioner::createHeaderFromV0007(const ControlNetHeaderV0007){ } void ControlNetVersioner::writeHeader(ZeroCopyInputStream *fileStream){ } void ControlNetVersioner::writeFirstPoint(ZeroCopyInputStream *fileStream){ } // ~~~~~~~~~~~~~~~ BEGIN OLD CONTROLNETVERSIONER CODE ~~~~~~~~~~~~~~~ #if 0 /** * 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 Loading Loading @@ -947,4 +1140,5 @@ namespace Isis { container.deleteKeyword(keyName); (measure.*set)(value); } #endif } isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.h +58 −61 Original line number Diff line number Diff line Loading @@ -25,14 +25,14 @@ #include <string> #include "ControlNetFile.h" #include "ControlNetFileV0002.pb.h" #include <QList> #include <QSharedPointer> #include "ControlPoint.h" class QString; namespace Isis { class ControlNetFileV0001; class ControlNetFileV0002; class FileName; class Progress; class Pvl; Loading Loading @@ -128,75 +128,72 @@ namespace Isis { * call. This was done to reduce redundancy since the original * message for this error was very similar to the caught exception * to which it is appended. References #3892 * @history 2017-12-11 Jeannie Backer & Jesse Mapel - Created class skeleton for refactor. */ class ControlNetVersioner { public: static LatestControlNetFile *Read(const FileName &file); static void Write(const FileName &file, const LatestControlNetFile &, bool pvl = false); private: // read Pvl and bring it up to the latest version, then convert to binary static LatestControlNetFile *ReadPvlNetwork(Pvl pvl); static LatestControlNetFile *LatestPvlToBinary(PvlObject &network); ControlNetVersioner(QSharedPointer<ControlNet> net); ControlNetVersioner(const FileName netFile); ~ControlNetVersioner(); // read Binary, convert to Pvl, call ReadPvlNetwork static LatestControlNetFile *ReadBinaryNetwork(const Pvl &header, const FileName &file); QString netId() const; QString targetName() const; QString creationDate() const; QString lastModificationDate() const; QString description() const; QString userName() const; static void ConvertVersion1ToVersion2(PvlObject &network); static void ConvertVersion2ToVersion3(PvlObject &network); static void ConvertVersion3ToVersion4(PvlObject &network); QSharedPointer<ControlPoint> takeFirstPoint(); // We only need the latest Pvl version because it has our update cycle //! The latest version of the Pvl formatted control networks static const int LATEST_PVL_VERSION = 4; //! The latest version of the Binary formatted control networks static const int LATEST_BINARY_VERSION = 2; void write(FileName netFile); Pvl &toPvl(); private: // helper methods for LatestPvlToBinary static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002 &point, void (ControlPointFileEntryV0002::*setter)(bool)); static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002 &point, void (ControlPointFileEntryV0002::*setter)(double)); static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002 &point, void (ControlPointFileEntryV0002::*setter)(const std::string&)); static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002::Measure &measure, void (ControlPointFileEntryV0002::Measure::*setter)(bool)); static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002::Measure &measure, void (ControlPointFileEntryV0002::Measure::*setter)(double)); static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002::Measure &measure, void (ControlPointFileEntryV0002::Measure::*setter) (const std::string &)); // This class is static, no instantiation allowed /** * The constructor is not implemented. */ // These three methods are private for safety reasons. // TODO write a better reason. JAM ControlNetVersioner(); /** * The constructor is not implemented so the copy constructor is * impossible. * * @param other The versioner to copy from */ ControlNetVersioner(const ControlNetVersioner &other); /** * The constructor is not implemented so assignment is impossible. * * @param other The versioner to copy from */ ControlNetVersioner &operator=(const ControlNetVersioner &other); void read(const FileName netFile); void readPvl(const Pvl &network); void readPvlV0001(const Pvl &network); void readPvlV0002(const Pvl &network); void readPvlV0003(const Pvl &network); void readPvlV0004(const Pvl &network); void readProtobuf(const Pvl &header, const FileName netFile); void readProtobufV0001(const FileName netFile); void readProtobufV0002(const FileName netFile); void readProtobufV0007(const FileName netFile); QSharedPointer<ControlPoint> createPointFromV0001(const ControlPointV0001 point); QSharedPointer<ControlPoint> createPointFromV0002(const ControlPointV0002 point); QSharedPointer<ControlPoint> createPointFromV0003(const ControlPointV0003 point); QSharedPointer<ControlPoint> createPointFromV0004(const ControlPointV0004 point); QSharedPointer<ControlPoint> createPointFromV0005(const ControlPointV0005 point); QSharedPointer<ControlPoint> createPointFromV0006(const ControlPointV0006 point); QSharedPointer<ControlPoint> createPointFromV0007(const ControlPointV0007 point); void createHeaderFromV0001(const ControlNetHeaderV0001); void createHeaderFromV0002(const ControlNetHeaderV0002); void createHeaderFromV0003(const ControlNetHeaderV0003); void createHeaderFromV0004(const ControlNetHeaderV0004); void createHeaderFromV0005(const ControlNetHeaderV0005); void createHeaderFromV0006(const ControlNetHeaderV0006); void createHeaderFromV0007(const ControlNetHeaderV0007); void writeHeader(ZeroCopyInputStream *fileStream); void writeFirstPoint(ZeroCopyInputStream *fileStream); ControlNetHeaderV0007 m_header; /**< Header containing information about the whole network.*/ QList< QSharedPointer<ControlPoint> > m_points; /**< ControlPoints that are read in from a file or ready to be written out to a file.*/ }; } #endif Loading
isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.cpp +219 −25 Original line number Diff line number Diff line Loading @@ -28,6 +28,199 @@ using namespace std; namespace Isis { ControlNetVersioner::ControlNetVersioner(QSharedPointer<ControlNet> net) { } ControlNetVersioner::ControlNetVersioner(const FileName netFile) { } ControlNetVersioner::~ControlNetVersioner() { } QString ControlNetVersioner::netId() const{ } QString ControlNetVersioner::targetName() const{ } QString ControlNetVersioner::creationDate() const{ } QString ControlNetVersioner::lastModificationDate() const{ } QString ControlNetVersioner::description() const{ } QString ControlNetVersioner::userName() const{ } QSharedPointer<ControlPoint> ControlNetVersioner::takeFirstPoint(){ } void ControlNetVersioner::write(FileName netFile){ } Pvl &ControlNetVersioner::toPvl(){ } void ControlNetVersioner::read(const FileName netFile){ } void ControlNetVersioner::readPvl(const Pvl &network){ } void ControlNetVersioner::readPvlV0001(const Pvl &network){ } void ControlNetVersioner::readPvlV0002(const Pvl &network){ } void ControlNetVersioner::readPvlV0003(const Pvl &network){ } void ControlNetVersioner::readPvlV0004(const Pvl &network){ } void ControlNetVersioner::readProtobuf(const Pvl &header, const FileName netFile){ } void ControlNetVersioner::readProtobufV0001(const FileName netFile){ } void ControlNetVersioner::readProtobufV0002(const FileName netFile){ } void ControlNetVersioner::readProtobufV0007(const FileName netFile){ } QSharedPointer<ControlPoint> ControlNetVersioner::createPointFromV0001(const ControlPointV0001 point){ } QSharedPointer<ControlPoint> ControlNetVersioner::createPointFromV0002(const ControlPointV0002 point){ } QSharedPointer<ControlPoint> ControlNetVersioner::createPointFromV0003(const ControlPointV0003 point){ } QSharedPointer<ControlPoint> ControlNetVersioner::createPointFromV0004(const ControlPointV0004 point){ } QSharedPointer<ControlPoint> ControlNetVersioner::createPointFromV0005(const ControlPointV0005 point){ } QSharedPointer<ControlPoint> ControlNetVersioner::createPointFromV0006(const ControlPointV0006 point){ } QSharedPointer<ControlPoint> ControlNetVersioner::createPointFromV0007(const ControlPointV0007 point){ } void ControlNetVersioner::createHeaderFromV0001(const ControlNetHeaderV0001){ } void ControlNetVersioner::createHeaderFromV0002(const ControlNetHeaderV0002){ } void ControlNetVersioner::createHeaderFromV0003(const ControlNetHeaderV0003){ } void ControlNetVersioner::createHeaderFromV0004(const ControlNetHeaderV0004){ } void ControlNetVersioner::createHeaderFromV0005(const ControlNetHeaderV0005){ } void ControlNetVersioner::createHeaderFromV0006(const ControlNetHeaderV0006){ } void ControlNetVersioner::createHeaderFromV0007(const ControlNetHeaderV0007){ } void ControlNetVersioner::writeHeader(ZeroCopyInputStream *fileStream){ } void ControlNetVersioner::writeFirstPoint(ZeroCopyInputStream *fileStream){ } // ~~~~~~~~~~~~~~~ BEGIN OLD CONTROLNETVERSIONER CODE ~~~~~~~~~~~~~~~ #if 0 /** * 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 Loading Loading @@ -947,4 +1140,5 @@ namespace Isis { container.deleteKeyword(keyName); (measure.*set)(value); } #endif }
isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.h +58 −61 Original line number Diff line number Diff line Loading @@ -25,14 +25,14 @@ #include <string> #include "ControlNetFile.h" #include "ControlNetFileV0002.pb.h" #include <QList> #include <QSharedPointer> #include "ControlPoint.h" class QString; namespace Isis { class ControlNetFileV0001; class ControlNetFileV0002; class FileName; class Progress; class Pvl; Loading Loading @@ -128,75 +128,72 @@ namespace Isis { * call. This was done to reduce redundancy since the original * message for this error was very similar to the caught exception * to which it is appended. References #3892 * @history 2017-12-11 Jeannie Backer & Jesse Mapel - Created class skeleton for refactor. */ class ControlNetVersioner { public: static LatestControlNetFile *Read(const FileName &file); static void Write(const FileName &file, const LatestControlNetFile &, bool pvl = false); private: // read Pvl and bring it up to the latest version, then convert to binary static LatestControlNetFile *ReadPvlNetwork(Pvl pvl); static LatestControlNetFile *LatestPvlToBinary(PvlObject &network); ControlNetVersioner(QSharedPointer<ControlNet> net); ControlNetVersioner(const FileName netFile); ~ControlNetVersioner(); // read Binary, convert to Pvl, call ReadPvlNetwork static LatestControlNetFile *ReadBinaryNetwork(const Pvl &header, const FileName &file); QString netId() const; QString targetName() const; QString creationDate() const; QString lastModificationDate() const; QString description() const; QString userName() const; static void ConvertVersion1ToVersion2(PvlObject &network); static void ConvertVersion2ToVersion3(PvlObject &network); static void ConvertVersion3ToVersion4(PvlObject &network); QSharedPointer<ControlPoint> takeFirstPoint(); // We only need the latest Pvl version because it has our update cycle //! The latest version of the Pvl formatted control networks static const int LATEST_PVL_VERSION = 4; //! The latest version of the Binary formatted control networks static const int LATEST_BINARY_VERSION = 2; void write(FileName netFile); Pvl &toPvl(); private: // helper methods for LatestPvlToBinary static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002 &point, void (ControlPointFileEntryV0002::*setter)(bool)); static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002 &point, void (ControlPointFileEntryV0002::*setter)(double)); static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002 &point, void (ControlPointFileEntryV0002::*setter)(const std::string&)); static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002::Measure &measure, void (ControlPointFileEntryV0002::Measure::*setter)(bool)); static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002::Measure &measure, void (ControlPointFileEntryV0002::Measure::*setter)(double)); static void Copy(PvlContainer &container, QString keyName, ControlPointFileEntryV0002::Measure &measure, void (ControlPointFileEntryV0002::Measure::*setter) (const std::string &)); // This class is static, no instantiation allowed /** * The constructor is not implemented. */ // These three methods are private for safety reasons. // TODO write a better reason. JAM ControlNetVersioner(); /** * The constructor is not implemented so the copy constructor is * impossible. * * @param other The versioner to copy from */ ControlNetVersioner(const ControlNetVersioner &other); /** * The constructor is not implemented so assignment is impossible. * * @param other The versioner to copy from */ ControlNetVersioner &operator=(const ControlNetVersioner &other); void read(const FileName netFile); void readPvl(const Pvl &network); void readPvlV0001(const Pvl &network); void readPvlV0002(const Pvl &network); void readPvlV0003(const Pvl &network); void readPvlV0004(const Pvl &network); void readProtobuf(const Pvl &header, const FileName netFile); void readProtobufV0001(const FileName netFile); void readProtobufV0002(const FileName netFile); void readProtobufV0007(const FileName netFile); QSharedPointer<ControlPoint> createPointFromV0001(const ControlPointV0001 point); QSharedPointer<ControlPoint> createPointFromV0002(const ControlPointV0002 point); QSharedPointer<ControlPoint> createPointFromV0003(const ControlPointV0003 point); QSharedPointer<ControlPoint> createPointFromV0004(const ControlPointV0004 point); QSharedPointer<ControlPoint> createPointFromV0005(const ControlPointV0005 point); QSharedPointer<ControlPoint> createPointFromV0006(const ControlPointV0006 point); QSharedPointer<ControlPoint> createPointFromV0007(const ControlPointV0007 point); void createHeaderFromV0001(const ControlNetHeaderV0001); void createHeaderFromV0002(const ControlNetHeaderV0002); void createHeaderFromV0003(const ControlNetHeaderV0003); void createHeaderFromV0004(const ControlNetHeaderV0004); void createHeaderFromV0005(const ControlNetHeaderV0005); void createHeaderFromV0006(const ControlNetHeaderV0006); void createHeaderFromV0007(const ControlNetHeaderV0007); void writeHeader(ZeroCopyInputStream *fileStream); void writeFirstPoint(ZeroCopyInputStream *fileStream); ControlNetHeaderV0007 m_header; /**< Header containing information about the whole network.*/ QList< QSharedPointer<ControlPoint> > m_points; /**< ControlPoints that are read in from a file or ready to be written out to a file.*/ }; } #endif