latest version v1.9 - last update 10 Apr 2010 |
00001 /* 00002 * Copyright (C) 2002, 2003, 2004, 2005, 2006 00003 * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany 00004 * 00005 * This file is part of the LTI-Computer Vision Library (LTI-Lib) 00006 * 00007 * The LTI-Lib is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public License (LGPL) 00009 * as published by the Free Software Foundation; either version 2.1 of 00010 * the License, or (at your option) any later version. 00011 * 00012 * The LTI-Lib is distributed in the hope that it will be 00013 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 00014 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with the LTI-Lib; see the file LICENSE. If 00019 * not, write to the Free Software Foundation, Inc., 59 Temple Place - 00020 * Suite 330, Boston, MA 02111-1307, USA. 00021 */ 00022 00023 00024 /*-------------------------------------------------------------------- 00025 * project ....: LTI-Lib: Image Processing and Computer Vision Library 00026 * file .......: ltiFlateCodec.h 00027 * authors ....: Jochen Wickel 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 5.11.2002 00030 * revisions ..: $Id: ltiFlateCodec.h,v 1.4 2006/02/08 12:03:52 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_FLATE_CODEC_H_ 00034 #define _LTI_FLATE_CODEC_H_ 00035 00036 #include "ltiConfig.h" 00037 #include "ltiDataCodec.h" 00038 00039 #ifdef HAVE_LIBZ 00040 00041 namespace lti { 00042 00043 /** 00044 * Encodes a byte array to an array of hexadecimal digits or 00045 * performs the corresponding decoding method, depending on the parameters. 00046 */ 00047 class flateCodec : public dataCodec { 00048 public: 00049 00050 /** 00051 * default constructor 00052 */ 00053 flateCodec(); 00054 00055 /** 00056 * Construct a functor using the given parameters 00057 */ 00058 flateCodec(const parameters& par); 00059 00060 /** 00061 * copy constructor 00062 * @param other the object to be copied 00063 */ 00064 flateCodec(const flateCodec& other); 00065 00066 /** 00067 * destructor 00068 */ 00069 virtual ~flateCodec(); 00070 00071 /** 00072 * returns the name of this type ("flateCodec") 00073 */ 00074 virtual const char* getTypeName() const; 00075 00076 /** 00077 * copy data of "other" functor. 00078 * @param other the functor to be copied 00079 * @return a reference to this functor object 00080 */ 00081 flateCodec& copy(const flateCodec& other); 00082 00083 /** 00084 * alias for copy member 00085 * @param other the functor to be copied 00086 * @return a reference to this functor object 00087 */ 00088 flateCodec& operator=(const flateCodec& other); 00089 00090 /** 00091 * returns a pointer to a clone of this functor. 00092 */ 00093 virtual functor* clone() const; 00094 00095 //TODO: comment the attributes of your functor 00096 // If you add more attributes manually, do not forget to do following: 00097 // 1. indicate in the default constructor the default values 00098 // 2. make sure that the copy member also copy your new attributes, or 00099 // to ensure there, that these attributes are properly initialized. 00100 00101 00102 /** 00103 * Computes the default buffer size for encoded data. The 00104 * source of the original data buffer is given as argument. 00105 * The default is to return the given value. 00106 * @param originalSize the size of the data buffer to be encoded 00107 * @return the estimated size of the encoded data. 00108 */ 00109 virtual int estimateEncodedSize(int originalSize) const; 00110 00111 /** 00112 * Computes the default buffer size for decoded data. The 00113 * source of the original data buffer is given as argument. 00114 * The default is to return the given value. 00115 * @param originalSize the size of the data buffer to be decoded 00116 * @return the estimated size of the encoded data. 00117 */ 00118 virtual int estimateDecodedSize(int originalSize) const; 00119 00120 protected: 00121 //TODO: comment your apply methods! 00122 00123 virtual bool decodeImplementation(const buffer& src, buffer& dest, 00124 int nsrc, int& ndest) const; 00125 00126 virtual bool encodeImplementation(const buffer& src, buffer& dest, 00127 int nsrc, int& ndest) const; 00128 00129 00130 00131 00132 }; 00133 } 00134 00135 #else 00136 00137 #include "ltiRunLengthCodec.h" 00138 00139 #ifdef _LTI_MSC_VER 00140 #pragma message("zlib not found. Using runLengthCodec instead of flateCodec.") 00141 #else 00142 #warning "zlib not found. Using runLengthCodec instead of flateCodec." 00143 #endif 00144 00145 namespace lti { 00146 00147 typedef runLengthCodec flateCodec; 00148 00149 } 00150 00151 #endif 00152 00153 00154 #endif