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 the number of bytes used for the data returned by getImage() - if the data varies in size (e.g. jpeg compression), will return 0 if the image hasn't been calculated yet (so call it @e after getImage())
00042   virtual size_t getImageSize(unsigned int layer, unsigned int chan) const { return src->getImageSize(layer,chan); }
00043   
00044   //! returns width of the image in a given layer
00045   inline unsigned int getWidth(unsigned int layer) const { return src->getWidth(layer); }
00046   //! returns height of the image in a given layer
00047   inline unsigned int getHeight(unsigned int layer) const { return src->getHeight(layer); }
00048   //! returns the bytes to skip from the one-past-end of a row to get the beginning of the next
00049   inline unsigned int getSkip(unsigned int layer) const { return src->getSkip(layer); }
00050   //! returns the bytes to skip from the beginning of one row to get the beginning of the next
00051   /*! This is just for convenience; the stride is just the skip plus the width, but it's precomputed for you for speed and clarity */
00052   inline unsigned int getStride(unsigned int layer) const { return src->getStride(layer); }
00053   //! returns the increment to use to go from one sample to the next
00054   inline unsigned int getIncrement(unsigned int layer) const { return src->getIncrement(layer); }
00055 
00056   //! returns the frame number, see FilterBankGenerator::frameNumber
00057   inline unsigned int getFrameNumber() const { return src->getFrameNumber(); }
00058   //! returns the number of frames processed by the generator, see FilterBankGenerator::framesProcessed
00059   inline unsigned int getFramesProcessed() const { return src->getFramesProcessed(); }
00060   
00061   virtual classTypeID_t getClassTypeID() const { return autoRegisterFilterBankEvent; }
00062   
00063 protected:
00064   //! pointer to generator which created this event
00065   /*! the generator holds all the actual image data to be more memory efficient */
00066   FilterBankGenerator* src;
00067 
00068   //! causes class type id to automatically be regsitered with EventBase's FamilyFactory (getTypeRegistry())
00069   /*! This is instantiated in EventBase.cc to save on file bloat */
00070   static const EventBase::classTypeID_t autoRegisterFilterBankEvent;
00071   
00072   //! default constructor, only intended to be called from the FamilyFactory, followed by a loadXML...
00073   FilterBankEvent() : EventBase(), src(NULL) {}
00074   friend struct Factory0Arg<EventBase>::Factory<FilterBankEvent>;
00075 };
00076 
00077 /*! @file 
00078  * @brief Defines FilterBankEvent, an event for distributing raw image data
00079  * @author ejt (Creator)
00080  */
00081 
00082 #endif

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:38 2016 by Doxygen 1.6.3