Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
VideoShMFeeder.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 #ifndef __VIDEOSHMFEEDER_HH__
26 #define __VIDEOSHMFEEDER_HH__
27 
28 
29 
30 
31 #ifdef WIN32
32 # define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
33 # include <windows.h>
34 # ifdef BIAS_HAVE_WXWIDGETS
35 # include <wx/msw/winundef.h>
36 # endif
37 #else
38 # include <sys/types.h>
39 # include <sys/mman.h>
40 #include <fcntl.h>
41 #endif
42 
43 
44 #include <sstream>
45 #include <string>
46 
47 // BIAS
48 #include <Base/Debug/Debug.hh>
49 #include <Base/Image/ImageIO.hh>
50 #include <Image/Camera.hh>
51 
52 // MIP
53 #include <VideoSource/VideoSource_Shm.hh>
54 
55 
56 namespace BIAS {
57 
58 /** @class VideoShMFeeder
59  @ingroup g_videosource
60  @brief class to save Images to a Sharerd memory
61 
62  @autor ischiller 2006
63 */
64 class BIASVideoSource_EXPORT VideoShMFeeder :public BIAS::Debug {
65 public:
67  VideoShMFeeder(const std::string &filename );
68  ~VideoShMFeeder();
69 
70  bool ProcessImage(BIAS::Camera<unsigned char> *Image);
71 
72 protected:
73  bool Init_();
74 
75 #ifdef WIN32
76  HANDLE ShmContext_; // _hFile
77  HANDLE Mapping_;//! header describing the memory layout
78  long int Granularity_;
79 #else
81 #endif
82 
85  void *Shm_;
87  std::stringstream ImgBuffer_;
88  unsigned char *Data_;
90  std::string FileName_;
91 
92 protected:
93  /*!\brief prohibit default function (move to 'public' if needed) */
94  VideoShMFeeder(const VideoShMFeeder &source);
95  /*!\brief prohibit default function (move to 'public' if needed) */
96  VideoShMFeeder& operator =(const VideoShMFeeder &source);
97 
98 }; // class VideoShMFeeder
99 
100 } // namespace MIP
101 
102 
103 #endif
104 
105 
VideoSource_Shm::ShmImageHeader * Header_
unsigned char * Data_
std::stringstream ImgBuffer_
The image template class for specific storage types.
Definition: Image.hh:78
class to save Images to a Sharerd memory