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

vidl2_ostream.h

Go to the documentation of this file.
00001 // This is brl/bbas/vidl2/vidl2_ostream.h
00002 #ifndef vidl2_ostream_h_
00003 #define vidl2_ostream_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief A base class for output 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 output video streams
00018 class vidl2_ostream
00019 {
00020  public:
00021   //: Constructor
00022   vidl2_ostream() : ref_count_(0) {}
00023   //: Destructor
00024   virtual ~vidl2_ostream() {}
00025 
00026   //: Close the stream
00027   virtual void close() = 0;
00028 
00029   //: Return true if the stream is open for writing
00030   virtual bool is_open() const = 0;
00031 
00032   //: Write and image to the stream
00033   // \retval false if the image could not be written
00034   virtual bool write_frame(const vidl2_frame_sptr& frame) = 0;
00035 
00036    private:
00037   //: prevent deep copying a stream
00038   vidl2_ostream(const vidl2_ostream& other):ref_count_(0){}
00039 
00040  //-------------------------------------------------------
00041  // reference counting
00042  public:
00043 
00044   //: Increment reference count
00045   void ref() { ref_count_++; }
00046 
00047   //: Decrement reference count
00048   void unref() { if (--ref_count_ <= 0) delete this; }
00049 
00050   //: Number of objects referring to this data
00051   int ref_count() const { return ref_count_; }
00052 
00053  private:
00054   int ref_count_;
00055 };
00056 
00057 #endif // vidl2_ostream_h_

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