LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiCombinedCodec.h

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 .......: ltiDataTransformer.h
00027  * authors ....: Jochen Wickel
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 5.11.2002
00030  * revisions ..: $Id: ltiCombinedCodec.h,v 1.3 2006/02/08 12:01:57 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_COMBI_CODEC_H_
00034 #define _LTI_COMBI_CODEC_H_
00035 
00036 #include "ltiDataCodec.h"
00037 
00038 namespace lti {
00039   /**
00040    * This is the base class for data encoding and decoding.
00041    * This an abstract class.
00042    */
00043   class combinedCodec : public dataCodec {
00044   public:
00045 
00046     /**
00047      * default constructor
00048      */
00049     combinedCodec(const dataCodec& c1, const dataCodec& c2);
00050 
00051     /**
00052      * Construct a functor using the given parameters
00053      */
00054     combinedCodec(const parameters& par);
00055 
00056     /**
00057      * copy constructor
00058      * @param other the object to be copied
00059      */
00060     combinedCodec(const combinedCodec& other);
00061 
00062     /**
00063      * destructor
00064      */
00065     virtual ~combinedCodec();
00066 
00067     /**
00068      * returns the name of this type ("combinedCodec")
00069      */
00070     virtual const char* getTypeName() const;
00071 
00072     combinedCodec& copy(const combinedCodec& other);
00073 
00074 
00075     combinedCodec& operator=(const combinedCodec& other);
00076 
00077     /**
00078      * returns a pointer to a clone of this functor.
00079      */
00080     virtual functor* clone() const;
00081 
00082   protected:
00083     /**
00084      * Implementation of on-copy data decoder. <b>This method
00085      * must not, under no circumstances, resize the destination vector.</b>
00086      * @return true if the decoding could be performed successfully.
00087      * @param src the source of the data.
00088      * @param dest the destination for the decoded data.
00089      * @param nsrc tells how many elements of the src vector
00090      *        must be decoded.
00091      * @param ndest tells how many elements of the destination vector
00092      *        can be used for the decoded data.
00093      *        When the method returns,
00094      *        this value tells how many elements were actually used,
00095      *        or notEnoughSpace if not enough elements were available.
00096      */
00097     virtual bool decodeImplementation(const buffer& src,
00098                                       buffer& dest,
00099                                       int nsrc, int& ndest) const;
00100 
00101     /**
00102      * Implementation of on-copy data encoder. <b>This method
00103      * must not, under no circumstances, resize the destination vector.</b>
00104      * @return true if the decoding could be performed successfully.
00105      * @param src the source of the data.
00106      * @param dest the destination for the encoded data.
00107      * @param nsrc tells how many elements of the src vector
00108      *        must be decoded.
00109      * @param ndest tells how many elements of the destination vector
00110      *        can be used for the decoded data.
00111      *        When the method returns,
00112      *        this value tells how many elements were actually used,
00113      *        or notEnoughSpace if not enough elements were available.
00114      */
00115     virtual bool encodeImplementation(const buffer& src,
00116                                       buffer& dest,
00117                                       int nsrc, int& ndest) const;
00118 
00119 
00120   public:
00121     /**
00122      * Computes the default buffer size for encoded data. The
00123      * source of the original data buffer is given as argument.
00124      * The default is to return the given value.
00125      * @param originalSize the size of the data buffer to be encoded
00126      * @return the estimated size of the encoded data.
00127      */
00128     virtual int estimateEncodedSize(int originalSize) const;
00129 
00130     /**
00131      * Computes the default buffer size for decoded data. The
00132      * source of the encoded data buffer is given as argument.
00133      * The default is to return the given value.
00134      * @param encodedSize the size of the data buffer to be decoded
00135      * @return the estimated size of the decoded data.
00136      */
00137     virtual int estimateDecodedSize(int encodedSize) const;
00138 
00139   private:
00140     const dataCodec* codec1;
00141     const dataCodec* codec2;
00142 
00143   };
00144 }
00145 
00146 #endif

Generated on Sat Apr 10 15:25:16 2010 for LTI-Lib by Doxygen 1.6.1