steghide  0.5.1
SampleValue.h
Go to the documentation of this file.
1 /*
2  * steghide 0.5.1 - a steganography program
3  * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  *
19  */
20 
21 #ifndef SH_SAMPLEVALUE_H
22 #define SH_SAMPLEVALUE_H
23 
24 #include <functional>
25 
26 #include "common.h"
27 #include "wrapper_hash_set.h"
28 
29 class CvrStgFile ;
30 
61 class SampleValue {
62  public:
63  SampleValue (void) ;
64 
65  virtual ~SampleValue (void) ;
66 
78 
84  virtual UWORD32 calcDistance (const SampleValue *s) const = 0 ;
85 
89  virtual std::string getName (void) const = 0 ;
90 
98  virtual bool isNeighbour (const SampleValue* s) const ;
99 
105  { return EValue ; } ;
106 
111  UWORD32 getKey (void) const
112  { return Key ; } ;
113 
117  bool operator== (const SampleValue& sv) const { return (getKey() == sv.getKey()) ; } ;
118  bool operator!= (const SampleValue& sv) const { return (getKey() != sv.getKey()) ; } ;
119 
120  bool operator< (const SampleValue& sv) const { return (getKey() < sv.getKey()) ; } ;
121 
122  UWORD32 getNumEdges (EmbValue t) const { return NumEdges[t] ; } ;
123  void setNumEdges (EmbValue t, UWORD32 ne) { NumEdges[t] = ne ; } ;
124  void incNumEdges (EmbValue t) ;
125  void decNumEdges (EmbValue t) ;
126 
127  void setLabel (unsigned long l) { Label = l ; } ;
128  unsigned long getLabel (void) const { return Label ; } ;
129 
130  void print (unsigned short spc = 0) const ;
131 
132  protected:
135 
138 
139  private:
140  unsigned long Label ;
141 
147 } ;
148 
149 struct SampleValuesEqual : public std::binary_function<SampleValue*, SampleValue*, bool> {
150  bool operator() (const SampleValue* s1, const SampleValue *s2) const
151  {
152  return (*s1 == *s2) ;
153  }
154 } ;
155 
156 struct SampleValuesLess : public std::binary_function<SampleValue*, SampleValue*, bool> {
157  bool operator() (const SampleValue* s1, const SampleValue *s2) const
158  {
159  return (*s1 < *s2) ;
160  }
161 } ;
162 
163 struct SampleValueHash : public std::unary_function<SampleValue*,size_t> {
164  size_t operator() (const SampleValue* s) const
165  {
166  sgi::hash<UWORD32> h ;
167  return h(s->getKey()) ;
168  }
169 } ;
170 
171 #endif // ndef SH_CVRSTGSAMPLE_H
CvrStgFile
a cover-/stego-file
Definition: CvrStgFile.h:46
SampleValuesLess
Definition: SampleValue.h:156
SampleValue::SampleValue
SampleValue(void)
Definition: SampleValue.cc:25
SampleValue::print
void print(unsigned short spc=0) const
Definition: SampleValue.cc:55
SampleValue::incNumEdges
void incNumEdges(EmbValue t)
Definition: SampleValue.cc:36
SampleValue::getNumEdges
UWORD32 getNumEdges(EmbValue t) const
Definition: SampleValue.h:122
SampleValuesEqual::operator()
bool operator()(const SampleValue *s1, const SampleValue *s2) const
Definition: SampleValue.h:150
UWORD32
unsigned long UWORD32
Definition: common.h:45
SampleValue::operator<
bool operator<(const SampleValue &sv) const
Definition: SampleValue.h:120
SampleValue::operator==
bool operator==(const SampleValue &sv) const
Definition: SampleValue.h:117
SampleValue::getLabel
unsigned long getLabel(void) const
Definition: SampleValue.h:128
SampleValue::NumEdges
UWORD32 * NumEdges
Definition: SampleValue.h:146
SampleValuesLess::operator()
bool operator()(const SampleValue *s1, const SampleValue *s2) const
Definition: SampleValue.h:157
SampleValue::Key
UWORD32 Key
the key of this sample value - must be different for two different sample values - must be set in con...
Definition: SampleValue.h:137
SampleValue::getName
virtual std::string getName(void) const =0
wrapper_hash_set.h
SampleValue::getNearestTargetSampleValue
virtual SampleValue * getNearestTargetSampleValue(EmbValue t) const =0
SampleValue::calcDistance
virtual UWORD32 calcDistance(const SampleValue *s) const =0
SampleValue::setNumEdges
void setNumEdges(EmbValue t, UWORD32 ne)
Definition: SampleValue.h:123
SampleValue::setLabel
void setLabel(unsigned long l)
Definition: SampleValue.h:127
SampleValue
the value of a sample in a CvrStgFile
Definition: SampleValue.h:61
SampleValue::isNeighbour
virtual bool isNeighbour(const SampleValue *s) const
Definition: SampleValue.cc:47
SampleValue::operator!=
bool operator!=(const SampleValue &sv) const
Definition: SampleValue.h:118
SampleValue::EValue
EmbValue EValue
the bit that is embedded in this sample value - must be set in constructor of derived class
Definition: SampleValue.h:134
SampleValue::Label
unsigned long Label
Definition: SampleValue.h:140
EmbValue
BYTE EmbValue
Definition: common.h:66
common.h
SampleValueHash::operator()
size_t operator()(const SampleValue *s) const
Definition: SampleValue.h:164
SampleValue::decNumEdges
void decNumEdges(EmbValue t)
Definition: SampleValue.cc:41
SampleValue::getEmbeddedValue
EmbValue getEmbeddedValue(void) const
Definition: SampleValue.h:104
SampleValue::~SampleValue
virtual ~SampleValue(void)
Definition: SampleValue.cc:31
SampleValuesEqual
Definition: SampleValue.h:149
SampleValueHash
Definition: SampleValue.h:163
SampleValue::getKey
UWORD32 getKey(void) const
Definition: SampleValue.h:111