Fawkes API  Fawkes Development Version
buffer.cpp
1 
2 /***************************************************************************
3  * buffer.cpp - Camera model for a simple buffer
4  *
5  * Created: Tue Mar 08 22:44:33 2016
6  * Copyright 2005-2016 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version. A runtime exception applies to
13  * this software (see LICENSE.GPL_WRE file mentioned below for details).
14  *
15  * This program 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 Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
21  */
22 
23 #include <fvcams/buffer.h>
24 
25 #include <cstdlib>
26 
27 
28 using namespace fawkes;
29 
30 namespace firevision {
31 #if 0 /* just to make Emacs auto-indent happy */
32 }
33 #endif
34 
35 /** @class BufferCamera <fvcams/buffer.h>
36  * Simple buffer with a Camera interface.
37  * This camera implementation provides a simple image buffer that can be
38  * modified externally and is wrapped using the standard Camera interface.
39  *
40  * @author Tim Niemueller
41  */
42 
43 
44 /** Constructor.
45  * @param cspace color space of image
46  * @param width width of image
47  * @param height height of image
48  */
49 BufferCamera::BufferCamera(colorspace_t cspace, unsigned int width, unsigned int height)
50 {
51  cspace_ = cspace;
52  width_ = width;
53  height_ = height;
54  buffer_ = malloc_buffer(cspace, width, height);
55  buffer_size_ = colorspace_buffer_size(cspace, width, height);
56 }
57 
58 
59 /** Destructor. */
60 BufferCamera::~BufferCamera()
61 {
62  free(buffer_);
63 }
64 
65 
66 void
67 BufferCamera::open()
68 {
69 }
70 
71 
72 void
73 BufferCamera::start()
74 {
75 }
76 
77 void
78 BufferCamera::stop()
79 {
80 }
81 
82 
83 void
84 BufferCamera::print_info()
85 {
86 }
87 
88 
89 void
90 BufferCamera::capture()
91 {
92 }
93 
94 
95 unsigned char*
96 BufferCamera::buffer()
97 {
98  return buffer_;
99 }
100 
101 
102 unsigned int
103 BufferCamera::buffer_size()
104 {
105  return buffer_size_;
106 }
107 
108 
109 void
110 BufferCamera::close()
111 {
112 }
113 
114 
115 void
116 BufferCamera::dispose_buffer()
117 {
118 }
119 
120 
121 void
122 BufferCamera::flush()
123 {
124 }
125 
126 
127 bool
128 BufferCamera::ready()
129 {
130  return true;
131 }
132 
133 
134 void
135 BufferCamera::set_image_number(unsigned int n)
136 {
137 }
138 
139 
140 unsigned int
141 BufferCamera::pixel_width()
142 {
143  return width_;
144 }
145 
146 
147 unsigned int
148 BufferCamera::pixel_height()
149 {
150  return height_;
151 }
152 
153 
154 colorspace_t
155 BufferCamera::colorspace()
156 {
157  return cspace_;
158 }
159 
160 } // end namespace firevision
Fawkes library namespace.