Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

FilterBankEvent.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_FilterBankEvent_h_
00003 #define INCLUDED_FilterBankEvent_h_
00004 
00005 #include "Events/EventBase.h"
00006 #include "Vision/FilterBankGenerator.h"
00007 #include "Shared/Factories.h"
00008 
00009 //! This event gives access to a set of image channels at different resolutions, see FilterBankGenerator
00010 class FilterBankEvent : public EventBase {
00011 public:
00012   //! constructor
00013   FilterBankEvent(FilterBankGenerator* creator,EventBase::EventGeneratorID_t gid,size_t sid,EventBase::EventTypeID_t tid)
00014     : EventBase(gid,sid,tid,0,creator->getName()), src(creator)
00015   {}
00016 
00017   //! copy constructor (shallow copy -- the generator shouldn't be going anywhere)
00018   FilterBankEvent(const FilterBankEvent& fbk) : EventBase(fbk), src(fbk.src) {}
00019   
00020   //! assignment operator  (shallow copy -- the generator shouldn't be going anywhere)
00021   const FilterBankEvent& operator=(const FilterBankEvent& fbk) { EventBase::operator=(fbk); src=fbk.src; return *this; }
00022 
00023   virtual EventBase* clone() const { return new FilterBankEvent(*this); }
00024 
00025   //don't do this until we actually override the LoadSave interface
00026   //virtual unsigned int getClassTypeID() const { return makeClassTypeID("FBKE"); }
00027 
00028   //! Gives access to underlying generator
00029   inline FilterBankGenerator* getSource() const { return src; }
00030 
00031   //! returns the number of image layers (e.g. different resolutions available)
00032   inline unsigned int getNumLayers() const { return src->getNumLayers(); }
00033 
00034   //! returns the number of channels per image (e.g. Y, U, or V components)
00035   inline unsigned int getNumChannels() const { return src->getNumChannels(); }
00036 
00037   //! returns pointer to the beginning of the image data for the specified layer and channel
00038   /*! this will cause the data to be calculated and cached if it's not already available */
00039   inline unsigned char * getImage(unsigned int layer, unsigned int channel) const { return src->getImage(layer,channel); }
00040 
00041   //! returns width of the image in a given layer
00042   inline unsigned int getWidth(unsigned int layer) const { return src->getWidth(layer); }
00043   //! returns height of the image in a given layer
00044   inline unsigned int getHeight(unsigned int layer) const { return src->getHeight(layer); }
00045   //! returns the bytes to skip from the one-past-end of a row to get the beginning of the next
00046   inline unsigned int getSkip(unsigned int layer) const { return src->getSkip(layer); }
00047   //! returns the bytes to skip from the beginning of one row to get the beginning of the next
00048   /*! This is just for convenience; the stride is just the skip plus the width, but it's precomputed for you for speed and clarity */
00049   inline unsigned int getStride(unsigned int layer) const { return src->getStride(layer); }
00050   //! returns the increment to use to go from one sample to the next
00051   inline unsigned int getIncrement(unsigned int layer) const { return src->getIncrement(layer); }
00052 
00053   //! returns the frame number, see FilterBankGenerator::frameNumber
00054   inline unsigned int getFrameNumber() const { return src->getFrameNumber(); }
00055   //! returns the number of frames processed by the generator, see FilterBankGenerator::framesProcessed
00056   inline unsigned int getFramesProcessed() const { return src->getFramesProcessed(); }
00057   
00058   virtual classTypeID_t getClassTypeID() const { return autoRegisterFilterBankEvent; }
00059   
00060 protected:
00061   //! pointer to generator which created this event
00062   /*! the generator holds all the actual image data to be more memory efficient */
00063   FilterBankGenerator* src;
00064 
00065   //! causes class type id to automatically be regsitered with EventBase's FamilyFactory (getTypeRegistry())
00066   /*! This is instantiated in EventBase.cc to save on file bloat */
00067   static const EventBase::classTypeID_t autoRegisterFilterBankEvent;
00068   
00069   //! default constructor, only intended to be called from the FamilyFactory, followed by a loadXML...
00070   FilterBankEvent() : EventBase(), src(NULL) {}
00071   friend struct Factory0Arg<EventBase>::Factory<FilterBankEvent>;
00072 };
00073 
00074 /*! @file 
00075  * @brief Defines FilterBankEvent, an event for distributing raw image data
00076  * @author ejt (Creator)
00077  *
00078  * $Author: ejt $
00079  * $Name: tekkotsu-4_0 $
00080  * $Revision: 1.13 $
00081  * $State: Exp $
00082  * $Date: 2007/11/13 04:16:02 $
00083  */
00084 
00085 #endif

Tekkotsu v4.0
Generated Thu Nov 22 00:54:53 2007 by Doxygen 1.5.4