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 using namespace fawkes;
28 
29 namespace firevision {
30 
31 /** @class BufferCamera <fvcams/buffer.h>
32  * Simple buffer with a Camera interface.
33  * This camera implementation provides a simple image buffer that can be
34  * modified externally and is wrapped using the standard Camera interface.
35  *
36  * @author Tim Niemueller
37  */
38 
39 /** Constructor.
40  * @param cspace color space of image
41  * @param width width of image
42  * @param height height of image
43  */
44 BufferCamera::BufferCamera(colorspace_t cspace, unsigned int width, unsigned int height)
45 {
46  cspace_ = cspace;
47  width_ = width;
48  height_ = height;
49  buffer_ = malloc_buffer(cspace, width, height);
50  buffer_size_ = colorspace_buffer_size(cspace, width, height);
51 }
52 
53 /** Destructor. */
54 BufferCamera::~BufferCamera()
55 {
56  free(buffer_);
57 }
58 
59 void
60 BufferCamera::open()
61 {
62 }
63 
64 void
65 BufferCamera::start()
66 {
67 }
68 
69 void
70 BufferCamera::stop()
71 {
72 }
73 
74 void
75 BufferCamera::print_info()
76 {
77 }
78 
79 void
80 BufferCamera::capture()
81 {
82 }
83 
84 unsigned char *
85 BufferCamera::buffer()
86 {
87  return buffer_;
88 }
89 
90 unsigned int
91 BufferCamera::buffer_size()
92 {
93  return buffer_size_;
94 }
95 
96 void
97 BufferCamera::close()
98 {
99 }
100 
101 void
102 BufferCamera::dispose_buffer()
103 {
104 }
105 
106 void
107 BufferCamera::flush()
108 {
109 }
110 
111 bool
112 BufferCamera::ready()
113 {
114  return true;
115 }
116 
117 void
118 BufferCamera::set_image_number(unsigned int n)
119 {
120 }
121 
122 unsigned int
123 BufferCamera::pixel_width()
124 {
125  return width_;
126 }
127 
128 unsigned int
129 BufferCamera::pixel_height()
130 {
131  return height_;
132 }
133 
134 colorspace_t
135 BufferCamera::colorspace()
136 {
137  return cspace_;
138 }
139 
140 } // end namespace firevision
fawkes