26 #ifndef INCLUDE_OLA_DMXBUFFER_H_ 27 #define INCLUDE_OLA_DMXBUFFER_H_ 70 DmxBuffer(
const uint8_t *data,
unsigned int length);
79 explicit DmxBuffer(
const std::string &data);
111 unsigned int Size()
const {
return m_length; }
127 bool Set(
const uint8_t *data,
unsigned int length);
135 bool Set(
const std::string &data);
179 unsigned int length);
190 bool SetRange(
unsigned int offset,
const uint8_t *data,
191 unsigned int length);
201 void SetChannel(
unsigned int channel, uint8_t data);
211 void Get(uint8_t *data,
unsigned int *length)
const;
219 void GetRange(
unsigned int slot, uint8_t *data,
220 unsigned int *length)
const;
229 uint8_t
Get(
unsigned int channel)
const;
235 const uint8_t *
GetRaw()
const {
return m_data; }
241 std::string
Get()
const;
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;
275 unsigned int m_length;
292 #endif // INCLUDE_OLA_DMXBUFFER_H_ bool operator==(const DmxBuffer &other) const
Equality operator used to check if two DmxBuffers are equal.
Definition: DmxBuffer.cpp:101
bool SetRangeToValue(unsigned int offset, uint8_t data, unsigned int length)
Set a Range of data to a single value. Calling this on an uninitialized buffer will call Blackout() f...
Definition: DmxBuffer.cpp:188
std::string Get() const
Get the raw contents of the DmxBuffer as a string.
Definition: DmxBuffer.cpp:287
bool Set(const uint8_t *data, unsigned int length)
Set the contents of this DmxBuffer.
Definition: DmxBuffer.cpp:137
bool SetRange(unsigned int offset, const uint8_t *data, unsigned int length)
Set a range of data. Calling this on an uninitialized buffer will call Blackout() first...
Definition: DmxBuffer.cpp:210
Used to hold a single universe of DMX data.
Definition: DmxBuffer.h:49
std::ostream & operator<<(std::ostream &out, const DmxBuffer &data)
Stream operator to allow DmxBuffer to be output to stdout.
Definition: DmxBuffer.cpp:402
DmxBuffer()
Definition: DmxBuffer.cpp:47
DmxBuffer & operator=(const DmxBuffer &other)
Assignment operator used to make this buffer equal to another buffer.
Definition: DmxBuffer.cpp:90
const uint8_t * GetRaw() const
Get a raw pointer to the internal data.
Definition: DmxBuffer.h:235
std::string ToString() const
Convert the DmxBuffer to a human readable representation.
Definition: DmxBuffer.cpp:316
void GetRange(unsigned int slot, uint8_t *data, unsigned int *length) const
Get a range of values starting from a particular slot.
Definition: DmxBuffer.cpp:262
~DmxBuffer()
Destructor.
Definition: DmxBuffer.cpp:85
void Reset()
Reset the buffer to hold no data.
Definition: DmxBuffer.cpp:309
bool Blackout()
Set the buffer to all zeros.
Definition: DmxBuffer.cpp:294
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
bool SetFromString(const std::string &data)
Set values from a string. Convert a comma separated list of values into for the DmxBuffer. Invalid values are set to 0. 0s can be dropped between the commas.
Definition: DmxBuffer.cpp:163
bool HTPMerge(const DmxBuffer &other)
HTP Merge from another DmxBuffer.
Definition: DmxBuffer.cpp:113
unsigned int Size() const
Current size of DmxBuffer.
Definition: DmxBuffer.h:111
bool operator!=(const DmxBuffer &other) const
Inequality operator used to check if two DmxBuffers are not equal.
Definition: DmxBuffer.cpp:108
void SetChannel(unsigned int channel, uint8_t data)
Set a single channel. Calling this on an uninitialized buffer will call Blackout() first...
Definition: DmxBuffer.cpp:232