Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
shm_lut.h
1
2
/***************************************************************************
3
* shm_lut.h - shared memory lookup table
4
*
5
* Generated: Thu Feb 09 16:57:40 2006
6
* Copyright 2005-2007 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. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#ifndef __FIREVISION_FVUTILS_IPC_SHM_LUT_H_
25
#define __FIREVISION_FVUTILS_IPC_SHM_LUT_H_
26
27
#include <utils/ipc/shm.h>
28
#include <utils/ipc/shm_lister.h>
29
#include <fvutils/ipc/defs.h>
30
#include <stdint.h>
31
32
// Magic token to identify FireVision shared memory LUTs
33
#define FIREVISION_SHM_LUT_MAGIC_TOKEN "FireVision LUT"
34
35
namespace
firevision {
36
#if 0
/* just to make Emacs auto-indent happy */
37
}
38
#endif
39
40
/** Shared memory lookup table header struct. */
41
typedef
struct
{
42
char
lut_id[LUT_ID_MAX_LENGTH];
/**< LUT ID */
43
uint32_t
width
;
/**< LUT width */
44
uint32_t
height
;
/**< LUT height */
45
uint32_t
depth
;
/**< LUT depth */
46
uint32_t
bytes_per_cell
;
/**< Bytes per cell */
47
}
SharedMemoryLookupTable_header_t
;
48
49
50
class
SharedMemoryLookupTableHeader
:
public
fawkes::SharedMemoryHeader
51
{
52
public
:
53
SharedMemoryLookupTableHeader
();
54
SharedMemoryLookupTableHeader
(
const
char
*lut_id,
55
unsigned
int
width,
56
unsigned
int
height,
57
unsigned
int
bytes_per_cell);
58
SharedMemoryLookupTableHeader
(
const
char
*lut_id,
59
unsigned
int
width,
60
unsigned
int
height,
61
unsigned
int
depth,
62
unsigned
int
bytes_per_cell);
63
SharedMemoryLookupTableHeader
(
const
SharedMemoryLookupTableHeader
*h);
64
virtual
~
SharedMemoryLookupTableHeader
();
65
66
virtual
fawkes::SharedMemoryHeader
* clone()
const
;
67
virtual
bool
matches(
void
*memptr);
68
virtual
size_t
size();
69
virtual
bool
create();
70
virtual
void
initialize(
void
*memptr);
71
virtual
void
set
(
void
*memptr);
72
virtual
void
reset();
73
virtual
size_t
data_size();
74
virtual
bool
operator==(
const
fawkes::SharedMemoryHeader
& s)
const
;
75
76
virtual
void
print_info();
77
78
const
char
* lut_id()
const
;
79
void
set_lut_id(
const
char
*lut_id);
80
unsigned
int
width()
const
;
81
unsigned
int
height()
const
;
82
unsigned
int
depth()
const
;
83
unsigned
int
bytes_per_cell()
const
;
84
85
SharedMemoryLookupTable_header_t
* raw_header();
86
87
private
:
88
SharedMemoryLookupTable_header_t
*__header;
89
90
char
*__lut_id;
91
unsigned
int
__width;
92
unsigned
int
__height;
93
unsigned
int
__depth;
94
unsigned
int
__bytes_per_cell;
95
};
96
97
class
SharedMemoryLookupTableLister
:
public
fawkes::SharedMemoryLister
98
{
99
public
:
100
SharedMemoryLookupTableLister
();
101
virtual
~
SharedMemoryLookupTableLister
();
102
103
virtual
void
print_header();
104
virtual
void
print_footer();
105
virtual
void
print_no_segments();
106
virtual
void
print_no_orphaned_segments();
107
virtual
void
print_info(
const
fawkes::SharedMemoryHeader
*header,
108
int
shm_id,
int
semaphore,
unsigned
int
mem_size,
109
const
void
*memptr);
110
};
111
112
113
class
SharedMemoryLookupTable
:
public
fawkes::SharedMemory
114
{
115
116
public
:
117
118
SharedMemoryLookupTable
(
const
char
*lut_id,
119
unsigned
int
width,
unsigned
int
height,
120
unsigned
int
depth = 1,
121
unsigned
int
bytes_per_cell = 1
122
);
123
SharedMemoryLookupTable
(
const
char
*lut_id ,
bool
is_read_only =
true
);
124
~
SharedMemoryLookupTable
();
125
126
const
char
* lut_id()
const
;
127
bool
set_lut_id(
const
char
*lut_id);
128
unsigned
char
* buffer()
const
;
129
unsigned
int
width()
const
;
130
unsigned
int
height()
const
;
131
unsigned
int
depth()
const
;
132
unsigned
int
bytes_per_cell()
const
;
133
134
static
void
list();
135
static
void
cleanup(
bool
use_lister =
true
);
136
static
bool
exists(
const
char
*lut_id);
137
static
void
wipe(
const
char
*lut_id);
138
139
private
:
140
void
constructor(
const
char
*lut_id,
141
unsigned
int
width,
unsigned
int
height,
unsigned
int
depth,
142
unsigned
int
bytes_per_cell,
143
bool
is_read_only);
144
145
SharedMemoryLookupTableHeader
*__priv_header;
146
SharedMemoryLookupTable_header_t
*__raw_header;
147
148
char
*__lut_id;
149
unsigned
int
__width;
150
unsigned
int
__height;
151
unsigned
int
__depth;
152
unsigned
int
__bytes_per_cell;
153
154
};
155
156
}
// end namespace firevision
157
158
#endif
src
libs
fvutils
ipc
shm_lut.h
Generated by
1.8.3.1