Fawkes API
Fawkes Development Version
transfer_thread.h
1
2
/***************************************************************************
3
* transfer_thread.h - OpenNI Visualization: network transfer thread
4
*
5
* Created: Sat Apr 02 20:00:50 2011
6
* Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
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 file in the doc directory.
21
*/
22
23
#include <core/threading/thread.h>
24
25
#include <map>
26
#include <string>
27
28
namespace
fawkes
{
29
class
ReadWriteLock;
30
}
31
32
namespace
firevision {
33
class
Camera;
34
}
35
36
class
PclViewerTransferThread
:
public
fawkes::Thread
37
{
38
public
:
39
PclViewerTransferThread
();
40
~PclViewerTransferThread
();
41
42
void
loop
();
43
44
void
lock_for_read
();
45
void
unlock
();
46
void
add_camera
(std::string
name
,
firevision::Camera
*cam);
47
48
/** Get buffer for specified camera.
49
* @param name the name passed to add_camera.
50
* @return buffer that contains a copy of the image
51
*/
52
const
unsigned
char
*
53
buffer
(std::string
name
)
54
{
55
return
buffers_[
name
];
56
}
57
58
private
:
59
std::map<std::string, firevision::Camera *> cams_;
60
std::map<std::string, unsigned char *> buffers_;
61
std::map<std::string, size_t> buffer_sizes_;
62
fawkes::ReadWriteLock
* rwlock_;
63
};
PclViewerTransferThread
Definition:
transfer_thread.h:35
PclViewerTransferThread::loop
void loop()
Code to execute in the thread.
Definition:
transfer_thread.cpp:91
fawkes::Thread::name
const char * name() const
Definition:
thread.h:99
PclViewerTransferThread::~PclViewerTransferThread
~PclViewerTransferThread()
Destructor.
Definition:
transfer_thread.cpp:50
fawkes::ReadWriteLock
Definition:
read_write_lock.h:35
fawkes
PclViewerTransferThread::buffer
const unsigned char * buffer(std::string name)
Get buffer for specified camera.
Definition:
transfer_thread.h:52
PclViewerTransferThread::PclViewerTransferThread
PclViewerTransferThread()
Constructor.
Definition:
transfer_thread.cpp:43
PclViewerTransferThread::lock_for_read
void lock_for_read()
Lock for reading.
Definition:
transfer_thread.cpp:65
fawkes::Thread
Definition:
thread.h:44
firevision::Camera
Definition:
camera.h:36
PclViewerTransferThread::unlock
void unlock()
Unlock.
Definition:
transfer_thread.cpp:72
PclViewerTransferThread::add_camera
void add_camera(std::string name, firevision::Camera *cam)
Add a camera from which to pull images.
Definition:
transfer_thread.cpp:82
src
plugins
openni
pclviewer
transfer_thread.h
Generated by
1.8.16