Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vidl2_istream.h

Go to the documentation of this file.
00001 // This is brl/bbas/vidl2/vidl2_istream.h
00002 #ifndef vidl2_istream_h_
00003 #define vidl2_istream_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief A base class for input video streams
00010 //
00011 // \author Matt Leotta
00012 // \date 19 Dec 2005
00013 
00014 #include "vidl2_frame_sptr.h"
00015 
00016 
00017 //: A base class for input video streams
00018 class vidl2_istream
00019 {
00020  public:
00021   //: Constructor
00022   vidl2_istream() : ref_count_(0) {}
00023   //: Destructor
00024   virtual ~vidl2_istream() {}
00025 
00026   //: Return true if the stream is open for reading
00027   virtual bool is_open() const = 0;
00028 
00029   //: Return true if the stream is in a valid state
00030   virtual bool is_valid() const = 0;
00031 
00032   //: Return true if the stream support seeking
00033   virtual bool is_seekable() const = 0;
00034 
00035   //: Return the current frame number
00036   virtual unsigned int frame_number() const = 0;
00037 
00038   //: Close the stream
00039   virtual void close() = 0;
00040 
00041   //: Advance to the next frame (but don't acquire an image)
00042   virtual bool advance() = 0 ;
00043 
00044   //: Read the next frame from the stream (advance and acquire)
00045   virtual vidl2_frame_sptr read_frame() = 0;
00046 
00047   //: Return the current frame in the stream
00048   virtual vidl2_frame_sptr current_frame() = 0;
00049 
00050   //: Seek to the given frame number
00051   // \returns true if successful
00052   virtual bool seek_frame(unsigned int frame_number) = 0;
00053 
00054  private:
00055   //: prevent deep copying a stream
00056   vidl2_istream(const vidl2_istream& other):ref_count_(0){}
00057 
00058  //-------------------------------------------------------
00059  // reference counting
00060  public:
00061 
00062   //: Increment reference count
00063   void ref() { ref_count_++; }
00064 
00065   //: Decrement reference count
00066   void unref() { if (--ref_count_ <= 0) delete this; }
00067 
00068   //: Number of objects referring to this data
00069   int ref_count() const { return ref_count_; }
00070 
00071  private:
00072   int ref_count_;
00073 };
00074 
00075 #endif // vidl2_istream_h_

Generated on Thu Jan 10 14:51:31 2008 for contrib/brl/bbas/vidl2 by  doxygen 1.4.4