Committer:
daan
Date:
Thu Dec 22 09:44:29 2011 +0000
Revision:
2:ce4c7e5ab241
Parent:
1:578d6bbe9f09

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
daan 1:578d6bbe9f09 1 #ifndef WRITER_EMBEDDED_H
daan 1:578d6bbe9f09 2 #define WRITER_EMBEDDED_H
daan 1:578d6bbe9f09 3
daan 1:578d6bbe9f09 4 #include "stdint.h"
daan 1:578d6bbe9f09 5 #include "WriterBase.h"
daan 1:578d6bbe9f09 6 #include "RingBuffer.h"
daan 1:578d6bbe9f09 7
daan 1:578d6bbe9f09 8 namespace olc {
daan 1:578d6bbe9f09 9
daan 1:578d6bbe9f09 10 /**
daan 1:578d6bbe9f09 11 * write ol commands to a bytestring.
daan 1:578d6bbe9f09 12 **/
daan 1:578d6bbe9f09 13
daan 1:578d6bbe9f09 14 template <class T>
daan 1:578d6bbe9f09 15 class WriterEmbedded : public WriterBase {
daan 1:578d6bbe9f09 16
daan 1:578d6bbe9f09 17 public:
daan 1:578d6bbe9f09 18 WriterEmbedded(T& aBuffer) : mBuffer(aBuffer) {
daan 1:578d6bbe9f09 19 };
daan 1:578d6bbe9f09 20 inline int size()
daan 1:578d6bbe9f09 21 {
daan 1:578d6bbe9f09 22 return mBuffer.size();
daan 1:578d6bbe9f09 23 };
daan 1:578d6bbe9f09 24 inline int spaceLeft()
daan 1:578d6bbe9f09 25 {
daan 1:578d6bbe9f09 26 return mBuffer.capacityLeft();
daan 1:578d6bbe9f09 27 };
daan 1:578d6bbe9f09 28
daan 1:578d6bbe9f09 29
daan 1:578d6bbe9f09 30 protected:
daan 1:578d6bbe9f09 31 T& mBuffer;
daan 1:578d6bbe9f09 32 void put(uint8_t aValue) {
daan 1:578d6bbe9f09 33 mBuffer.pushBack(aValue);
daan 1:578d6bbe9f09 34 };
daan 1:578d6bbe9f09 35 };
daan 1:578d6bbe9f09 36
daan 1:578d6bbe9f09 37 } // end namespace ol
daan 1:578d6bbe9f09 38
daan 1:578d6bbe9f09 39 #endif // WRITER_BASE_H