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
nBitStream.h
Go to the documentation of this file.
1 /**
2  * @file nBitStream
3  * file name: nBitStram.h
4  * @author Betti Oesterholz
5  * @date 24.09.2009
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This header specifies functions with which any number of bits can be
11  * writen into a stream.
12  * Copyright (C) @c LGPL3 2009 Betti Oesterholz
13  *
14  * This program is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU Lesser General Public License (LGPL) as
16  * published by the Free Software Foundation, either version 3 of the
17  * License, or any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * along with this program. If not, see <http://www.gnu.org/licenses/>.
26  *
27  *
28  * This header specifies functions with which any number of bits can be
29  * writen into a stream.
30  *
31  */
32 /*
33 History:
34 24.09.2009 Oesterholz created
35 */
36 
37 #ifndef ___N_BIT_STREAMS_H__
38 #define ___N_BIT_STREAMS_H__
39 
40 #include <ostream>
41 
42 using namespace std;
43 
44 namespace nBitStream{
45 
46  /**
47  * This method stores ucBitsToStore Bits of the ulNumber into
48  * the given stream.
49  * It gives back the bits that, which are not yet stored into the stream.
50  *
51  * @param stream the stream where this ulNumber should be stored to
52  * @param cRestBits the not yet writen bits which should be stored
53  * @param uiRestBitPosition the number of bits in the cRestBits which
54  * should be writen respectively containing valid information
55  * @param bWriteOptionalPart if true the optionalpart is written
56  * @param ulNumber the unsigned number to store, bits to much will be
57  * cuted
58  * @param ucBitsToStore the bits the stored number should be long
59  * @return true if the ulNumber is stored, else false
60  */
61  bool store( ostream & stream, char & cRestBits,
62  unsigned char & uiRestBitPosition,
63  const unsigned long long & ulNumber, const unsigned char ucBitsToStore );
64 
65  /**
66  * This method stores ucBitsToStore Bits of the ulNumber into
67  * the given stream.
68  * It gives back the bits that, which are not yet stored into the stream.
69  *
70  * @param stream the stream where this ulNumber should be stored to
71  * @param cRestBits the not yet writen bits which should be stored
72  * @param uiRestBitPosition the number of bits in the cRestBits which
73  * should be writen respectively containing valid information
74  * @param bWriteOptionalPart if true the optionalpart is written
75  * @param ulNumber the unsigned number to store, bits to much will be
76  * cuted
77  * @param ucBitsToStore the bits the stored number should be long
78  * @return true if the ulNumber is stored, else false
79  */
80  bool store( ostream & stream, char & cRestBits,
81  unsigned char & uiRestBitPosition,
82  const unsigned long & ulNumber, const unsigned char ucBitsToStore );
83 
84  /**
85  * This method stores ucBitsToStore Bits of the ulNumber into
86  * the given stream.
87  * It gives back the bits that, which are not yet stored into the stream.
88  *
89  * @param stream the stream where this ulNumber should be stored to
90  * @param cRestBits the not yet writen bits which should be stored
91  * @param uiRestBitPosition the number of bits in the cRestBits which
92  * should be writen respectively containing valid information
93  * @param bWriteOptionalPart if true the optionalpart is written
94  * @param ulNumber the unsigned number to store, bits to much will be
95  * cuted
96  * @param ucBitsToStore the bits the stored number should be long
97  * @return true if the ulNumber is stored, else false
98  */
99  bool store( ostream & stream, char & cRestBits,
100  unsigned char & uiRestBitPosition,
101  const unsigned int & ulNumber, const unsigned char ucBitsToStore );
102 
103  /**
104  * This method stores ucBitsToStore Bits of the lNumber into
105  * the given stream.
106  * It gives back the bits that, which are not yet stored into the stream.
107  *
108  * @param stream the stream where this ulNumber should be stored to
109  * @param cRestBits the not yet writen bits which should be stored
110  * @param uiRestBitPosition the number of bits in the cRestBits which
111  * should be writen respectively containing valid information
112  * @param bWriteOptionalPart if true the optionalpart is written
113  * @param lNumber the signed number to store, bits to much will be
114  * cuted
115  * @param ucBitsToStore the bits the stored number should be long
116  * @return true if the lNumber is stored, else false
117  */
118  bool store( ostream & stream, char & cRestBits,
119  unsigned char & uiRestBitPosition,
120  const long long & lNumber, const unsigned char ucBitsToStore );
121 
122  /**
123  * This method stores ucBitsToStore Bits of the lNumber into
124  * the given stream.
125  * It gives back the bits that, which are not yet stored into the stream.
126  *
127  * @param stream the stream where this ulNumber should be stored to
128  * @param cRestBits the not yet writen bits which should be stored
129  * @param uiRestBitPosition the number of bits in the cRestBits which
130  * should be writen respectively containing valid information
131  * @param bWriteOptionalPart if true the optionalpart is written
132  * @param lNumber the signed number to store, bits to much will be
133  * cuted
134  * @param ucBitsToStore the bits the stored number should be long
135  * @return true if the lNumber is stored, else false
136  */
137  bool store( ostream & stream, char & cRestBits,
138  unsigned char & uiRestBitPosition,
139  const long & lNumber, const unsigned char ucBitsToStore );
140 
141  /**
142  * This method stores ucBitsToStore Bits of the lNumber into
143  * the given stream.
144  * It gives back the bits that, which are not yet stored into the stream.
145  *
146  * @param stream the stream where this ulNumber should be stored to
147  * @param cRestBits the not yet writen bits which should be stored
148  * @param uiRestBitPosition the number of bits in the cRestBits which
149  * should be writen respectively containing valid information
150  * @param bWriteOptionalPart if true the optionalpart is written
151  * @param lNumber the signed number to store, bits to much will be
152  * cuted
153  * @param ucBitsToStore the bits the stored number should be long
154  * @return true if the lNumber is stored, else false
155  */
156  bool store( ostream & stream, char & cRestBits,
157  unsigned char & uiRestBitPosition,
158  const int & lNumber, const unsigned char ucBitsToStore );
159 
160  /**
161  * This method stores ucBitsToStore Bits of the charfield into
162  * the given stream.
163  * It gives back the bits that, which are not yet stored into the stream.
164  *
165  * @param stream the stream where this ulNumber should be stored to
166  * @param cRestBits the not yet writen bits which should be stored
167  * @param uiRestBitPosition the number of bits in the cRestBits which
168  * should be writen respectively containing valid information
169  * @param bWriteOptionalPart if true the optionalpart is written
170  * @param pcField the char field to store
171  * @param uiBitsToStore the bits to store from the char field
172  * @return true if the pcField is stored, else false
173  */
174  bool store( ostream & stream, char & cRestBits,
175  unsigned char & uiRestBitPosition,
176  const char * pcField, const unsigned int uiBitsToStore );
177 
178 
179 }//end namespace nBitStream
180 
181 
182 #endif //___N_BIT_STREAMS_H__
183 
184 
185 
186 
187 
188 
189