![]() |
PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
Provide a communication buffer for character data between cogs. More...
#include <PropWare/utility/collection/charqueue.h>
Inheritance diagram for PropWare::CharQueue:
Collaboration diagram for PropWare::CharQueue:Public Member Functions | |
| template<size_t N> | |
| CharQueue (char(&array)[N], const int lockNumber=locknew()) | |
| CharQueue (char *array, const size_t length, const int lockNumber) | |
| virtual char | get_char () |
| Read and return a single character. Whether the method is blocking or not depends entirely on the implementation. | |
| virtual void | put_char (const char c) |
| Print a single character. More... | |
| virtual void | puts (const char *string) |
| size_t | size () const |
| Obtain the number of elements in the queue. More... | |
| bool | is_empty () const |
| Determine if any elements exist. More... | |
| bool | is_full () const |
| Determine if inserting another element would overwrite data. More... | |
| void | clear () |
| Remove all data from the queue. | |
| virtual Queue & | enqueue (const char &value) |
| Insert an element to the buffer. More... | |
| Queue & | insert (const char &value) |
| virtual char | dequeue () |
| Return and remove the oldest value in the buffer. More... | |
| char | peek () const |
| Return the oldest value in the buffer without removing it from the buffer. More... | |
| bool | check (const char &value) const |
| Determine if a value is valid. More... | |
| virtual void | puts (const char string[])=0 |
| Send a null-terminated character array. Though this method could be created using put_char, some objects (such as PropWare::UART), have optimized methods for sending a string and PrintCapable::puts can utilize them. More... | |
Provide a communication buffer for character data between cogs.
Typically used for buffered UART implementations. Note that the put_char and get_char methods are blocking to ensure that put_char does not attempt to write to a full buffer and get_char does not attempt to read from an empty buffer. For this reason, you should be careful about using the enqueue and dequeue methods directly when using a CharQueue object because they will allow you to write to a full queue and read from an empty one.
Definition at line 46 of file charqueue.h.
|
inherited |
Determine if a value is valid.
If the queue is read (deque or peek) when the size is 0 then a value at address 0 is returned. A better implementation would throw an exception when this occurs, but that isn't feasible on the Propeller. Use this method if you want to ensure values are valid prior to using them
| [in] | value | A value returned by PropWare::Queue::peek() or PropWare::Queue::dequeue() |
|
virtualinherited |
|
virtualinherited |
Insert an element to the buffer.
| [in] | value | Value to be inserted at the end of the buffer |
value parameterPropWare::Queue::enqueue, the Queue instance is returned
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
virtual |
Print a single character.
| [in] | c | Individual char to be printed |
Implements PropWare::PrintCapable.
Definition at line 64 of file charqueue.h.
Here is the call graph for this function:
|
pure virtualinherited |
Send a null-terminated character array. Though this method could be created using put_char, some objects (such as PropWare::UART), have optimized methods for sending a string and PrintCapable::puts can utilize them.
string[] must be terminated with a null terminator| [in] | string[] | Array of data words with the final word being 0 - the null terminator |
Implemented in PropWare::SPI, PropWare::HD44780, PropWare::UARTTX, PropWare::FullDuplexSerial, PropWare::FileWriter, PropWare::StringBuilder, PropWare::StaticStringBuilder, and SimplePrinter.
Here is the caller graph for this function:
|
inherited |
1.8.17