pelib  2.0.0
include/pelib/AmplInput.hpp
Go to the documentation of this file.
00001 /*
00002  Copyright 2015 Nicolas Melot
00003 
00004  This file is part of Pelib.
00005 
00006  Pelib is free software: you can redistribute it and/or modify
00007  it under the terms of the GNU General Public License as published by
00008  the Free Software Foundation, either version 3 of the License, or
00009  (at your option) any later version.
00010 
00011  Pelib is distributed in the hope that it will be useful,
00012  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  GNU General Public License for more details.
00015 
00016  You should have received a copy of the GNU General Public License
00017  along with Pelib. If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 
00020 
00021 #include <iostream>
00022 #include <cstdlib>
00023 #include <fstream>
00024 #include <string>
00025 #include <boost/regex.hpp>
00026 #include <iomanip>
00027 
00028 #include <pelib/AlgebraParser.hpp>
00029 #include <pelib/AlgebraOutput.hpp>
00030 #include <pelib/AmplDataParser.hpp>
00031 #include <pelib/AmplDataOutput.hpp>
00032 #include <pelib/AmplInputData.hpp>
00033 
00034 #ifndef PELIB_AMPLINPUT
00035 #define PELIB_AMPLINPUT
00036 
00037 namespace pelib
00038 {
00040         class AmplInput: public AlgebraParser, public AlgebraOutput
00041         {
00042                 public:
00044                         AmplInput(std::pair<std::vector<AmplInputDataParser*>, std::vector<AmplInputDataOutput*> > handlers);
00045 
00047                         virtual
00048                         ~AmplInput();
00049 
00051                         Algebra
00052                         parse(std::istream &data) const;
00053 
00055                         virtual
00056                         void
00057                         dump(std::ostream& o, const Algebra &record) const;
00058 
00060                         virtual
00061                         void
00062                         dump(std::ostream& o, const AlgebraData *data) const;
00063 
00065                         virtual
00066                         void
00067                         dump(std::ostream& o, const AlgebraData &data) const;
00068 
00070                         virtual
00071                         AmplInput&
00072                         operator=(const AmplInput &rhs);
00073 
00075                         static std::vector<AmplInputDataParser*> floatParsers();
00077                         static std::vector<AmplInputDataOutput*> floatOutputs();
00079                         static std::pair<std::vector<AmplInputDataParser*>, std::vector<AmplInputDataOutput*> > floatHandlers();
00080 
00082                         static std::vector<AmplInputDataParser*> intFloatParsers();
00084                         static std::vector<AmplInputDataOutput*> intFloatOutputs();
00086                         static std::pair<std::vector<AmplInputDataParser*>, std::vector<AmplInputDataOutput*> > intFloatHandlers();
00087 
00089                         static std::vector<AmplInputDataParser*> stringParsers();
00091                         static std::vector<AmplInputDataOutput*> stringOutputs();
00093                         static std::pair<std::vector<AmplInputDataParser*>, std::vector<AmplInputDataOutput*> > stringHandlers();
00094 
00095                 protected:
00097                         std::vector<AmplInputDataParser*> parsers;
00099                         std::vector<AmplInputDataOutput*> outputs;
00100 
00102                         void
00103                         deleteParsers();
00104 
00106                         void
00107                         deleteOutputs();
00108                 private:
00109         };
00110 }
00111 
00112 #endif
00113