daniel saakes / Olc
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WriterEmbedded.h Source File

WriterEmbedded.h

00001 #ifndef WRITER_EMBEDDED_H
00002 #define WRITER_EMBEDDED_H
00003 
00004 #include "stdint.h"
00005 #include "WriterBase.h"
00006 #include "RingBuffer.h"
00007 
00008 namespace olc {
00009   
00010 /**
00011  *   write ol commands to a bytestring. 
00012  **/
00013 
00014 template <class T>
00015 class WriterEmbedded : public WriterBase {
00016 
00017 public:
00018   WriterEmbedded(T& aBuffer) : mBuffer(aBuffer) {
00019   };
00020   inline int size() 
00021   { 
00022     return mBuffer.size(); 
00023   };
00024   inline int spaceLeft()
00025   {
00026     return mBuffer.capacityLeft();
00027   };
00028 
00029   
00030   protected:
00031   T& mBuffer;
00032   void put(uint8_t aValue) { 
00033     mBuffer.pushBack(aValue);  
00034   };  
00035 };
00036 
00037 } // end namespace ol
00038 
00039 #endif // WRITER_BASE_H