diff --git a/GeoModelIO/TFPersistification/TFPersistification/ACosIO.h b/GeoModelIO/TFPersistification/TFPersistification/ACosIO.h index 9c0c574c2c2291ea22ef982f0eb827818bf81aef..603bc762b887e8bed0716b803ca729375634b353 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/ACosIO.h +++ b/GeoModelIO/TFPersistification/TFPersistification/ACosIO.h @@ -11,7 +11,7 @@ class ACosReader: public GenFunctionReader { public: ACosReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData=nullptr) const; }; diff --git a/GeoModelIO/TFPersistification/TFPersistification/ASinIO.h b/GeoModelIO/TFPersistification/TFPersistification/ASinIO.h index dedc5ff8ac9ac1e5b109288eff77044df9a0484a..ea620489229aa83bb1d241edc6df298b10cc52d9 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/ASinIO.h +++ b/GeoModelIO/TFPersistification/TFPersistification/ASinIO.h @@ -10,7 +10,7 @@ class ASinReader: public GenFunctionReader { public: ASinReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData=nullptr) const; }; diff --git a/GeoModelIO/TFPersistification/TFPersistification/ATanIO.h b/GeoModelIO/TFPersistification/TFPersistification/ATanIO.h index 526d8b66f727fafa4021f065833179e1db9a98b0..094ecc6910a821b4d9933ee8041497c4d6567d8b 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/ATanIO.h +++ b/GeoModelIO/TFPersistification/TFPersistification/ATanIO.h @@ -10,7 +10,7 @@ class ATanReader: public GenFunctionReader { public: ATanReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData=nullptr) const; }; diff --git a/GeoModelIO/TFPersistification/TFPersistification/AbsIO.h b/GeoModelIO/TFPersistification/TFPersistification/AbsIO.h index 09b351c5c6257a134a3ac169dee572d3715ec794..c8e71c3d0db45e479ec89eef81a797b379d95c28 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/AbsIO.h +++ b/GeoModelIO/TFPersistification/TFPersistification/AbsIO.h @@ -10,7 +10,7 @@ class AbsReader: public GenFunctionReader { public: AbsReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *) const; }; diff --git a/GeoModelIO/TFPersistification/TFPersistification/ArrayFunctionIO.h b/GeoModelIO/TFPersistification/TFPersistification/ArrayFunctionIO.h index f5ff56c25d5085abcbbb3371dd16a0c81a377426..5ebaf1d8e0c7c653e08720e974b1faf875afecb8 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/ArrayFunctionIO.h +++ b/GeoModelIO/TFPersistification/TFPersistification/ArrayFunctionIO.h @@ -10,7 +10,7 @@ class ArrayFunctionReader: public GenFunctionReader { public: ArrayFunctionReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData) const; }; diff --git a/GeoModelIO/TFPersistification/TFPersistification/CosIO.h b/GeoModelIO/TFPersistification/TFPersistification/CosIO.h index b507f13e17a63f9aac4b84b3c94d672ecc790719..a91e3a86543e845a0aba61176d9bc1f9bbd130c9 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/CosIO.h +++ b/GeoModelIO/TFPersistification/TFPersistification/CosIO.h @@ -11,7 +11,7 @@ class CosReader: public GenFunctionReader { public: CosReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData=nullptr) const; }; diff --git a/GeoModelIO/TFPersistification/TFPersistification/FixedConstantIO.h b/GeoModelIO/TFPersistification/TFPersistification/FixedConstantIO.h index 84ecbe10e6f6eb23a671b9256eb22e6eee1fe426..1bed916385c8e83618c0625ea7d15ce1a761d1de 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/FixedConstantIO.h +++ b/GeoModelIO/TFPersistification/TFPersistification/FixedConstantIO.h @@ -10,7 +10,7 @@ class FixedConstantReader: public GenFunctionReader { public: FixedConstantReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData) const; }; diff --git a/GeoModelIO/TFPersistification/TFPersistification/GenFunctionInterpreter.h b/GeoModelIO/TFPersistification/TFPersistification/GenFunctionInterpreter.h index de38528620ed660061abe44be12e1dc6a750745d..356dcb969332baa5c5469ec5b73ae78df3e24b77 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/GenFunctionInterpreter.h +++ b/GeoModelIO/TFPersistification/TFPersistification/GenFunctionInterpreter.h @@ -5,7 +5,7 @@ #include <typeinfo> #include <sstream> #include <memory> - +#include <deque> // // Forward definition of "Genfunction" // @@ -35,8 +35,11 @@ class GenFunctionInterpreter { // Interprets a string. GFPTR interpret(std::string::const_iterator begin, - std::string::const_iterator end ) const; + std::string::const_iterator end, + std::deque<double> *fpData=nullptr) const; + + private: // Store the actual interpreters, map them into the type name diff --git a/GeoModelIO/TFPersistification/TFPersistification/GenFunctionPersistifier.h b/GeoModelIO/TFPersistification/TFPersistification/GenFunctionPersistifier.h index 0a6629c89d62ac2dae8305aa42ea343bda8c0a4a..9a857c74afb44e353d5437ed15d5b0d1a33f9a9c 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/GenFunctionPersistifier.h +++ b/GeoModelIO/TFPersistification/TFPersistification/GenFunctionPersistifier.h @@ -4,7 +4,7 @@ #include <string> #include <typeinfo> #include <sstream> - +#include <deque> // // Forward declaration of GeoGenfun::AbsFunction // @@ -40,14 +40,19 @@ class GenFunctionPersistifier { // Retrieves the stream used to build the expression: std::ostringstream & getStream() const; - private: + // Retreive floating point data + std::deque<double> & getFloatingPointData() const; + +private: // Store the actual recorders, map them into the type name std::map<std::string, const GenFunctionRecorder *> recorderMap; // Here is the result: - mutable std::string codedString; + mutable std::string codedString; + mutable std::deque<double> floatingPointData; + // An ostringstream is used to build the coded string: mutable std::ostringstream *stream; diff --git a/GeoModelIO/TFPersistification/TFPersistification/GenFunctionReader.h b/GeoModelIO/TFPersistification/TFPersistification/GenFunctionReader.h index 18183d62a9ac3fc63e1b25789eb8c0dec1e68df3..a1fdb2f8938fb481125ad281c23427d0fad38f0d 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/GenFunctionReader.h +++ b/GeoModelIO/TFPersistification/TFPersistification/GenFunctionReader.h @@ -26,7 +26,7 @@ class GenFunctionReader { virtual ~GenFunctionReader(); // Execute - virtual GFPTR execute(std::string::const_iterator , std::string::const_iterator) const=0; + virtual GFPTR execute(std::string::const_iterator , std::string::const_iterator, std::deque<double> *fpData=nullptr) const=0; // Access to the interpreter: const GenFunctionInterpreter *getInterpreter() const; diff --git a/GeoModelIO/TFPersistification/TFPersistification/GenfunIO.h b/GeoModelIO/TFPersistification/TFPersistification/GenfunIO.h index 05f8e41f51915cdebf69044288ed19b196f81b04..fae8b60b2e82433bc7c546c270e103825cae38d0 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/GenfunIO.h +++ b/GeoModelIO/TFPersistification/TFPersistification/GenfunIO.h @@ -10,7 +10,7 @@ class ConstTimesFunctionReader: public GenFunctionReader { public: ConstTimesFunctionReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end ) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData=nullptr ) const; }; @@ -29,7 +29,7 @@ class ConstPlusFunctionReader: public GenFunctionReader { public: ConstPlusFunctionReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end ) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData=nullptr ) const; }; @@ -48,7 +48,7 @@ class ConstMinusFunctionReader: public GenFunctionReader { public: ConstMinusFunctionReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end ) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData=nullptr ) const; }; @@ -67,7 +67,7 @@ class ConstOverFunctionReader: public GenFunctionReader { public: ConstOverFunctionReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end ) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData=nullptr ) const; }; @@ -87,7 +87,7 @@ class FunctionCompositionReader: public GenFunctionReader { public: FunctionCompositionReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end ) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData ) const; }; @@ -107,7 +107,7 @@ class FunctionNegationReader: public GenFunctionReader { public: FunctionNegationReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end ) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData ) const; }; @@ -126,7 +126,7 @@ class FunctionNoopReader: public GenFunctionReader { public: FunctionNoopReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end ) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData ) const; }; @@ -145,7 +145,7 @@ class FunctionProductReader: public GenFunctionReader { public: FunctionProductReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end ) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData ) const; }; @@ -164,7 +164,7 @@ class FunctionQuotientReader: public GenFunctionReader { public: FunctionQuotientReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end ) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData ) const; }; @@ -184,7 +184,7 @@ class FunctionSumReader: public GenFunctionReader { public: FunctionSumReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end ) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData ) const; }; @@ -203,7 +203,7 @@ class FunctionDifferenceReader: public GenFunctionReader { public: FunctionDifferenceReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end ) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData ) const; }; @@ -223,7 +223,7 @@ class VariableReader: public GenFunctionReader { public: VariableReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData=nullptr) const; }; diff --git a/GeoModelIO/TFPersistification/TFPersistification/ModIO.h b/GeoModelIO/TFPersistification/TFPersistification/ModIO.h index cec3e1057b3a64f977d9066018782159e40fd69e..bb30523f417af79a38ef6dc479ec18a8e4a51cd8 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/ModIO.h +++ b/GeoModelIO/TFPersistification/TFPersistification/ModIO.h @@ -11,7 +11,7 @@ class ModReader: public GenFunctionReader { public: ModReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData) const; }; diff --git a/GeoModelIO/TFPersistification/TFPersistification/RectangularIO.h b/GeoModelIO/TFPersistification/TFPersistification/RectangularIO.h index dd68430562e09e9dc6b0f25e43589aaaa1d2baaf..3d9beef9ac8bb6949917ca19c2ee7c455c58a5dd 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/RectangularIO.h +++ b/GeoModelIO/TFPersistification/TFPersistification/RectangularIO.h @@ -11,7 +11,7 @@ class RectangularReader: public GenFunctionReader { public: RectangularReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData) const; }; diff --git a/GeoModelIO/TFPersistification/TFPersistification/SinIO.h b/GeoModelIO/TFPersistification/TFPersistification/SinIO.h index 02990ca51672d08ea3647ec8a205d5cd19f86c1c..ffaed09d7193caeec450c5d42f78f5cb7a8e8d57 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/SinIO.h +++ b/GeoModelIO/TFPersistification/TFPersistification/SinIO.h @@ -12,7 +12,7 @@ class SinReader: public GenFunctionReader { public: SinReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData=nullptr) const; }; diff --git a/GeoModelIO/TFPersistification/TFPersistification/SqrtIO.h b/GeoModelIO/TFPersistification/TFPersistification/SqrtIO.h index 7c7f9ecc09d82be0cf4428472fcfa0f1574fe42d..a30e3bed9332ac00ef75af75dee8bf649833f29c 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/SqrtIO.h +++ b/GeoModelIO/TFPersistification/TFPersistification/SqrtIO.h @@ -11,7 +11,7 @@ class SqrtReader: public GenFunctionReader { public: SqrtReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData=nullptr) const; }; diff --git a/GeoModelIO/TFPersistification/TFPersistification/SquareIO.h b/GeoModelIO/TFPersistification/TFPersistification/SquareIO.h index 082a62c3e5201fd6806196b861a593de6ae31d08..35471b6814c74192fca6f3203d473e2e2e82870b 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/SquareIO.h +++ b/GeoModelIO/TFPersistification/TFPersistification/SquareIO.h @@ -11,7 +11,7 @@ class SquareReader: public GenFunctionReader { public: SquareReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData=nullptr) const; }; diff --git a/GeoModelIO/TFPersistification/TFPersistification/TanIO.h b/GeoModelIO/TFPersistification/TFPersistification/TanIO.h index 5d1dcf59667be1cbb2760d242bae27f93b123ae2..7d65621da2d84dddf3bb1c9667e7aa285a8b04f0 100644 --- a/GeoModelIO/TFPersistification/TFPersistification/TanIO.h +++ b/GeoModelIO/TFPersistification/TFPersistification/TanIO.h @@ -11,7 +11,7 @@ class TanReader: public GenFunctionReader { public: TanReader(GenFunctionInterpreter * interpreter); - virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end) const; + virtual GFPTR execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData=nullptr) const; }; diff --git a/GeoModelIO/TFPersistification/src/ACosIO.cpp b/GeoModelIO/TFPersistification/src/ACosIO.cpp index 6679930302c4d300017e137305a1c45c670158f2..74b487fdc4e581d61419767a3f93a22c00b0df6f 100644 --- a/GeoModelIO/TFPersistification/src/ACosIO.cpp +++ b/GeoModelIO/TFPersistification/src/ACosIO.cpp @@ -7,7 +7,7 @@ ACosReader::ACosReader(GenFunctionInterpreter *interpreter):GenFunctionReader("ACos", interpreter) {} -GFPTR ACosReader::execute(std::string::const_iterator, std::string::const_iterator ) const { +GFPTR ACosReader::execute(std::string::const_iterator, std::string::const_iterator, std::deque<double> * ) const { return GFPTR(new GeoGenfun::ACos()); } diff --git a/GeoModelIO/TFPersistification/src/ASinIO.cpp b/GeoModelIO/TFPersistification/src/ASinIO.cpp index c4a2e0c14543473dcbf9669a6546c7925d94457b..d67ccd6136dce31cb4aecece228ccc1cd4443406 100644 --- a/GeoModelIO/TFPersistification/src/ASinIO.cpp +++ b/GeoModelIO/TFPersistification/src/ASinIO.cpp @@ -7,7 +7,7 @@ ASinReader::ASinReader(GenFunctionInterpreter *interpreter):GenFunctionReader("ASin", interpreter) {} -GFPTR ASinReader::execute(std::string::const_iterator, std::string::const_iterator ) const { +GFPTR ASinReader::execute(std::string::const_iterator, std::string::const_iterator, std::deque<double> * ) const { return GFPTR(new GeoGenfun::ASin()); } diff --git a/GeoModelIO/TFPersistification/src/ATanIO.cpp b/GeoModelIO/TFPersistification/src/ATanIO.cpp index 33df878f45ba9167f4d356dea3ba9c03690d11fd..fcd94ee130cec51227c9c39856dca3183a83e84f 100644 --- a/GeoModelIO/TFPersistification/src/ATanIO.cpp +++ b/GeoModelIO/TFPersistification/src/ATanIO.cpp @@ -7,7 +7,7 @@ ATanReader::ATanReader(GenFunctionInterpreter *interpreter):GenFunctionReader("ATan", interpreter) {} -GFPTR ATanReader::execute(std::string::const_iterator, std::string::const_iterator ) const { +GFPTR ATanReader::execute(std::string::const_iterator, std::string::const_iterator, std::deque<double> * ) const { return GFPTR(new GeoGenfun::ATan()); } diff --git a/GeoModelIO/TFPersistification/src/AbsIO.cpp b/GeoModelIO/TFPersistification/src/AbsIO.cpp index cb8039fca032ba61f3b57ab5e1861f3913b2252c..50e2dd4886384aeb122fc82bb905d9eadbca9b4f 100644 --- a/GeoModelIO/TFPersistification/src/AbsIO.cpp +++ b/GeoModelIO/TFPersistification/src/AbsIO.cpp @@ -7,7 +7,7 @@ AbsReader::AbsReader(GenFunctionInterpreter *interpreter):GenFunctionReader("Abs", interpreter) {} -GFPTR AbsReader::execute(std::string::const_iterator, std::string::const_iterator) const { +GFPTR AbsReader::execute(std::string::const_iterator, std::string::const_iterator, std::deque<double> *fpData=nullptr) const { return GFPTR(new GeoGenfun::Abs()); } diff --git a/GeoModelIO/TFPersistification/src/ArrayFunctionIO.cpp b/GeoModelIO/TFPersistification/src/ArrayFunctionIO.cpp index de725f013fb49377823ecc5826a3260fe6d80407..78de2456c14f6f9d4ccadc9a83a83c050a16f1c4 100644 --- a/GeoModelIO/TFPersistification/src/ArrayFunctionIO.cpp +++ b/GeoModelIO/TFPersistification/src/ArrayFunctionIO.cpp @@ -2,27 +2,23 @@ #include "TFPersistification/GenFunctionPersistifier.h" #include "TFPersistification/GenFunctionInterpreter.h" #include "TFPersistification/ArrayFunctionIO.h" +#include <algorithm> ArrayFunctionReader::ArrayFunctionReader(GenFunctionInterpreter *interpreter):GenFunctionReader("ArrayFunction", interpreter) {} -GFPTR ArrayFunctionReader::execute(std::string::const_iterator cStart, std::string::const_iterator cEnd) const { +GFPTR ArrayFunctionReader::execute(std::string::const_iterator cStart, std::string::const_iterator cEnd, std::deque<double> *fpData) const { + std::string aNumberStr(cStart,cEnd); + std::istringstream stream(aNumberStr); + std::string real; + unsigned int len; + stream >> real >> len; + if (real != "REAL" || !stream) { + throw std::runtime_error ("Parse error in ArrayFunctionReader"); + } std::vector<double> elements; - auto cNext=std::find(cStart, cEnd,','); - while (cNext!=cEnd) { - std::string aNumberStr(cStart,cNext); - std::istringstream stream(aNumberStr); - double d; - stream >> d; - elements.push_back(d); - cStart=cNext+1; - cNext=std::find(cStart, cEnd,','); + for (int i=0;i<len;i++) { + elements.push_back(fpData->back()); fpData->pop_back(); } - - std::string aNumberStr(cStart,cNext); - std::istringstream stream(aNumberStr); - double d; - stream >> d; - elements.push_back(d); return GFPTR(new GeoGenfun::ArrayFunction(&elements.front(), &elements.back() + 1)); } @@ -36,10 +32,8 @@ void ArrayFunctionRecorder::execute(const GeoGenfun::AbsFunction & F) const { if (!ptr) throw std::runtime_error("Error in ArrayFunctionRecorder:: wrong function type"); std::ostringstream & stream = getPersistifier()->getStream(); stream << "ArrayFunction"; - stream << "("; - for (size_t i=0;i<ptr->values().size();i++){ - stream<<ptr->values()[i]; - if (i!=ptr->values().size()-1) stream << ","; - } + stream << "(REAL "; + stream << ptr->values().size(); stream << ")"; + std::copy(ptr->values().begin(), ptr->values().end(), std::front_inserter(getPersistifier()->getFloatingPointData())); } diff --git a/GeoModelIO/TFPersistification/src/CosIO.cpp b/GeoModelIO/TFPersistification/src/CosIO.cpp index 15c055a8991f5f632cfe03e6d9ffcb0d850fdd0e..cec81c4eae1efef2940ed0cc442239a71fad8dd1 100644 --- a/GeoModelIO/TFPersistification/src/CosIO.cpp +++ b/GeoModelIO/TFPersistification/src/CosIO.cpp @@ -7,7 +7,7 @@ CosReader::CosReader(GenFunctionInterpreter *interpreter):GenFunctionReader("Cos",interpreter) {} -GFPTR CosReader::execute(std::string::const_iterator, std::string::const_iterator ) const { +GFPTR CosReader::execute(std::string::const_iterator, std::string::const_iterator, std::deque<double> * ) const { return GFPTR(new GeoGenfun::Cos()); } diff --git a/GeoModelIO/TFPersistification/src/FixedConstantIO.cpp b/GeoModelIO/TFPersistification/src/FixedConstantIO.cpp index 22d5474999eacaea9f4b94865e00314e39d99a86..a366719c03d9069e61a520f366588e79bc1307db 100644 --- a/GeoModelIO/TFPersistification/src/FixedConstantIO.cpp +++ b/GeoModelIO/TFPersistification/src/FixedConstantIO.cpp @@ -5,11 +5,12 @@ FixedConstantReader::FixedConstantReader(GenFunctionInterpreter *interpreter):GenFunctionReader("FixedConstant", interpreter) {} -GFPTR FixedConstantReader::execute(std::string::const_iterator begin, std::string::const_iterator end) const { - double v; +GFPTR FixedConstantReader::execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData) const { std::string aNumberStr(begin,end); - std::istringstream stream(aNumberStr); - stream >> v; + if (aNumberStr!="REAL") { + throw std::runtime_error ("Parse error in FixedConstantReader"); + } + double v=fpData->back();fpData->pop_back(); return GFPTR(new GeoGenfun::FixedConstant(v)); } @@ -21,8 +22,7 @@ void FixedConstantRecorder::execute(const GeoGenfun::AbsFunction & F) const { const GeoGenfun::FixedConstant * ptr = dynamic_cast<const GeoGenfun::FixedConstant *> (&F); if (!ptr) throw std::runtime_error("Error in FixedConstantRecorder:: wrong function type"); std::ostringstream & stream = getPersistifier()->getStream(); + getPersistifier()->getFloatingPointData().push_front((*ptr)(0)); stream << "FixedConstant"; - stream << "("; - stream<< (*ptr) (0); - stream << ")"; + stream << "(REAL)"; } diff --git a/GeoModelIO/TFPersistification/src/GenFunctionInterpreter.cpp b/GeoModelIO/TFPersistification/src/GenFunctionInterpreter.cpp index f0d16e7667e1042f47a39c28232891cd3ab310f5..2468ebb8b3aeb5e355fb21b62197f38d5233d265 100644 --- a/GeoModelIO/TFPersistification/src/GenFunctionInterpreter.cpp +++ b/GeoModelIO/TFPersistification/src/GenFunctionInterpreter.cpp @@ -59,7 +59,8 @@ void GenFunctionInterpreter::add(const std::string & str, const GenFunctionReade } -GFPTR GenFunctionInterpreter::interpret(std::string::const_iterator sBegin, std::string::const_iterator sEnd) const { +GFPTR GenFunctionInterpreter::interpret(std::string::const_iterator sBegin, std::string::const_iterator sEnd, + std::deque<double> * fpData) const { auto begin=std::find(sBegin, sEnd, '('); std::reverse_iterator<std::string::const_iterator> rBegin(sEnd); @@ -77,7 +78,7 @@ GFPTR GenFunctionInterpreter::interpret(std::string::const_iterator sBegin, std: throw std::runtime_error (stream.str()); } const GenFunctionReader *reader = (*rIter).second; - return reader->execute(begin,begin);//exec w/null expression + return reader->execute(begin,begin,fpData);//exec w/null expression } std::string op(sBegin,begin); auto argBegin=begin+1, argEnd=end-1; @@ -88,5 +89,5 @@ GFPTR GenFunctionInterpreter::interpret(std::string::const_iterator sBegin, std: throw std::runtime_error (stream.str()); } const GenFunctionReader *reader = (*rIter).second; - return reader->execute(argBegin,argEnd); + return reader->execute(argBegin,argEnd,fpData); } diff --git a/GeoModelIO/TFPersistification/src/GenFunctionPersistifier.cpp b/GeoModelIO/TFPersistification/src/GenFunctionPersistifier.cpp index a0853724802a4114253db1d6b8951245e5c55361..20077bd4d70ee792f855ce1499327d4d056c9033 100644 --- a/GeoModelIO/TFPersistification/src/GenFunctionPersistifier.cpp +++ b/GeoModelIO/TFPersistification/src/GenFunctionPersistifier.cpp @@ -20,6 +20,7 @@ #include <sstream> #include <iomanip> + const std::string & GenFunctionPersistifier::getCodedString() const { codedString=getStream().str(); delete stream; @@ -27,6 +28,10 @@ const std::string & GenFunctionPersistifier::getCodedString() const { return codedString; } +std::deque<double> & GenFunctionPersistifier::getFloatingPointData() const { + return floatingPointData; +} + GenFunctionPersistifier::~GenFunctionPersistifier() { delete stream; diff --git a/GeoModelIO/TFPersistification/src/GenfunIO.cpp b/GeoModelIO/TFPersistification/src/GenfunIO.cpp index 748c88c63dd15576c0c8e63bc5f10710902b5c57..1a4a129dde9a284a9fcf7cfa0b9476e978bdac77 100644 --- a/GeoModelIO/TFPersistification/src/GenfunIO.cpp +++ b/GeoModelIO/TFPersistification/src/GenfunIO.cpp @@ -2,27 +2,20 @@ #include "TFPersistification/GenFunctionInterpreter.h" #include "TFPersistification/GenFunctionPersistifier.h" #include "TFPersistification/GenfunIO.h" - #include "GeoGenericFunctions/Variable.h" - +#include <stdexcept> #include <sstream> ConstTimesFunctionReader::ConstTimesFunctionReader(GenFunctionInterpreter *interpreter):GenFunctionReader("ConstTimesFunction", interpreter) {} -inline double atof(std::string::const_iterator begin, std::string::const_iterator end) { - - std::string atom(begin,end); - std::istringstream stream(atom); - double x=0; - stream >> x; - return x; +GFPTR ConstTimesFunctionReader::execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData) const { + std::string::const_iterator sep=split(begin,end); + double c=fpData->back(); fpData->pop_back(); //Was: atof(begin,sep); + if (std::string(begin,sep)!="REAL") { + throw std::runtime_error ("Parse error in ConstTimesFunctionReader"); + } -} - -GFPTR ConstTimesFunctionReader::execute(std::string::const_iterator begin, std::string::const_iterator end) const { - auto sep=split(begin,end); - double c=atof(begin,sep); - return GFPTR(new GeoGenfun::ConstTimesFunction(c,getInterpreter()->interpret(sep+1,end).get())); + return GFPTR(new GeoGenfun::ConstTimesFunction(c,getInterpreter()->interpret(sep+1,end,fpData).get())); } @@ -34,8 +27,9 @@ void ConstTimesFunctionRecorder::execute(const GeoGenfun::AbsFunction & F) const if (!ptr) throw std::runtime_error("Error in ConstTimesFunctionRecorder:: wrong function type"); std::ostringstream & stream = getPersistifier()->getStream(); double c1=ptr->_constant; + getPersistifier()->getFloatingPointData().push_front(c1); stream << "ConstTimesFunction" << "("; - stream << c1; + stream << "REAL"; stream << ","; getPersistifier()->persistify(*ptr->_arg); stream << ")"; @@ -44,10 +38,13 @@ void ConstTimesFunctionRecorder::execute(const GeoGenfun::AbsFunction & F) const ConstPlusFunctionReader::ConstPlusFunctionReader(GenFunctionInterpreter *interpreter):GenFunctionReader("ConstPlusFunction", interpreter) {} -GFPTR ConstPlusFunctionReader::execute(std::string::const_iterator begin, std::string::const_iterator end ) const { +GFPTR ConstPlusFunctionReader::execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData ) const { auto sep=split(begin, end); - double c=atof(begin,sep); - return GFPTR(new GeoGenfun::ConstPlusFunction(c,getInterpreter()->interpret(sep+1,end).get())); + double c=fpData->back(); fpData->pop_back(); //Was: atof(begin,sep); + if (std::string(begin,sep)!="REAL") { + throw std::runtime_error ("Parse error in ConstPlusFunctionReader"); + } + return GFPTR(new GeoGenfun::ConstPlusFunction(c,getInterpreter()->interpret(sep+1,end,fpData).get())); } ConstPlusFunctionRecorder::ConstPlusFunctionRecorder(GenFunctionPersistifier *persistifier): @@ -58,8 +55,9 @@ void ConstPlusFunctionRecorder::execute(const GeoGenfun::AbsFunction & F) const if (!ptr) throw std::runtime_error("Error in ConstPlusFunctionRecorder:: wrong function type"); std::ostringstream & stream = getPersistifier()->getStream(); double c1=ptr->_constant; + getPersistifier()->getFloatingPointData().push_front(c1); stream << "ConstPlusFunction" << "("; - stream << c1; + stream << "REAL"; stream << ","; getPersistifier()->persistify(*ptr->_arg); stream << ")"; @@ -68,10 +66,13 @@ void ConstPlusFunctionRecorder::execute(const GeoGenfun::AbsFunction & F) const ConstMinusFunctionReader::ConstMinusFunctionReader(GenFunctionInterpreter *interpreter):GenFunctionReader("ConstMinusFunction", interpreter) {} -GFPTR ConstMinusFunctionReader::execute(std::string::const_iterator begin, std::string::const_iterator end ) const { +GFPTR ConstMinusFunctionReader::execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData ) const { auto sep=split(begin,end); - double c=atof(begin,sep); - return GFPTR(new GeoGenfun::ConstMinusFunction(c,getInterpreter()->interpret(sep+1,end).get())); + double c=fpData->back(); fpData->pop_back(); //Was: atof(begin,sep); + if (std::string(begin,sep)!="REAL") { + throw std::runtime_error ("Parse error in ConstMinusFunctionReader"); + } + return GFPTR(new GeoGenfun::ConstMinusFunction(c,getInterpreter()->interpret(sep+1,end,fpData).get())); } ConstMinusFunctionRecorder::ConstMinusFunctionRecorder(GenFunctionPersistifier *persistifier): @@ -82,8 +83,9 @@ void ConstMinusFunctionRecorder::execute(const GeoGenfun::AbsFunction & F) const if (!ptr) throw std::runtime_error("Error in ConstMinusFunctionRecorder:: wrong function type"); std::ostringstream & stream = getPersistifier()->getStream(); double c1=ptr->_constant; + getPersistifier()->getFloatingPointData().push_front(c1); stream << "ConstMinusFunction" << "("; - stream << c1; + stream << "REAL"; stream << ","; getPersistifier()->persistify(*ptr->_arg); stream << ")"; @@ -92,10 +94,13 @@ void ConstMinusFunctionRecorder::execute(const GeoGenfun::AbsFunction & F) const ConstOverFunctionReader::ConstOverFunctionReader(GenFunctionInterpreter *interpreter):GenFunctionReader("ConstOverFunction", interpreter) {} -GFPTR ConstOverFunctionReader::execute(std::string::const_iterator begin, std::string::const_iterator end ) const { +GFPTR ConstOverFunctionReader::execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData ) const { auto sep=split(begin,end); - double c=atof(begin,sep); - return GFPTR(new GeoGenfun::ConstOverFunction(c,getInterpreter()->interpret(sep+1,end).get())); + double c=fpData->back(); fpData->pop_back(); //Was: atof(begin,sep); + if (std::string(begin,sep)!="REAL") { + throw std::runtime_error ("Parse error in ConstOverFunctionReader"); + } + return GFPTR(new GeoGenfun::ConstOverFunction(c,getInterpreter()->interpret(sep+1,end,fpData).get())); } ConstOverFunctionRecorder::ConstOverFunctionRecorder(GenFunctionPersistifier *persistifier): @@ -106,8 +111,9 @@ void ConstOverFunctionRecorder::execute(const GeoGenfun::AbsFunction & F) const if (!ptr) throw std::runtime_error("Error in ConstOverFunctionRecorder:: wrong function type"); std::ostringstream & stream = getPersistifier()->getStream(); double c1=ptr->_constant; + getPersistifier()->getFloatingPointData().push_front(c1); stream << "ConstOverFunction" << "("; - stream << c1; + stream << "REAL"; stream << ","; getPersistifier()->persistify(*ptr->_arg); stream << ")"; @@ -116,9 +122,12 @@ void ConstOverFunctionRecorder::execute(const GeoGenfun::AbsFunction & F) const FunctionCompositionReader::FunctionCompositionReader(GenFunctionInterpreter *interpreter):GenFunctionReader("FunctionComposition", interpreter) {} -GFPTR FunctionCompositionReader::execute(std::string::const_iterator begin, std::string::const_iterator end ) const { +GFPTR FunctionCompositionReader::execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData ) const { auto sep=split(begin,end); - return GFPTR(new GeoGenfun::FunctionComposition(getInterpreter()->interpret(begin,sep).get(),getInterpreter()->interpret(sep+1,end).get())); + GFPTR f1=getInterpreter()->interpret(begin,sep,fpData); + GFPTR f2=getInterpreter()->interpret(sep+1,end,fpData); + + return GFPTR(new GeoGenfun::FunctionComposition(f1.get(),f2.get())); } FunctionCompositionRecorder::FunctionCompositionRecorder(GenFunctionPersistifier *persistifier): @@ -138,8 +147,8 @@ void FunctionCompositionRecorder::execute(const GeoGenfun::AbsFunction & F) cons FunctionNegationReader::FunctionNegationReader(GenFunctionInterpreter *interpreter):GenFunctionReader("FunctionNegation",interpreter) {} -GFPTR FunctionNegationReader::execute(std::string::const_iterator begin, std::string::const_iterator end ) const { - return GFPTR(new GeoGenfun::FunctionNegation(getInterpreter()->interpret(begin,end).get())); +GFPTR FunctionNegationReader::execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData ) const { + return GFPTR(new GeoGenfun::FunctionNegation(getInterpreter()->interpret(begin,end,fpData).get())); } FunctionNegationRecorder::FunctionNegationRecorder(GenFunctionPersistifier *persistifier): @@ -157,8 +166,8 @@ void FunctionNegationRecorder::execute(const GeoGenfun::AbsFunction & F) const { FunctionNoopReader::FunctionNoopReader(GenFunctionInterpreter *interpreter):GenFunctionReader("FunctionNoop",interpreter) {} -GFPTR FunctionNoopReader::execute(std::string::const_iterator begin, std::string::const_iterator end ) const { - return GFPTR(new GeoGenfun::FunctionNoop(getInterpreter()->interpret(begin,end).get())); +GFPTR FunctionNoopReader::execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData ) const { + return GFPTR(new GeoGenfun::FunctionNoop(getInterpreter()->interpret(begin,end,fpData).get())); } FunctionNoopRecorder::FunctionNoopRecorder(GenFunctionPersistifier *persistifier): @@ -176,9 +185,11 @@ void FunctionNoopRecorder::execute(const GeoGenfun::AbsFunction & F) const { FunctionProductReader::FunctionProductReader(GenFunctionInterpreter *interpreter):GenFunctionReader("FunctionProduct",interpreter) {} -GFPTR FunctionProductReader::execute(std::string::const_iterator begin, std::string::const_iterator end ) const { +GFPTR FunctionProductReader::execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData ) const { auto sep=split(begin,end); - return GFPTR(new GeoGenfun::FunctionProduct(getInterpreter()->interpret(begin,sep).get(),getInterpreter()->interpret(sep+1,end).get())); + GFPTR f1=getInterpreter()->interpret(begin,sep,fpData); + GFPTR f2=getInterpreter()->interpret(sep+1,end,fpData); + return GFPTR(new GeoGenfun::FunctionProduct(f1.get(),f2.get())); } FunctionProductRecorder::FunctionProductRecorder(GenFunctionPersistifier *persistifier): @@ -198,9 +209,11 @@ void FunctionProductRecorder::execute(const GeoGenfun::AbsFunction & F) const { FunctionSumReader::FunctionSumReader(GenFunctionInterpreter *interpreter):GenFunctionReader("FunctionSum",interpreter) {} -GFPTR FunctionSumReader::execute(std::string::const_iterator begin, std::string::const_iterator end ) const { +GFPTR FunctionSumReader::execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData ) const { auto sep=split(begin,end); - return GFPTR(new GeoGenfun::FunctionSum(getInterpreter()->interpret(begin,sep).get(),getInterpreter()->interpret(sep+1,end).get())); + GFPTR f1=getInterpreter()->interpret(begin,sep,fpData); + GFPTR f2=getInterpreter()->interpret(sep+1,end,fpData); + return GFPTR(new GeoGenfun::FunctionSum(f1.get(),f2.get())); } FunctionSumRecorder::FunctionSumRecorder(GenFunctionPersistifier *persistifier): @@ -225,9 +238,11 @@ void FunctionSumRecorder::execute(const GeoGenfun::AbsFunction & F) const { FunctionQuotientReader::FunctionQuotientReader(GenFunctionInterpreter *interpreter):GenFunctionReader("FunctionQuotient",interpreter) {} -GFPTR FunctionQuotientReader::execute(std::string::const_iterator begin, std::string::const_iterator end ) const { +GFPTR FunctionQuotientReader::execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData ) const { auto sep=split(begin,end); - return GFPTR(new GeoGenfun::FunctionQuotient(getInterpreter()->interpret(begin,sep).get(),getInterpreter()->interpret(sep+1,end).get())); + GFPTR f1=getInterpreter()->interpret(begin,sep,fpData); + GFPTR f2=getInterpreter()->interpret(sep+1,end,fpData); + return GFPTR(new GeoGenfun::FunctionQuotient(f1.get(),f2.get())); } FunctionQuotientRecorder::FunctionQuotientRecorder(GenFunctionPersistifier *persistifier): @@ -247,9 +262,12 @@ void FunctionQuotientRecorder::execute(const GeoGenfun::AbsFunction & F) const { FunctionDifferenceReader::FunctionDifferenceReader(GenFunctionInterpreter *interpreter):GenFunctionReader("FunctionDifference",interpreter) {} -GFPTR FunctionDifferenceReader::execute(std::string::const_iterator begin, std::string::const_iterator end ) const { +GFPTR FunctionDifferenceReader::execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> * fpData ) const { auto sep=split(begin,end); - return GFPTR(new GeoGenfun::FunctionDifference(getInterpreter()->interpret(begin,sep).get(),getInterpreter()->interpret(sep+1,end).get())); + + GFPTR f1=getInterpreter()->interpret(begin,sep,fpData); + GFPTR f2=getInterpreter()->interpret(sep+1,end,fpData); + return GFPTR(new GeoGenfun::FunctionDifference(f1.get(),f2.get())); } FunctionDifferenceRecorder::FunctionDifferenceRecorder(GenFunctionPersistifier *persistifier): @@ -273,7 +291,7 @@ void FunctionDifferenceRecorder::execute(const GeoGenfun::AbsFunction & F) const VariableReader::VariableReader(GenFunctionInterpreter *interpreter):GenFunctionReader("X",interpreter) {} -GFPTR VariableReader::execute(std::string::const_iterator, std::string::const_iterator) const { +GFPTR VariableReader::execute(std::string::const_iterator, std::string::const_iterator, std::deque<double> *) const { return GFPTR(new GeoGenfun::Variable()); } diff --git a/GeoModelIO/TFPersistification/src/ModIO.cpp b/GeoModelIO/TFPersistification/src/ModIO.cpp index 99df3526d4ec9fae421d6de5b0a0cc3571444595..e4f63678b9c2d2a7e1a0303de150f3eead54892d 100644 --- a/GeoModelIO/TFPersistification/src/ModIO.cpp +++ b/GeoModelIO/TFPersistification/src/ModIO.cpp @@ -6,11 +6,13 @@ ModReader::ModReader(GenFunctionInterpreter *interpreter):GenFunctionReader("Mod", interpreter) {} -GFPTR ModReader::execute(std::string::const_iterator begin, std::string::const_iterator end) const { - double y; +GFPTR ModReader::execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData) const { + std::string aNumberStr(begin,end); - std::istringstream stream(aNumberStr); - stream >> y; + if (aNumberStr!="REAL") { + throw std::runtime_error ("Parse error in ModReader"); + } + double y=fpData->back();fpData->pop_back(); return GFPTR(new GeoGenfun::Mod(y)); } @@ -22,8 +24,9 @@ void ModRecorder::execute(const GeoGenfun::AbsFunction & F) const { const GeoGenfun::Mod * ptr = dynamic_cast<const GeoGenfun::Mod *> (&F); if (!ptr) throw std::runtime_error("Error in ModRecorder:: wrong function type"); std::ostringstream & stream = getPersistifier()->getStream(); + getPersistifier()->getFloatingPointData().push_front(ptr->modulus()); stream << "Mod"; stream << "("; - stream<<ptr->modulus(); + stream<<"REAL"; stream << ")"; } diff --git a/GeoModelIO/TFPersistification/src/RectangularIO.cpp b/GeoModelIO/TFPersistification/src/RectangularIO.cpp index eb521dad9aae6127dad68f8bb5bd54fee572fd9b..e841fa6d0c7d94ae4f7ab85ebe3c22717520557e 100644 --- a/GeoModelIO/TFPersistification/src/RectangularIO.cpp +++ b/GeoModelIO/TFPersistification/src/RectangularIO.cpp @@ -6,31 +6,16 @@ RectangularReader::RectangularReader(GenFunctionInterpreter *interpreter):GenFunctionReader("Rectangular", interpreter) {} -GFPTR RectangularReader::execute(std::string::const_iterator begin, std::string::const_iterator end) const { - std::vector<double> elements; - auto cStart=begin; - auto cNext=std::find(cStart, end,','); - while (cNext!=end) { - std::string aNumberStr(cStart,cNext); - std::istringstream stream(aNumberStr); - double d; - stream >> d; - elements.push_back(d); - cStart=cNext+1; - cNext=std::find(cStart, end,','); +GFPTR RectangularReader::execute(std::string::const_iterator begin, std::string::const_iterator end, std::deque<double> *fpData) const { + std::string aNumberStr(begin,end); + if (aNumberStr!=("REAL,REAL,REAL,REAL")) { + throw std::runtime_error("Parse error in RectangularReader"); } - std::string aNumberStr(cStart,cNext); - std::istringstream stream(aNumberStr); - double d; - stream >> d; - elements.push_back(d); - if (elements.size()!=4) throw std::runtime_error("Error in Rectangular: illegal value list"); - GeoGenfun::Rectangular *ptr=new GeoGenfun::Rectangular(); - ptr->x0().setValue(elements[0]); - ptr->x1().setValue(elements[1]); - ptr->baseline().setValue(elements[2]); - ptr->height().setValue(elements[3]); + ptr->x0().setValue(fpData->back()); fpData->pop_back(); + ptr->x1().setValue(fpData->back()); fpData->pop_back(); + ptr->baseline().setValue(fpData->back()); fpData->pop_back(); + ptr->height().setValue(fpData->back()); fpData->pop_back(); return GFPTR(ptr); } @@ -42,14 +27,11 @@ void RectangularRecorder::execute(const GeoGenfun::AbsFunction & F) const { const GeoGenfun::Rectangular * ptr = dynamic_cast<const GeoGenfun::Rectangular *> (&F); if (!ptr) throw std::runtime_error("Error in RectangularRecorder:: wrong function type"); std::ostringstream & stream = getPersistifier()->getStream(); + getPersistifier()->getFloatingPointData().push_front(ptr->x0().getValue()); + getPersistifier()->getFloatingPointData().push_front(ptr->x1().getValue()); + getPersistifier()->getFloatingPointData().push_front(ptr->baseline().getValue()); + getPersistifier()->getFloatingPointData().push_front(ptr->height().getValue()); stream << "Rectangular"; - stream << "("; - stream << ptr->x0().getValue(); - stream << ","; - stream << ptr->x1().getValue(); - stream << ","; - stream << ptr->baseline().getValue(); - stream << ","; - stream << ptr->height().getValue(); - stream << ")"; + stream << "(REAL,REAL,REAL,REAL)"; + } diff --git a/GeoModelIO/TFPersistification/src/SinIO.cpp b/GeoModelIO/TFPersistification/src/SinIO.cpp index 4a450d3af62f93d6eaa6c26df67732251eb2a700..e30116ae9dee20e03ee2c2f3e86ba88b1eaab378 100644 --- a/GeoModelIO/TFPersistification/src/SinIO.cpp +++ b/GeoModelIO/TFPersistification/src/SinIO.cpp @@ -7,7 +7,7 @@ SinReader::SinReader(GenFunctionInterpreter *interpreter):GenFunctionReader("Sin", interpreter) {} -GFPTR SinReader::execute(std::string::const_iterator, std::string::const_iterator ) const { +GFPTR SinReader::execute(std::string::const_iterator, std::string::const_iterator, std::deque<double> * ) const { return GFPTR(new GeoGenfun::Sin()); } diff --git a/GeoModelIO/TFPersistification/src/SqrtIO.cpp b/GeoModelIO/TFPersistification/src/SqrtIO.cpp index a06a58e10519551179a1febe1f1bf87ea123e05e..e0c21fd91d35cfc1a0308972d1fad02ab22f31e8 100644 --- a/GeoModelIO/TFPersistification/src/SqrtIO.cpp +++ b/GeoModelIO/TFPersistification/src/SqrtIO.cpp @@ -7,7 +7,7 @@ SqrtReader::SqrtReader(GenFunctionInterpreter *interpreter):GenFunctionReader("Sqrt", interpreter) {} -GFPTR SqrtReader::execute(std::string::const_iterator, std::string::const_iterator ) const { +GFPTR SqrtReader::execute(std::string::const_iterator, std::string::const_iterator, std::deque<double> * ) const { return GFPTR(new GeoGenfun::Sqrt()); } diff --git a/GeoModelIO/TFPersistification/src/SquareIO.cpp b/GeoModelIO/TFPersistification/src/SquareIO.cpp index 1f70c16e042d55e38f1d353d2d59ddb468fb533e..9c0607dcd8019715b275a40dc5a10397c7b111ef 100644 --- a/GeoModelIO/TFPersistification/src/SquareIO.cpp +++ b/GeoModelIO/TFPersistification/src/SquareIO.cpp @@ -7,7 +7,7 @@ SquareReader::SquareReader(GenFunctionInterpreter *interpreter):GenFunctionReader("Square", interpreter) {} -GFPTR SquareReader::execute(std::string::const_iterator, std::string::const_iterator ) const { +GFPTR SquareReader::execute(std::string::const_iterator, std::string::const_iterator, std::deque<double> * ) const { return GFPTR(new GeoGenfun::Square()); } diff --git a/GeoModelIO/TFPersistification/src/TanIO.cpp b/GeoModelIO/TFPersistification/src/TanIO.cpp index ad57db23d0dbb142ea6322fe0b7602718acc4022..3c0fb7a3233351cfb0f28c0c8e431cb184e98a3f 100644 --- a/GeoModelIO/TFPersistification/src/TanIO.cpp +++ b/GeoModelIO/TFPersistification/src/TanIO.cpp @@ -7,7 +7,7 @@ TanReader::TanReader(GenFunctionInterpreter *interpreter):GenFunctionReader("Tan", interpreter) {} -GFPTR TanReader::execute(std::string::const_iterator, std::string::const_iterator) const { +GFPTR TanReader::execute(std::string::const_iterator, std::string::const_iterator, std::deque<double> *) const { return GFPTR(new GeoGenfun::Tan()); } diff --git a/cmake/BuildType.cmake b/cmake/BuildType.cmake index ac66a37a7ee18d873e34487b35740b9178027783..c4f91dede527377b534b52bce6e0076a555bc21e 100644 --- a/cmake/BuildType.cmake +++ b/cmake/BuildType.cmake @@ -3,7 +3,7 @@ # Source: https://blog.kitware.com/cmake-and-the-default-build-type/ # Set a default build type if none was specified -set(default_build_type "Release") +set(default_build_type "Debug") # TODO: at the moment, we want to build in Release mode by default, # even if we build from a Git clone, because that is the default mode