Open Lighting Architecture
Latest Git
|
Used to hold a single universe of DMX data.
DmxBuffer is used to hold a single universe of DMX data. This class includes functions to translate to/from strings, and manipulate channels in the buffer.
Public Member Functions | |
DmxBuffer () | |
DmxBuffer (const DmxBuffer &other) | |
Copy constructor. We just copy the underlying pointers and mark m_copy_on_write as true if the other buffer has data. More... | |
DmxBuffer (const uint8_t *data, unsigned int length) | |
Create a new buffer from raw data. More... | |
DmxBuffer (const std::string &data) | |
Create a new buffer from a string. More... | |
~DmxBuffer () | |
Destructor. | |
DmxBuffer & | operator= (const DmxBuffer &other) |
Assignment operator used to make this buffer equal to another buffer. More... | |
bool | operator== (const DmxBuffer &other) const |
Equality operator used to check if two DmxBuffers are equal. More... | |
bool | operator!= (const DmxBuffer &other) const |
Inequality operator used to check if two DmxBuffers are not equal. More... | |
unsigned int | Size () const |
Current size of DmxBuffer. More... | |
bool | HTPMerge (const DmxBuffer &other) |
HTP Merge from another DmxBuffer. More... | |
bool | Set (const uint8_t *data, unsigned int length) |
Set the contents of this DmxBuffer. More... | |
bool | Set (const std::string &data) |
Set the contents of this DmxBuffer equal to the string. More... | |
bool | Set (const DmxBuffer &other) |
Sets the data in this buffer to be the same as the other one. This forces a copy of the data rather than using copy-on-write. More... | |
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. More... | |
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() first. Attempted to set data with an offset greater than Size() is an error. More... | |
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. Attempting to set data with an offset > Size() is an error. More... | |
void | SetChannel (unsigned int channel, uint8_t data) |
Set a single channel. Calling this on an uninitialized buffer will call Blackout() first. Trying to set a channel more than 1 channel past the end of the valid data is an error. More... | |
void | Get (uint8_t *data, unsigned int *length) const |
Get the contents of this DmxBuffer. This function copies the contents of the DmxBuffer into the memory region pointed to by data. More... | |
void | GetRange (unsigned int slot, uint8_t *data, unsigned int *length) const |
Get a range of values starting from a particular slot. More... | |
uint8_t | Get (unsigned int channel) const |
This function returns the value of a channel, and returns 0 if the buffer wasn't initialized or the channel was out-of-bounds. More... | |
const uint8_t * | GetRaw () const |
Get a raw pointer to the internal data. More... | |
std::string | Get () const |
Get the raw contents of the DmxBuffer as a string. More... | |
bool | Blackout () |
Set the buffer to all zeros. More... | |
void | Reset () |
Reset the buffer to hold no data. More... | |
std::string | ToString () const |
Convert the DmxBuffer to a human readable representation. More... | |
ola::DmxBuffer::DmxBuffer | ( | const DmxBuffer & | other | ) |
Copy constructor. We just copy the underlying pointers and mark m_copy_on_write as true if the other buffer has data.
other | The other DmxBuffer to copy from |
ola::DmxBuffer::DmxBuffer | ( | const uint8_t * | data, |
unsigned int | length | ||
) |
Create a new buffer from raw data.
data | is a pointer to an array of data used to populate DmxBuffer |
length | is the length of data in array data |
|
explicit |
Create a new buffer from a string.
data | is a string of raw data values |
bool ola::DmxBuffer::Blackout | ( | ) |
Set the buffer to all zeros.
void ola::DmxBuffer::Get | ( | uint8_t * | data, |
unsigned int * | length | ||
) | const |
uint8_t ola::DmxBuffer::Get | ( | unsigned int | channel | ) | const |
This function returns the value of a channel, and returns 0 if the buffer wasn't initialized or the channel was out-of-bounds.
channel | is the channel to return |
string ola::DmxBuffer::Get | ( | ) | const |
Get the raw contents of the DmxBuffer as a string.
void ola::DmxBuffer::GetRange | ( | unsigned int | slot, |
uint8_t * | data, | ||
unsigned int * | length | ||
) | const |
Get a range of values starting from a particular slot.
slot | is the dmx slot to start from | |
data | is a pointer to where you want to store the gathered data | |
[in,out] | length | is the length of the data you wish to retrieve |
|
inline |
Get a raw pointer to the internal data.
bool ola::DmxBuffer::HTPMerge | ( | const DmxBuffer & | other | ) |
bool ola::DmxBuffer::operator!= | ( | const DmxBuffer & | other | ) | const |
Inequality operator used to check if two DmxBuffers are not equal.
other | is the other DmxBuffer to check against |
Assignment operator used to make this buffer equal to another buffer.
other | the other DmxBuffer to copy/link from |
bool ola::DmxBuffer::operator== | ( | const DmxBuffer & | other | ) | const |
Equality operator used to check if two DmxBuffers are equal.
other | is the other DmxBuffer to check against |
void ola::DmxBuffer::Reset | ( | ) |
Reset the buffer to hold no data.
bool ola::DmxBuffer::Set | ( | const uint8_t * | data, |
unsigned int | length | ||
) |
bool ola::DmxBuffer::Set | ( | const std::string & | data | ) |
bool ola::DmxBuffer::Set | ( | const DmxBuffer & | other | ) |
void ola::DmxBuffer::SetChannel | ( | unsigned int | channel, |
uint8_t | data | ||
) |
Set a single channel. Calling this on an uninitialized buffer will call Blackout() first. Trying to set a channel more than 1 channel past the end of the valid data is an error.
channel | is the dmx channel you want to change |
data | is the value to set channel |
bool ola::DmxBuffer::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.
data | the string to split |
bool ola::DmxBuffer::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. Attempting to set data with an offset > Size() is an error.
offset | the starting channel |
data | a pointer to the new data |
length | the length of the data |
bool ola::DmxBuffer::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() first. Attempted to set data with an offset greater than Size() is an error.
offset | the starting channel |
data | is the value to set the range to |
length | the length of the range to set |
|
inline |
Current size of DmxBuffer.
string ola::DmxBuffer::ToString | ( | ) | const |
Convert the DmxBuffer to a human readable representation.