Open Lighting Architecture
0.9.0
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
49
class
DmxBuffer
{
50
public
:
55
DmxBuffer
();
56
63
DmxBuffer
(
const
DmxBuffer
&other);
64
70
DmxBuffer
(
const
uint8_t *data,
unsigned
int
length);
71
79
explicit
DmxBuffer
(
const
std::string &data);
80
84
~DmxBuffer
();
85
91
DmxBuffer
&
operator=
(
const
DmxBuffer
&other);
92
98
bool
operator==
(
const
DmxBuffer
&other)
const
;
99
105
bool
operator!=
(
const
DmxBuffer
&other)
const
;
106
111
unsigned
int
Size
()
const
{
return
m_length; }
112
118
bool
HTPMerge
(
const
DmxBuffer
&other);
119
127
bool
Set
(
const
uint8_t *data,
unsigned
int
length);
128
135
bool
Set
(
const
std::string &data);
136
144
bool
Set
(
const
DmxBuffer
&other);
145
166
bool
SetFromString
(
const
std::string &data);
167
178
bool
SetRangeToValue
(
unsigned
int
offset, uint8_t data,
179
unsigned
int
length);
180
190
bool
SetRange
(
unsigned
int
offset,
const
uint8_t *data,
191
unsigned
int
length);
192
201
void
SetChannel
(
unsigned
int
channel, uint8_t data);
202
211
void
Get
(uint8_t *data,
unsigned
int
*length)
const
;
212
219
void
GetRange
(
unsigned
int
slot, uint8_t *data,
220
unsigned
int
*length)
const
;
221
229
uint8_t
Get
(
unsigned
int
channel)
const
;
230
235
const
uint8_t *
GetRaw
()
const
{
return
m_data; }
236
241
std::string
Get
()
const
;
242
247
bool
Blackout
();
248
253
void
Reset
();
254
265
std::string
ToString
()
const
;
266
267
private
:
268
bool
Init();
269
bool
DuplicateIfNeeded();
270
void
CopyFromOther(
const
DmxBuffer
&other);
271
void
CleanupMemory();
272
unsigned
int
*m_ref_count;
273
mutable
bool
m_copy_on_write;
274
uint8_t *m_data;
275
unsigned
int
m_length;
276
};
277
290
std::ostream&
operator<<
(std::ostream &out,
const
DmxBuffer &data);
291
}
// namespace ola
292
#endif // INCLUDE_OLA_DMXBUFFER_H_
Generated on Fri Apr 4 2014 11:46:03 for Open Lighting Architecture by
1.8.1.2