CVD 0.8
cvd/localvideoframe.h
00001 /*                       
00002     This file is part of the CVD Library.
00003 
00004     Copyright (C) 2005 The Authors
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Lesser General Public
00008     License as published by the Free Software Foundation; either
00009     version 2.1 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Lesser General Public License for more details.
00015 
00016     You should have received a copy of the GNU Lesser General Public
00017     License along with this library; if not, write to the Free Software
00018     Foundation, Inc., 
00019     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 */
00021 /*******************************************************************************
00022                                                                   
00023    LocalVideoFrame - A video frame for when the data is local snd should be
00024                      managed by the program instead of the system. Uses Image
00025                      to manage the memory. Programs which will only ever use 
00026                      these can be optimized by using the image() methos. These
00027                      can be deleted sensibly, but it is not currently allowed, 
00028                      to make the interface more consistent.
00029                                                                
00030    E. Rosten       - 18 March 2005
00031                                                              
00032 *******************************************************************************/
00033 
00034 
00035 #ifndef CVD_LOCALVIDEOFRAME_FRAME_H
00036 #define CVD_LOCALVIDEOFRAME_FRAME_H
00037 
00038 #include <cvd/videoframe.h>
00039 #include <string>
00040 
00041 namespace CVD
00042 {
00050     template<class T> 
00051     class LocalVideoFrame: public VideoFrame<T>
00052     {
00053 
00054         public:
00055 
00056             virtual ~LocalVideoFrame()
00057             {
00058             }
00059             
00063             LocalVideoFrame(double time, CVD::Image<T>& local)
00064             :VideoFrame<T>(time, local.data(), local.size()),
00065              im(local)
00066             {
00067             }   
00068 
00071                 Image<T>& image()
00072             {
00073                 return im;
00074             }
00075                 const Image<T>& image() const
00076             {
00077                 return im;
00078             }
00079 
00080             double& timestamp() 
00081               {
00082                 return this->my_timestamp;
00083               }
00084 
00085         private:
00086             CVD::Image<T>         im;
00087     };
00088 }
00089 
00090 
00091 #endif