OpenASIP 2.2
Loading...
Searching...
No Matches
EntryKeyData.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file EntryKeyData.hh
26 *
27 * Declaration of EntryKeyData, EntryKeyDataInt, EntryKeyDataDouble,
28 * EntryKeyDataOperationSet, EntryKeyDataBool and EntryKeyDataParameterSet
29 * classes.
30 *
31 * @author Tommi Rantanen 2003 (tommi.rantanen-no.spam-tut.fi)
32 * @author Jari Mäntyneva 2005 (jari.mantyneva-no.spam-tut.fi)
33 * @note rating: red
34 */
35
36#ifndef TTA_ENTRY_KEY_DATA_HH
37#define TTA_ENTRY_KEY_DATA_HH
38
39
40#include <string>
41#include <set>
42#include <vector>
43
44#include "Exception.hh"
45
46namespace TTAMachine {
47 class FunctionUnit;
48}
49
50/**
51 * Interface for the data of the entry field.
52 */
54public:
56 virtual ~EntryKeyData();
57 /// Copies data.
58 virtual EntryKeyData* copy() const = 0;
59
60 /// Checks if two data are equal.
61 virtual bool isEqual(const EntryKeyData*) const = 0;
62 /// Checks if this data is greater than another data.
63 virtual bool isGreater(const EntryKeyData*) const = 0;
64 /// Checks if this data is smaller than another data.
65 virtual bool isSmaller(const EntryKeyData*) const = 0;
66 /// Returns the relative position between two data.
67 virtual double coefficient(
68 const EntryKeyData*, const EntryKeyData*) const = 0;
69 /// Converts the data into a string.
70 virtual std::string toString() const = 0;
71
72private:
73 /// Copying not allowed.
75 /// Assignment not allowed.
77};
78
79
80/**
81 * Implementation for integer type of data.
82 */
84public:
86 EntryKeyDataInt(int fieldData);
87 virtual ~EntryKeyDataInt();
88 EntryKeyData* copy() const;
89
90 bool isEqual(const EntryKeyData* fieldData) const;
91 bool isGreater(const EntryKeyData* fieldData) const;
92 bool isSmaller(const EntryKeyData* fieldData) const;
93 double coefficient(
94 const EntryKeyData* data1, const EntryKeyData* data2) const;
95 std::string toString() const;
96
97private:
98 /// Integer data.
99 int data_;
100
101 /// Copying not allowed.
103 /// Assignment not allowed.
105};
106
107
108/**
109 * Implementation for double type of data.
110 */
112public:
114 EntryKeyDataDouble(double fieldData);
115 virtual ~EntryKeyDataDouble();
116 EntryKeyData* copy() const;
117
118 bool isEqual(const EntryKeyData* fieldData) const;
119 bool isGreater(const EntryKeyData* fieldData) const;
120 bool isSmaller(const EntryKeyData* fieldData) const;
121 double coefficient(
122 const EntryKeyData* data1, const EntryKeyData* data2) const;
123 std::string toString() const;
124
125private:
126 /// Double data.
127 double data_;
128
129 /// Copying not allowed.
131 /// Assignment not allowed.
133};
134
135
136/**
137 * Implementation for operation set type of data.
138 */
140public:
142 EntryKeyDataOperationSet(std::set<std::string> fieldData);
144 EntryKeyData* copy() const;
145
146 bool isEqual(const EntryKeyData* fieldData) const;
147 bool isGreater(const EntryKeyData* fieldData) const;
148 bool isSmaller(const EntryKeyData* fieldData) const;
149 double coefficient(
150 const EntryKeyData* data1, const EntryKeyData* data2) const;
151 std::string toString() const;
152
153private:
154 /// Operation set data.
155 std::set<std::string> data_;
156
157 /// Copying not allowed.
159 /// Assignment not allowed.
161};
162
163/**
164 * Implementation for boolean type of data.
165 */
167public:
169 EntryKeyDataBool(bool fieldData);
170 virtual ~EntryKeyDataBool();
171 EntryKeyData* copy() const;
172
173 bool isEqual(const EntryKeyData* fieldData) const;
174 bool isGreater(const EntryKeyData* fieldData) const;
175 bool isSmaller(const EntryKeyData* fieldData) const;
176 double coefficient(
177 const EntryKeyData* data1, const EntryKeyData* data2) const;
178 std::string toString() const;
179
180private:
181 /// Boolean data.
182 bool data_;
183
184 /// Copying not allowed.
186 /// Assignment not allowed.
188};
189
190/**
191 * Implementation for FunctionUnit type of data.
192 */
194public:
198 EntryKeyData* copy() const;
199
200 bool isEqual(const EntryKeyData* fieldData) const;
201 bool isGreater(const EntryKeyData* fieldData) const;
202 bool isSmaller(const EntryKeyData* fieldData) const;
203 double coefficient(
204 const EntryKeyData* data1, const EntryKeyData* data2) const;
205 std::string toString() const;
206
207private:
208 /// FunctionUnit* data.
210
211 /// Copying not allowed.
213 /// Assignment not allowed.
215};
216
217#endif
EntryKeyDataBool(const EntryKeyDataBool &)
Copying not allowed.
bool isGreater(const EntryKeyData *fieldData) const
std::string toString() const
EntryKeyDataBool & operator=(const EntryKeyDataBool &)
Assignment not allowed.
virtual ~EntryKeyDataBool()
bool isEqual(const EntryKeyData *fieldData) const
bool data_
Boolean data.
bool isSmaller(const EntryKeyData *fieldData) const
EntryKeyData * copy() const
double coefficient(const EntryKeyData *data1, const EntryKeyData *data2) const
EntryKeyDataDouble(const EntryKeyDataDouble &)
Copying not allowed.
bool isGreater(const EntryKeyData *fieldData) const
virtual ~EntryKeyDataDouble()
bool isSmaller(const EntryKeyData *fieldData) const
EntryKeyDataDouble & operator=(const EntryKeyDataDouble &)
Assignment not allowed.
EntryKeyData * copy() const
double coefficient(const EntryKeyData *data1, const EntryKeyData *data2) const
bool isEqual(const EntryKeyData *fieldData) const
std::string toString() const
double data_
Double data.
std::string toString() const
EntryKeyDataFunctionUnit & operator=(const EntryKeyDataFunctionUnit &)
Assignment not allowed.
double coefficient(const EntryKeyData *data1, const EntryKeyData *data2) const
EntryKeyDataFunctionUnit(const EntryKeyDataFunctionUnit &)
Copying not allowed.
bool isEqual(const EntryKeyData *fieldData) const
bool isSmaller(const EntryKeyData *fieldData) const
EntryKeyData * copy() const
const TTAMachine::FunctionUnit * data_
FunctionUnit* data.
bool isGreater(const EntryKeyData *fieldData) const
EntryKeyData * copy() const
bool isGreater(const EntryKeyData *fieldData) const
virtual ~EntryKeyDataInt()
double coefficient(const EntryKeyData *data1, const EntryKeyData *data2) const
std::string toString() const
EntryKeyDataInt & operator=(const EntryKeyDataInt &)
Assignment not allowed.
int data_
Integer data.
bool isSmaller(const EntryKeyData *fieldData) const
EntryKeyDataInt(const EntryKeyDataInt &)
Copying not allowed.
bool isEqual(const EntryKeyData *fieldData) const
EntryKeyDataOperationSet(const EntryKeyDataOperationSet &)
Copying not allowed.
std::set< std::string > data_
Operation set data.
double coefficient(const EntryKeyData *data1, const EntryKeyData *data2) const
EntryKeyData * copy() const
std::string toString() const
bool isSmaller(const EntryKeyData *fieldData) const
bool isEqual(const EntryKeyData *fieldData) const
EntryKeyDataOperationSet & operator=(const EntryKeyDataOperationSet &)
Assignment not allowed.
bool isGreater(const EntryKeyData *fieldData) const
virtual std::string toString() const =0
Converts the data into a string.
virtual double coefficient(const EntryKeyData *, const EntryKeyData *) const =0
Returns the relative position between two data.
virtual bool isSmaller(const EntryKeyData *) const =0
Checks if this data is smaller than another data.
virtual bool isGreater(const EntryKeyData *) const =0
Checks if this data is greater than another data.
virtual ~EntryKeyData()
EntryKeyData & operator=(const EntryKeyData &)
Assignment not allowed.
EntryKeyData(const EntryKeyData &)
Copying not allowed.
virtual EntryKeyData * copy() const =0
Copies data.
virtual bool isEqual(const EntryKeyData *) const =0
Checks if two data are equal.