Open Lighting Architecture
Main Page
Modules
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
ola
DmxBuffer.h
Go to the documentation of this file.
1
/*
2
* This library is free software; you can redistribute it and/or
3
* modify it under the terms of the GNU Lesser General Public
4
* License as published by the Free Software Foundation; either
5
* version 2.1 of the License, or (at your option) any later version.
6
*
7
* This library is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
* Lesser General Public License for more details.
11
*
12
* You should have received a copy of the GNU Lesser General Public
13
* License along with this library; if not, write to the Free Software
14
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
*
16
* DmxBuffer.h
17
* Interface for the DmxBuffer
18
* Copyright (C) 2005-2009 Simon Newton
19
*/
20
26
#ifndef INCLUDE_OLA_DMXBUFFER_H_
27
#define INCLUDE_OLA_DMXBUFFER_H_
28
29
#include <stdint.h>
30
#include <iostream>
31
#include <string>
32
33
34
namespace
ola {
35
36
using
std::string;
37
51
class
DmxBuffer
{
52
public
:
57
DmxBuffer
();
58
65
DmxBuffer
(
const
DmxBuffer
&other);
66
72
DmxBuffer
(
const
uint8_t *data,
unsigned
int
length);
73
81
explicit
DmxBuffer
(
const
string
&data);
82
86
~DmxBuffer
();
87
93
DmxBuffer
&
operator=
(
const
DmxBuffer
&other);
94
100
bool
operator==
(
const
DmxBuffer
&other)
const
;
101
107
bool
operator!=
(
const
DmxBuffer
&other)
const
;
108
113
unsigned
int
Size
()
const
{
return
m_length; }
114
120
bool
HTPMerge
(
const
DmxBuffer
&other);
121
129
bool
Set
(
const
uint8_t *data,
unsigned
int
length);
130
137
bool
Set
(
const
string
&data);
138
146
bool
Set
(
const
DmxBuffer
&other);
147
168
bool
SetFromString
(
const
string
&data);
169
180
bool
SetRangeToValue
(
unsigned
int
offset, uint8_t data,
181
unsigned
int
length);
182
192
bool
SetRange
(
unsigned
int
offset,
const
uint8_t *data,
193
unsigned
int
length);
194
203
void
SetChannel
(
unsigned
int
channel, uint8_t data);
204
213
void
Get
(uint8_t *data,
unsigned
int
*length)
const
;
214
221
void
GetRange
(
unsigned
int
slot, uint8_t *data,
222
unsigned
int
*length)
const
;
223
231
uint8_t
Get
(
unsigned
int
channel)
const
;
232
237
const
uint8_t *
GetRaw
()
const
{
return
m_data; }
238
243
string
Get
()
const
;
244
249
bool
Blackout
();
250
255
void
Reset
();
256
267
string
ToString
()
const
;
268
269
private
:
270
bool
Init();
271
bool
DuplicateIfNeeded();
272
void
CopyFromOther(
const
DmxBuffer
&other);
273
void
CleanupMemory();
274
unsigned
int
*m_ref_count;
275
mutable
bool
m_copy_on_write;
276
uint8_t *m_data;
277
unsigned
int
m_length;
278
};
279
292
std::ostream&
operator<<
(std::ostream &out,
const
DmxBuffer &data);
293
}
// namespace ola
294
#endif // INCLUDE_OLA_DMXBUFFER_H_
Generated on Fri Apr 4 2014 11:54:22 for Open Lighting Architecture by
1.8.1.2