SampleValue.h

Go to the documentation of this file.
00001 /*
00002  * steghide 0.5.1 - a steganography program
00003  * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at>
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  *
00019  */
00020 
00021 #ifndef SH_SAMPLEVALUE_H
00022 #define SH_SAMPLEVALUE_H
00023 
00024 #include <functional>
00025 
00026 #include "common.h"
00027 #include "wrapper_hash_set.h"
00028 
00029 class CvrStgFile ;
00030 
00061 class SampleValue {
00062         public:
00063         SampleValue (void) ;
00064 
00065         virtual ~SampleValue (void) ;
00066 
00077         virtual SampleValue* getNearestTargetSampleValue (EmbValue t) const = 0 ;
00078 
00084         virtual UWORD32 calcDistance (const SampleValue *s) const = 0 ;
00085 
00089         virtual std::string getName (void) const = 0 ;
00090 
00098         virtual bool isNeighbour (const SampleValue* s) const ;
00099 
00104         EmbValue getEmbeddedValue (void) const
00105                 { return EValue ; } ;
00106 
00111         UWORD32 getKey (void) const
00112                 { return Key ; } ;
00113 
00117         bool operator== (const SampleValue& sv) const { return (getKey() == sv.getKey()) ; } ;
00118         bool operator!= (const SampleValue& sv) const { return (getKey() != sv.getKey()) ; } ;
00119 
00120         bool operator< (const SampleValue& sv) const { return (getKey() < sv.getKey()) ; } ;
00121 
00122         UWORD32 getNumEdges (EmbValue t) const { return NumEdges[t] ; } ;
00123         void setNumEdges (EmbValue t, UWORD32 ne) { NumEdges[t] = ne ; } ;
00124         void incNumEdges (EmbValue t) ;
00125         void decNumEdges (EmbValue t) ;
00126 
00127         void setLabel (unsigned long l) { Label = l ; } ;
00128         unsigned long getLabel (void) const { return Label ; } ;
00129 
00130         void print (unsigned short spc = 0) const ;
00131 
00132         protected:
00134         EmbValue EValue ;
00135 
00137         UWORD32 Key ;
00138 
00139         private:
00140         unsigned long Label ;
00141 
00146         UWORD32* NumEdges ;
00147 } ;
00148 
00149 struct SampleValuesEqual : public std::binary_function<SampleValue*, SampleValue*, bool> {
00150         bool operator() (const SampleValue* s1, const SampleValue *s2) const
00151         {
00152                 return (*s1 == *s2) ;
00153         }
00154 } ;
00155 
00156 struct SampleValuesLess : public std::binary_function<SampleValue*, SampleValue*, bool> {
00157         bool operator() (const SampleValue* s1, const SampleValue *s2) const
00158         {
00159                 return (*s1 < *s2) ;
00160         }
00161 } ;
00162 
00163 struct SampleValueHash : public std::unary_function<SampleValue*,size_t> {
00164         size_t operator() (const SampleValue* s) const
00165         {
00166                 sgi::hash<UWORD32> h ;
00167                 return h(s->getKey()) ;
00168         }
00169 } ;
00170 
00171 #endif // ndef SH_CVRSTGSAMPLE_H

Generated on Thu Jan 3 18:39:32 2008 for steghide by  doxygen 1.5.4