The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cDomainRationalBasis.h
Go to the documentation of this file.
1 /**
2  * @class cDomainRationalBasis
3  * file name: cDomainRationalBasis.h
4  * @author Betti Oesterholz
5  * @date 12.05.2010
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This class represents a domain for rational numbers.
11  * Copyright (C) @c LGPL3 2010 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 basisclass of all rational Fib -domains.
28  * It's not possible to create instances from this class.
29  * Rational numbers are composed of two numbers the mantissa and the exponent.
30  * The number is: mantissa * 2^exponent
31  *
32  */
33 /*
34 History:
35 12.05.2010 Oesterholz created
36 */
37 
38 #ifndef ___C_DOMAIN_REAL_BASIS_H__
39 #define ___C_DOMAIN_REAL_BASIS_H__
40 
41 #include "version.h"
42 #include "fibDatatyps.h"
43 
44 #include "cDomainSingle.h"
45 #include "cDomainIntegerBasis.h"
46 
47 
48 namespace fib{
49 
50 
52 protected:
53 
54  /**
55  * The domain for the mantisse of the rational domain.
56  */
58 
59  /**
60  * The domain for the exponent of the rational domain.
61  */
63 
64 
65  /**
66  * The constructor for rational number domains.
67  *
68  * @param dfMantissa the domain for the mantisse of the rational domain
69  * @param dfExponent the domain for the exponent of the rational domain
70  */
71  cDomainRationalBasis( const cDomainIntegerBasis &dfMantissa,
72  const cDomainIntegerBasis &dfExponent );
73 
74  /**
75  * The copyconstructor for rational number domains.
76  *
77  * @param domainRational the domain to copy
78  */
79  cDomainRationalBasis( const cDomainRationalBasis &domainRational );
80 
81  /**
82  * The desstructor for rational number domains.
83  */
84  virtual ~cDomainRationalBasis();
85 
86 
87 public:
88 
89 
90  /**
91  * This Method clones this object.
92  *
93  * @return a clone of this object
94  */
95  virtual cDomainRationalBasis *clone() const = 0;
96 
97  /**
98  * This Method checks if the given domain is equal to this domain.
99  *
100  * @param domain the domain to compare with
101  * @return true if the given domain is equal to this domain, else false
102  */
103  virtual bool operator==( const cDomain &domain ) const;
104 
105  /**
106  * This method stores the given value dValue in the compressed
107  * fib -format for the domain into the given stream.
108  * It is needed because the stream can yust store byts but the size of
109  * fib -elements can be any number of bits. Because of that ther have to
110  * be a possibility to exchange the missing bits betwean the fib -elements.
111  *
112  * @see cFibElement::store
113  * @param dValue the value to store
114  * @param stream the stream where this domain should be stored to
115  * @param cRestBits the not yet writen bits which should be stored
116  * @param uiRestBitPosition the number of bits in the cRestBits which
117  * should be writen respectively containing valid information
118  * @return true if the domain is stored, else false
119  */
120  virtual bool storeValue( doubleFib dValue, ostream & stream,
121  char & cRestBits, unsigned char & uiRestBitPosition ) const = 0;
122 
123 
124  /**
125  * This method restores the a value of the domain from the stream
126  * iBitStream wher it is stored in the compressed fib -format.
127  *
128  * @see storeValue
129  * @see cFibElement::restore
130  * @param iBitStream the stream where this value is stored to in,
131  * because this stream is an cReadBits, any number of bits can be
132  * readed from it
133  * @param outStatus An reference to an rationalvalue where the errorvalue
134  * can be stored to. If the pointer is NULL no errorvalue will be
135  * given back.
136  * possible errorvalues are:
137  * - 0 loading successful
138  * - -1 loading error, invalid stream
139  * - -2 loading error, invalid data in stream
140  * - 1 loading warning, invalid data in stream, error could be corrected
141  * - 2 loading warning, invalid data in stream, maybe the loaded
142  * object is wrong
143  * @return the restored value
144  */
145  virtual doubleFib restoreValue( cReadBits & iBitStream, intFib & outStatus ) const = 0;
146 
147 
148 };//end class cDomainRationalBasis
149 
150 
151 }//end namespace fib
152 
153 #endif