HiRISE
 Observation

FELICS_Line_Cache.hh
Go to the documentation of this file.
1 /* HiRISE FELICS Line Cache
2 
3 PIRL CVS ID: FELICS_Line_Cache.hh,v 1.11 2020/02/14 01:17:18 schaller Exp
4 
5 Copyright (C) 2004-2020 Arizona Board of Regents on behalf of the Lunar and
6 Planetary Laboratory at the University of Arizona.
7 
8 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
9 this file except in compliance with the License. You may obtain a copy of the
10 License at
11 
12  http://www.apache.org/licenses/LICENSE-2.0
13 
14 Unless required by applicable law or agreed to in writing, software distributed
15 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
16 CONDITIONS OF ANY KIND, either express or implied. See the License for the
17 specific language governing permissions and limitations under the License.
18 */
19 #ifndef _HiRISE_FELICS_Line_Cache_
20 #define _HiRISE_FELICS_Line_Cache_
21 
22 // UA::HiRISE
23 #include "Cache.hh"
24 #include "Line_Cache.hh"
25 
26 
27 #include <iostream>
28 #include <string>
29 
30 namespace UA
31 {
32 namespace HiRISE
33 {
34 // Forward references
35 class Image_Line;
36 
37 /*******************************************************************************
38  FELICS_Line_Cache
39 */
67 : public Line_Cache
68 {
69 public:
70 /*==============================================================================
71  Constants:
72 */
74 static const char* const
75  ID;
76 
78 static const int
80 
82 static const u_int_8
84 
90 static const int
92 
94 static const int
96 
98 static const int
100 
101 /*==============================================================================
102  Constructors
103 */
109 explicit FELICS_Line_Cache (Image_Line& image_line, std::istream& stream);
110 
111 private:
114 FELICS_Line_Cache& operator= (const FELICS_Line_Cache&);
115 
116 public:
117 /*==============================================================================
118  Accessors
119 */
125 virtual unsigned long long bytes_read () const;
126 
131 virtual bool compressed_data () const
132  {return true;}
133 
141 virtual unsigned long long compressed_bytes () const
142  {return Compressed_Bytes;}
143 
151 virtual unsigned long long decompressed_bytes () const
152  {return Decompressed_Bytes;}
153 
164 virtual Line_Cache& source (std::istream& stream);
165 
170 virtual std::istream& source () const;
171 
172 /*==============================================================================
173  Manipulators
174 */
200 virtual bool refill (unsigned long max_amount = (unsigned long)-1);
201 
202 /* Resets the cache to its empty state.
203 
204  The local Cache and the parent Line_Cache are reset. The number of
205  {@link compressed_bytes() compressed bytes} and {@link
206  decompressed_bytes() decompressed bytes} processed are reset to zero.
207 
208  @see Line_Cache::reset()
209 */
210 virtual void reset ();
211 
212 /*==============================================================================
213  FELICS Algorithm
214 */
234 static int
236  (
237  char *compressed,
238  unsigned int amount,
239  char *decompressed,
240  unsigned int width,
241  unsigned int height
242  );
243 
244 /*==============================================================================
245  Utility Functions
246 */
256 static bool is_sync (void* data_at);
257 
258 /*==============================================================================
259  Cache Management
260 */
261 private:
262 
264 class PIRL::Cache
265  Data_Cache;
266 
268 long long
269  Compressed_Bytes;
270 
272 long long
273  Decompressed_Bytes;
274 
275 }; // class FELICS_Line_Cache
276 
277 } // namespace HiRISE
278 } // namespace UA
279 #endif
A FELICS_Line_Cache extends a Line_Cache by adding management of FELICS compressed line data.
Definition: FELICS_Line_Cache.hh:68
virtual bool compressed_data() const
Tests if the image data is compressed.
Definition: FELICS_Line_Cache.hh:131
static const u_int_8 SYNC_PATTERN[]
The synchronization pattern that begins each compressed data block.
Definition: FELICS_Line_Cache.hh:83
virtual std::istream & source() const
Gets the data source stream.
Definition: FELICS_Line_Cache.cc:149
static const int SYNC_BYTES
The number of bytes in the FELICS sync pattern.
Definition: FELICS_Line_Cache.hh:79
static const int MAX_LINES_PER_BLOCK
The maximum number of image lines in a FELICS data block.
Definition: FELICS_Line_Cache.hh:95
virtual unsigned long long bytes_read() const
Gets the total number of bytes read from the source stream.
Definition: FELICS_Line_Cache.cc:154
static int decompress(char *compressed, unsigned int amount, char *decompressed, unsigned int width, unsigned int height)
Decompresses FELICS compressed data.
Definition: FELICS_Line_Cache.cc:492
static const int MIN_GAP_BYTES
The minimum number of gap value bytes in a gap sequence.
Definition: FELICS_Line_Cache.hh:99
virtual unsigned long long decompressed_bytes() const
Gets the amount of decompressed data that has been generated.
Definition: FELICS_Line_Cache.hh:151
static bool is_sync(void *data_at)
Tests for a FELICS synchronization pattern.
Definition: FELICS_Line_Cache.cc:162
virtual void reset()
Resets the cache to its empty state and the line structure to match the current structure of the mana...
Definition: FELICS_Line_Cache.cc:898
static const int SYNC_BYTE_FACTOR
The byte number multiplier factor used to create the FELICS synchronization pattern.
Definition: FELICS_Line_Cache.hh:91
virtual unsigned long long compressed_bytes() const
Gets the amount (bytes) of compressed data that has been processed.
Definition: FELICS_Line_Cache.hh:141
static const char *const ID
Class identification name with source code version and date.
Definition: FELICS_Line_Cache.hh:75
virtual bool refill(unsigned long max_amount=(unsigned long) -1)
Refills the Line_Cache storage.
Definition: FELICS_Line_Cache.cc:655
An Image_Line contains a cache of observation channel image pixel data.
Definition: Image_Line.hh:112
unsigned int width() const
Gets the print listing width.
Definition: Image_Line.hh:998
A Line_Cache manages the data contents for an Image_Line.
Definition: Line_Cache.hh:83
U_INT_8_TYPE u_int_8
8-bit unsigned integer type.
Definition: Data_Component.hh:56
University of Arizona.