Frobby 0.9.5
LatticeFormatAction.cpp
Go to the documentation of this file.
1/* Frobby: Software for monomial ideal computations.
2 Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see http://www.gnu.org/licenses/.
16*/
17#include "stdinc.h"
18#include "LatticeFormatAction.h"
19
20#include "BigIdeal.h"
21#include "IOFacade.h"
22#include "fplllIO.h"
23#include "LatticeFacade.h"
24#include "Scanner.h"
25#include "error.h"
26#include "IOHandler.h"
27
30(staticGetName(),
31 "Change the representation of the input lattice.",
32 "By default, latformat simply writes the input lattice to output.\n"
33 "The main functionality is to change the format.",
34 false),
35
36_inputFormat
37 ("iformat",
38 "The input format. The available formats are 4ti2 and fplll.",
39 "4ti2"),
40
41 _outputFormat
42 ("oformat",
43 "The output format. The additional format \"" +
45 "\" means use input format.",
47
48 _zero
49 ("zero",
50 "Adjust lattice basis to increase the number of zero entries.",
51 false) {
52}
53
60
62 string iformat = _inputFormat.getValue();
64
67
69
70 if (!facade.isValidLatticeFormat(iformat))
71 reportError("Unknown lattice input format \"" + iformat + "\".");
72 if (!facade.isValidLatticeFormat(oformat))
73 reportError("Unknown lattice output format \"" + oformat + "\".");
74
77 facade.readLattice(in, basis);
78 in.expectEOF();
79
80 if (_zero) {
82 latticeFacade.makeZeroesInLatticeBasis(basis);
83 }
84
85 facade.writeLattice(stdout, basis, oformat);
86}
87
89 return "latformat";
90}
string getFormatNameIndicatingToUseInputFormatAsOutputFormat()
Using the returned string in place of an (output) format name indicates to use the input format as th...
void nameFactoryRegister(NameFactory< AbstractProduct > &factory)
Registers the string returned by ConcreteProduct::getStaticName() to a function that default-construc...
BoolParameter _printActions
Definition Action.h:68
virtual void obtainParameters(vector< Parameter * > &parameters)
Definition Action.cpp:133
A facade for input and output of mathematical objects.
Definition IOFacade.h:39
A facade for operations on lattices.
static const char * staticGetName()
StringParameter _outputFormat
StringParameter _inputFormat
virtual void obtainParameters(vector< Parameter * > &parameters)
This class offers an input interface which is more convenient and for some purposes more efficient th...
Definition Scanner.h:50
const string & getValue() const
void reportError(const string &errorMsg)
Definition error.cpp:23