The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
cDomainVector.h
Go to the documentation of this file.
1
/**
2
* @class cDomainVector
3
* file name: cDomainVector.h
4
* @author Betti Oesterholz
5
* @date 07.07.2009
6
* @mail webmaster@BioKom.info
7
*
8
* System: C++
9
*
10
* This class represents a vector domain.
11
* Copyright (C) @c LGPL3 2009 Betti Oesterholz
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU Lesser General Public License (LGPL) as
15
* published by the Free Software Foundation, either version 3 of the
16
* License, or any later version.
17
*
18
* This program is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU Lesser General Public License for more details.
22
*
23
* You should have received a copy of the GNU Lesser General Public License
24
* along with this program. If not, see <http://www.gnu.org/licenses/>.
25
*
26
*
27
* This file contains the class for vector Fib -domains.
28
* A vector domain is defined with the domains of it's elements.
29
*
30
*/
31
/*
32
History:
33
13.05.2009 Oesterholz created
34
01.12.2011 Oesterholz method isInBoundaries() added;
35
Elements can have any domain type -> cDomainSingle to cDomain
36
*/
37
38
#ifndef ___C_DOMAIN_VECTOR_H__
39
#define ___C_DOMAIN_VECTOR_H__
40
41
42
#include "version.h"
43
#include "
fibDatatyps.h
"
44
45
#include "
cDomainVectorBasis.h
"
46
#include "
cDomainSingle.h
"
47
48
#include <vector>
49
50
using
std::vector;
51
52
namespace
fib{
53
54
55
class
cDomainVector
:
public
cDomainVectorBasis
{
56
57
protected
:
58
59
/**
60
* This vector contains the domains for the elements of the
61
* vectordomain.
62
*/
63
vector<cDomain*>
vecElementDomains
;
64
65
public
:
66
67
/**
68
* This constructor of the cDomainVector element.
69
*
70
* @param vecInElementDomains the vector with the domains for the vector
71
* elements
72
*/
73
cDomainVector
(
const
vector<cDomain*> & vecInElementDomains );
74
75
/**
76
* This constructor of the cDomainVector element.
77
*
78
* @param vecInElementDomains the vector with the domains for the vector
79
* elements
80
*/
81
cDomainVector
(
const
vector<cDomainSingle*> & vecInElementDomains );
82
83
/**
84
* This destructor of the cDomainVector element.
85
*/
86
virtual
~cDomainVector
( );
87
88
/**
89
* @return the type of the domain as an string
90
*/
91
virtual
string
getType
()
const
;
92
93
94
/**
95
* This method checks if the given vector is an element of the
96
* domain. If the value dValue is an element of the
97
* domain true is returned, else false.
98
*
99
* @param fibVector the vector for which to check, if it is an element
100
* of the domain
101
* @return if the vector fibVector is an element of the domain true
102
* is returned, else false
103
*/
104
virtual
bool
isElement
(
const
cFibVector
&fibVector )
const
;
105
106
/**
107
* This method checks if the given vector is inside the domain
108
* boundaries. If the value dValue is inside of the domain boundaries
109
* true is returned, else false.
110
* A vector is inside of the vector domain boudaries, if all its
111
* elements are inside ther correspondending element domain boundaries.
112
*
113
* @param fibVector the vector for which to check, if it is inside of
114
* the domain boundaries
115
* @return if the vector fibVector is inside of the domain boundaries
116
* true is returned, else false
117
*/
118
virtual
bool
isInBoundaries
(
const
cFibVector
&fibVector )
const
;
119
120
/**
121
* This method round the given value vector to an vector in the
122
* domain of this object.
123
* The rounded vector will be the vector, wich elements have the minimal
124
* summed distance to the elements of the given vector fibVector. If more
125
* than one such vector exists, the vector wich first n elements have
126
* the minimal summed distance to the first n elements of the given
127
* vector fibVector. Wher n is first the number of elements in the
128
* vector, and than is decrased to 1 in steps of 1. If again more such
129
* vectors exists, the one with the smalest k elements is choosen, wher
130
* k begins with 1 and is incrased to the number of vectorelements in
131
* the input vector.
132
* ATTENTION: The returned vector will not be deleted automaticly, you
133
* have to delete it.
134
*
135
* @param fibVector the vector which should be rounded
136
* @return the rounded vector of fibVector
137
*/
138
virtual
cFibVector
*
round
(
cFibVector
&fibVector )
const
;
139
140
141
/**
142
* This method returns the number of elements in the vectors of the
143
* domain.
144
*
145
* @return the number of elements in the vectors of the domain
146
*/
147
virtual
unsignedIntFib
getNumberOfElements
()
const
;
148
149
150
/**
151
* This method returns the domain of the iNumberOfElement'th element in
152
* the vectors of the domain.
153
*
154
* @param iNumberOfElement the elementnumber for which the domain is to
155
* return
156
* @return domain of the iNumberOfElement'th element in the vectors of
157
* the domain
158
*/
159
virtual
cDomain
*
getElementDomain
(
160
const
unsignedIntFib
iNumberOfElement );
161
162
/**
163
* This method returns the domain of the iNumberOfElement'th element in
164
* the vectors of the domain.
165
*
166
* @param iNumberOfElement the elementnumber for which the domain is to
167
* return
168
* @return domain of the iNumberOfElement'th element in the vectors of
169
* the domain
170
*/
171
virtual
const
cDomain
*
getElementDomain
(
172
const
unsignedIntFib
iNumberOfElement )
const
;
173
174
/**
175
* This Method clones this object.
176
*
177
* @return a clone of this object
178
*/
179
virtual
cDomainVector
*
clone
()
const
;
180
181
182
/**
183
* This Method checks if the given domain is equal to this domain.
184
*
185
* @param domain the domain which should be equal to this domain
186
* @return true if the given domain is equal to this domain, else false
187
*/
188
virtual
bool
operator==
(
const
cDomain
&domain )
const
;
189
190
191
/**
192
* This method evaluades the size of the domain in bits in the
193
* compressed file form.
194
*
195
* @see store()
196
* @return the size of the domain in bits in the compressed form
197
*/
198
virtual
unsignedIntFib
getCompressedSize
()
const
;
199
200
/**
201
* This method stores this domain in the XML -format into the
202
* given stream.
203
*
204
* @param ostream the stream where domains should be stored to
205
* @return true if this domain are stored, else false
206
*/
207
virtual
bool
storeXml
( ostream & ostream )
const
;
208
209
/**
210
* This method restores a domain in the XML -format from an TinyXml element.
211
*
212
* @param pXmlNode a pointer to the TinyXml node wher the domain is stored in
213
* @return an integervalue with the errorvalue
214
* possible errorvalues are:
215
* - 0 loading successful
216
* - -1 loading error, invalid pXmlElement
217
* - -2 loading error, invalid data in pXmlElement
218
* - 1 loading warning, invalid data in pXmlElement, error could be corrected
219
* - 2 loading warning, invalid data in pXmlElement, maybe the loaded
220
* object is wrong
221
*/
222
virtual
intFib
restoreXml
(
const
TiXmlElement * pXmlElement );
223
224
/**
225
* This method stores this domain in the compressed fib -format
226
* into the given stream.
227
* It is needed because the stream can yust store byts but the size of
228
* fib -elements can be any number of bits. Because of that ther have to
229
* be a possibility to exchange the missing bits betwean the fib -elements.
230
*
231
* @see cFibElement::store
232
* @param stream the stream where this domain should be stored to
233
* @param cRestBits the not yet writen bits which should be stored
234
* @param uiRestBitPosition the number of bits in the cRestBits which
235
* should be writen respectively containing valid information
236
* @return true if the domain is stored, else false
237
*/
238
virtual
bool
store
( ostream & stream,
char
& cRestBits,
239
unsigned
char
& uiRestBitPosition )
const
;
240
241
/**
242
* This method restores a domain from a bitstream, wher it is
243
* stored in the compressed fib -format.
244
*
245
* @see store
246
* @param iBitStream the stream where the domain is stored in,
247
* because the stream is an cReadBits, any number of bits can be
248
* readed from it
249
* @return an integervalue with the errorvalue
250
* possible errorvalues are:
251
* - 0 loading successful
252
* - -1 loading error, invalid pXmlElement
253
* - -2 loading error, invalid data in pXmlElement
254
* - 1 loading warning, invalid data in pXmlElement, error could be corrected
255
* - 2 loading warning, invalid data in pXmlElement, maybe the loaded
256
* object is wrong
257
*/
258
virtual
intFib
restore
(
cReadBits
& iBitStream );
259
260
261
};
//end class cDomainVector
262
263
264
}
//end namespace fib
265
266
#endif
267
fib
incl
cDomainVector.h
Generated on Thu Feb 14 2013 14:06:56 for The Fib multimedia system by
1.8.1