Now you can download a copy of these docs so you can use them offline! Download now
DataIOStream.h
1 #ifndef DATAIOSTREAM_H_
2 #define DATAIOSTREAM_H_
3 
4 #include <stdlib.h>
5 #include "networktables2/stream/IOStream.h"
6 #include <exception>
7 #include <string>
8 
9 #ifndef _WRS_KERNEL
10 #include <stdint.h>
11 #endif
12 
13 #include <stdlib.h>
14 #include <memory>
15 
16 //WindRiver is 3.4 GCC. Recent GCC can do 0b01010101 style format, WR cannot
17 
18 #define TO_HEX__(n) 0x##n##LU // LU for unsigned long
19 #define BINARY_LITERAL_VIA_HEX__(n) (((n & 0x00000001LU) ? 1 : 0)\
20  + ((n & 0x00000010LU) ? 2 : 0) \
21  + ((n & 0x00000100LU) ? 4 : 0) \
22  + ((n & 0x00001000LU) ? 8 : 0) \
23  + ((n & 0x00010000LU) ? 16 : 0) \
24  + ((n & 0x00100000LU) ? 32 : 0) \
25  + ((n & 0x01000000LU) ? 64 : 0) \
26  + ((n & 0x10000000LU) ? 128 : 0))
27 
28 #define b(n) ((unsigned char)BINARY_LITERAL_VIA_HEX__(TO_HEX__(n)))
29 
31 public:
32  DataIOStream(IOStream* stream);
33  virtual ~DataIOStream();
34  void writeByte(uint8_t b);
35  void write2BytesBE(uint16_t s);
36  void writeString(std::string& str);
37  void flush();
38 
39  uint8_t readByte();
40  uint16_t read2BytesBE();
41  std::string* readString();
42 
43  void close();
44  void SetIOStream(IOStream* stream);
45 
46 //private:
47  IOStream *iostream;
48 };
49 
50 
51 #endif

Generated on Sat Apr 26 2014 12:26:45 for WPILibC++ by doxygen 1.8.6