rasdaman complete source
tilecompression.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
39 #ifndef _R_TILE_COMPRESSION_HH_
40 #define _R_TILE_COMPRESSION_HH_
41 
42 
43 #include <stdio.h>
44 
45 #include "raslib/error.hh"
46 #include "raslib/minterval.hh"
47 #include "raslib/mddtypes.hh"
48 #include "raslib/odmgtypes.hh"
49 #include "raslib/storageman.hh"
50 
51 
52 class r_Base_Type;
53 class r_Parse_Params;
54 class RMTimer;
55 
56 
57 //@ManMemo: Module: {\bf compression}
58 
59 /*@Doc:
60  Abstract base class for compression / decompression functionality
61  of tiles, to be executed on client or server. r_Tile_Compression is
62  used by both compressing and uncompressing classes.
63  */
64 
65 class r_Tile_Compression
66 {
67 public:
68  enum Support_Format
69  { INVALID=0, COMPRESSION, CONVERSION };
70 
71  r_Tile_Compression( const r_Minterval &dom, const r_Base_Type *type );
72  r_Tile_Compression( const r_Tile_Compression &src );
73  virtual ~r_Tile_Compression( void );
74 
75  static Support_Format check_data_format( r_Data_Format fmt );
76  static r_Tile_Compression *create( r_Data_Format fmt, const r_Minterval &dom, const r_Base_Type *type ) throw(r_Error);
77  static r_Tile_Compression *create( const char *name, const r_Minterval &dom, const r_Base_Type *type ) throw(r_Error);
78  static r_Data_Format get_format_from_name( const char *name ) throw(r_Error);
79  static const char *get_format_info( unsigned int number, r_Data_Format &fmt );
80  virtual void *compress( const void *data, r_ULong &size, const char *options = NULL ) = 0;
81  virtual void *decompress( const void *data, r_ULong size, const char *options = NULL ) = 0;
82  virtual r_Data_Format get_decomp_format( void ) const;
83  virtual bool converts_endianness( void ) const;
84  virtual const char *get_name( void ) const = 0;
85  virtual r_Data_Format get_data_format( void ) const = 0;
86  virtual r_Tile_Compression *clone( void ) const = 0;
87  r_Bytes get_type_size( void ) const;
88  r_ULong get_tile_size( void ) const;
89  const r_Minterval &get_domain( void ) const;
90  const r_Base_Type *get_base_type( void ) const;
91  void resume_timer( void );
92  void pause_timer( void );
93  virtual void set_storage_handler( const r_Storage_Man &newStore );
94  static void write_short( void *dest, r_Short val );
95  static void write_long( void *dest, r_Long val );
96  static void read_short( const void *src, r_Short &val );
97  static void read_long( const void *src, r_Long &val );
98  typedef struct tile_comp_format_s
99  {
100  r_Data_Format format;
101  const char *name;
102  } tile_comp_format_t;
103 
104 protected:
105  static unsigned int get_atom_info( const r_Base_Type* baseType, unsigned int* sizes=NULL,
106  unsigned int *idxptr=NULL );
107  void instantiate_timer( const char *func, int level=0 );
108  r_Storage_Man mystore;
109  r_Minterval mydomain;
110  r_Base_Type *mytype;
111  r_Parse_Params *compParams;
112  r_Parse_Params *decompParams;
113  RMTimer *myTimer;
114  static const tile_comp_format_t all_formats[];
115 };
116 
117 
118 #endif
Definition: storageman.hh:56
Module: { raslib}.
Definition: rmdebug.hh:298