WPILib 2012
WPILibRoboticsLibraryforFRC
NetworkTables/Buffer.h
00001 /*----------------------------------------------------------------------------*/
00002 /* Copyright (c) FIRST 2011. All Rights Reserved.                             */
00003 /* Open Source Software - may be modified and shared by FRC teams. The code   */
00004 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */
00005 /*----------------------------------------------------------------------------*/
00006 
00007 #ifndef __BUFFER_H__
00008 #define __BUFFER_H__
00009 
00010 #include "ErrorBase.h"
00011 #include <vxWorks.h>
00012 #include <string>
00013 
00014 namespace NetworkTables
00015 {
00016 
00017 class Buffer : public ErrorBase
00018 {
00019 public:
00020         Buffer(UINT32 capacity);
00021         ~Buffer();
00022         void WriteString(UINT32 length, const char *entry);
00023         void WriteString(const char *entry);
00024         void WriteString(std::string entry);
00025         void WriteDouble(double entry);
00026         void WriteInt(UINT32 entry);
00027         void WriteId(UINT32 id);
00028         void WriteTableId(UINT32 id);
00029         void WriteBytes(UINT32 length, const UINT8 *entries);
00030         void WriteByte(UINT8 entry);
00031         void Flush(int socket);
00032         void Clear();
00033 
00034 private:
00035         void WriteVariableSize(UINT32 tag, UINT32 id);
00036 
00037         UINT8 *m_buffer;
00038         UINT32 m_size;
00039         UINT32 m_capacity;
00040 };
00041 
00042 } // namespace
00043 
00044 #endif
00045 
 All Classes Functions Variables