1 #ifndef CoCoA_CoCoA5io_H 2 #define CoCoA_CoCoA5io_H 3 4 // Copyright (c) 2019 Anna Bigatti 5 6 // This file is part of the source of CoCoALib, the CoCoA Library. 7 8 // CoCoALib is free software: you can redistribute it and/or modify 9 // it under the terms of the GNU General Public License as published by 10 // the Free Software Foundation, either version 3 of the License, or 11 // (at your option) any later version. 12 13 // CoCoALib is distributed in the hope that it will be useful, 14 // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 // GNU General Public License for more details. 17 18 // You should have received a copy of the GNU General Public License 19 // along with CoCoALib. If not, see <http://www.gnu.org/licenses/>. 20 21 //#include "CoCoA/library.H" 22 23 #include "CoCoA/TmpGTypes.H" // PolyList and VectorList 24 25 #include <string> 26 27 namespace CoCoA 28 { 29 class BigInt; // forward declaration -- CoCoA/BigInt.H 30 class RingElemAlias; // forward declaration -- CoCoA/ring.H 31 typedef const RingElemAlias& ConstRefRingElem; // forward declaration -- CoCoA/ring.H 32 class FreeModule; // forward declaration -- CoCoA/FreeModule.H 33 class PPMonoid; // forward declaration -- CoCoA/PPMonoid.H 34 class PPMonoidElem; // forward declaration -- CoCoA/PPMonoid.H 35 class PPOrdering; // forward declaration -- CoCoA/PPOrdering.H 36 class SparsePolyRing; // forward declaration -- CoCoA/SparsePolyRing.H 37 class ideal; // forward declaration -- CoCoA/ideal.H 38 class matrix; // forward declaration -- CoCoA/matrix.H 39 //---------------------------------------------------------------------- 40 enum SkipTagType {TagWasRead, GetTag}; // used in functions Read...(...) 41 42 //---------------------------------------------------------------------- 43 std::string ReadOperationString(std::istream& in); 44 void ReadPPs(std::istream& in, std::vector<PPMonoidElem>& PPs, const PPMonoid& PPM, SkipTagType ST); 45 void ReadPolyList(std::istream& in, PolyList& PL, const SparsePolyRing& P, SkipTagType ST); 46 void ReadVectorList(std::istream& in, VectorList& L, const FreeModule& FM, SkipTagType ST); 47 48 // cannot be "void Read..(res, ...)" because there is no empty ctor 49 // anyway, they are reference counted objects 50 int ReadVerbosityLevel(std::istream& in, SkipTagType ST); 51 matrix ReadIntegerMatrix(std::istream& in, SkipTagType ST); 52 matrix ReadRationalMatrix(std::istream& in, SkipTagType ST); 53 FreeModule ReadFreeModule(std::istream& in, SkipTagType ST); 54 SparsePolyRing ReadPolyRing(std::istream& in, SkipTagType ST); 55 PPOrdering ReadPolyRingOrdering(std::istream& in, long NumInds, SkipTagType ST); 56 57 //------------------------------ 58 void PrintTimeToLog(double T); 59 void PrintTimeToCoCoA5(double T); 60 void PrintVersionToCoCoA5(); 61 void EndOfTransmissionToCoCoA5(); 62 63 void WritePolyRing(std::ostream& out, const SparsePolyRing& P); 64 void WriteMatrix(std::ostream& out, const matrix &M); 65 void WritePoly(std::ostream& out, ConstRefRingElem f); 66 void WritePolyList(std::ostream& out, const PolyList &PL); 67 void WriteIdeal(std::ostream& out, const ideal &I); 68 69 void WriteMatrixInVar(std::ostream& out, const std::string& VarName, const matrix &M); 70 void WritePolyListInVar(std::ostream& out, const std::string& VarName, const PolyList& PL); 71 void WriteVectorListInVar(std::ostream& out, const std::string& VarName, const VectorList& VL); 72 //---------------------------------------------------------------------- 73 void AssertTag(const std::string& input_tag, const std::string& expected_tag); 74 void SkipTag(std::istream& in, const std::string& expected_tag); 75 void ThrowInputError(const std::string& unknown_tag); 76 77 //---------------------------------------------------------------------- 78 SparsePolyRing NewPolyRingServer(const BigInt& charact, long FloatPrecision, long NumParams, const PPOrdering& O); 79 } 80 81 82 // $Header: /Volumes/Home_1/cocoa/cvs-repository/CoCoALib-0.99/src/server/CoCoA5io.H,v 1.1 2019/03/20 16:22:15 bigatti Exp $ 83 // $Log: CoCoA5io.H,v $ 84 // Revision 1.1 2019/03/20 16:22:15 bigatti 85 // -- first import 86 // 87 88 #endif 89