Frobby  0.9.5
LibTest.h
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2009 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 #ifndef LIB_TEST_GUARD
18 #define LIB_TEST_GUARD
19 
20 #include "frobby.h"
21 #include "BigIdeal.h"
22 #include "BigPolynomial.h"
23 
24 #include <vector>
25 
29 Frobby::Ideal toLibIdeal(const BigIdeal& ideal);
30 
36 const mpz_t* castLibArray(const vector<mpz_class>& vect);
37 
40  public:
41  LibIdealConsumer(const VarNames& names);
42 
43  virtual void idealBegin(size_t varCount);
44  virtual void consume(mpz_ptr* exponentVector);
45 
47  const BigIdeal& getIdeal() const;
48 
50  bool hasAnyOutput() const;
51 
52 private:
54  mutable BigIdeal _ideal;
55 };
56 
59 public:
60  LibIdealsConsumer(const VarNames& names);
61 
62  virtual void idealBegin(size_t varCount);
63  virtual void consume(mpz_ptr* exponentVector);
64 
66  const vector<BigIdeal>& getIdeals() const;
67 
68 private:
69  mutable vector<BigIdeal> _ideals;
71 };
72 
75  public:
76  LibPolynomialConsumer(const VarNames& names);
77 
78  virtual void polynomialBegin(size_t varCount);
79  virtual void consume(const mpz_t coef, mpz_ptr* exponentVector);
80 
82  const BigPolynomial& getPolynomial() const;
83 
84  private:
86 };
87 
88 #endif
const mpz_t * castLibArray(const vector< mpz_class > &vect)
Returns a pointer to an array of mpt_t that represents the entries in the mpz_class.
Definition: LibTest.cpp:41
Frobby::Ideal toLibIdeal(const BigIdeal &ideal)
Returns a library interface ideal that corresponds to the parameter ideal.
Definition: LibTest.cpp:26
This class provides a way to get monomial ideals as output from Frobby one generator at a time.
Definition: frobby.h:77
This class provides a way to get polynomials as output from Frobby one term at a time.
Definition: frobby.h:114
Records library interface output into a BigIdeal.
Definition: LibTest.h:39
const BigIdeal & getIdeal() const
Returns the recorded ideal in a canonical form.
Definition: LibTest.cpp:66
virtual void consume(mpz_ptr *exponentVector)
For output of a generator of the ideal.
Definition: LibTest.cpp:60
virtual void idealBegin(size_t varCount)
Called before output of a monomial ideal.
Definition: LibTest.cpp:53
bool _hasAnyOutput
Definition: LibTest.h:53
LibIdealConsumer(const VarNames &names)
Definition: LibTest.cpp:48
BigIdeal _ideal
Definition: LibTest.h:54
bool hasAnyOutput() const
Returns whether any ideal has been recorded.
Definition: LibTest.cpp:71
Records library interface output into a vector of BigIdeals.
Definition: LibTest.h:58
VarNames _names
Definition: LibTest.h:70
virtual void consume(mpz_ptr *exponentVector)
For output of a generator of the ideal.
Definition: LibTest.cpp:85
LibIdealsConsumer(const VarNames &names)
Definition: LibTest.cpp:76
virtual void idealBegin(size_t varCount)
Called before output of a monomial ideal.
Definition: LibTest.cpp:80
const vector< BigIdeal > & getIdeals() const
Returns the recorded ideals in a canonical form.
Definition: LibTest.cpp:91
vector< BigIdeal > _ideals
Definition: LibTest.h:69
Records library interface output into a BigPolynomial.
Definition: LibTest.h:74
const BigPolynomial & getPolynomial() const
Returns the recorded polynomial in a canonical form.
Definition: LibTest.cpp:113
virtual void polynomialBegin(size_t varCount)
Called before output of a polynomial.
Definition: LibTest.cpp:102
virtual void consume(const mpz_t coef, mpz_ptr *exponentVector)
For output of a term of the polynomial.
Definition: LibTest.cpp:106
BigPolynomial _polynomial
Definition: LibTest.h:85
LibPolynomialConsumer(const VarNames &names)
Definition: LibTest.cpp:98
Defines the variables of a polynomial ring and facilities IO involving them.
Definition: VarNames.h:40