Frobby 0.9.5
DataType.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 "DataType.h"
19
20DataType::DataType(const char* name):
21 _name(name) {
22}
23
24const char* DataType::getName() const {
25 return _name;
26}
27
28bool DataType::isNull() const {
29 return *this == getNullType();
30}
31
32bool DataType::operator==(const DataType& type) const {
33 return this == &type; // There is only one object of each kind.
34}
35
36bool DataType::operator!=(const DataType& type) const {
37 return this != &type; // There is only one object of each kind.
38}
39
41 static DataType type("nothing");
42 return type;
43}
44
46 static DataType type("a monomial ideal");
47 return type;
48}
49
51 static DataType type("a polynomial");
52 return type;
53}
55 static DataType type("a list of monomial ideals");
56 return type;
57}
58
60 static DataType type("a saturated binomial ideal");
61 return type;
62}
63
64vector<const DataType*> DataType::getTypes() {
65 vector<const DataType*> types;
66 types.push_back(&getMonomialIdealType());
67 types.push_back(&getMonomialIdealListType());
68 types.push_back(&getPolynomialType());
69 types.push_back(&getSatBinomIdealType());
70 return types;
71}
The intention of this class is to describe the different kinds of mathematical structures that Frobby...
Definition DataType.h:29
const char * getName() const
Returns the name of the structure.
Definition DataType.cpp:24
bool operator==(const DataType &type) const
Definition DataType.cpp:32
static vector< const DataType * > getTypes()
Returns a vector of all types except null.
Definition DataType.cpp:64
static const DataType & getSatBinomIdealType()
Returns the one and only instance for saturated binomial ideals.
Definition DataType.cpp:59
static const DataType & getNullType()
Returns the one and only instance for null.
Definition DataType.cpp:40
static const DataType & getMonomialIdealListType()
Returns the one and only instance for monomial ideal lists.
Definition DataType.cpp:54
bool isNull() const
Returns true if this object was returned by getNullType().
Definition DataType.cpp:28
bool operator!=(const DataType &type) const
Definition DataType.cpp:36
DataType(const DataType &)
Private to avoid copies.
const char * _name
Definition DataType.h:68
static const DataType & getMonomialIdealType()
Returns the one and only instance for monomial ideals.
Definition DataType.cpp:45
static const DataType & getPolynomialType()
Returns the one and only instance for polynomials.
Definition DataType.cpp:50
This header file includes common definitions and is included as the first line of code in every imple...