Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

SketchIndices.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_SketchIndices_h
00003 #define INCLUDED_SketchIndices_h
00004 
00005 #include <iosfwd> // forward declaration for ostream
00006 #include <ext/hash_set>
00007 
00008 #include "SketchTypes.h"
00009 
00010 namespace DualCoding {
00011 
00012 class SketchSpace;
00013 template<class T> class Sketch;
00014 
00015 //! Table of indices of sketch elements; parent of the Region class
00016 class SketchIndices {
00017  public:
00018   typedef __gnu_cxx::hash_set<uint, __gnu_cxx::hash<uint>, std::equal_to<uint> > SketchIndicesTable;
00019   typedef SketchIndicesTable::const_iterator CI;
00020 
00021   SketchIndicesTable table;
00022   
00023   //! Constructor
00024   SketchIndices() : table() {};
00025 
00026   //! Destructor
00027   virtual ~SketchIndices() {};
00028   
00029   //! Operator for indirection based on passed in Sketch.
00030   //! Returns a new SketchIndices based on applying the indirection.
00031   const SketchIndices operator[] (const Sketch<uint>& indirection) const;
00032   
00033   //! Returns the result of adding the elements of another SketchIndices
00034   //! to the current SketchIndices
00035   const SketchIndices operator+ (const SketchIndices& other) const;
00036   
00037   //! Returns the result of removing the elements of another SketchIndices
00038   //! from the current SketchIndices.
00039   //! This is much more computationally expensive than addition, so try
00040   //! to minimize usage by distribution law: x-y-z=x-(y+z)
00041   const SketchIndices operator- (const SketchIndices& other) const;
00042 
00043   //! Adds indices of non-zero pixels.
00044   void addIndices(const Sketch<bool>& im);
00045 
00046   //! Removes any indices from SketchIndices which are outside the bounds of the SketchSpace
00047   void trimBounds(const SketchSpace &space);
00048   
00049 private:
00050 };
00051 
00052 //! prints out SketchIndices for debugging
00053 std::ostream& operator<< (std::ostream& out, const SketchIndices &s);
00054 
00055 } // namespace
00056 
00057 #endif

DualCoding 4.0
Generated Thu Nov 22 00:52:36 2007 by Doxygen 1.5.4