ISStream.h
Go to the documentation of this file.
1 /*
2 MIT LICENSE
3 
4 Copyright (c) 2014-2021 Inertial Sense, Inc. - http://inertialsense.com
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
7 
8 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 
10 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 */
12 
13 #ifndef __ISSTREAM_H__
14 #define __ISSTREAM_H__
15 
16 #include <stdio.h>
17 #include <string>
18 #include <iostream>
19 #include <string>
20 #include <inttypes.h>
21 
22 #include "ISConstants.h"
23 
27 class cISStream
28 {
29 public:
31  cISStream() {}
32 
37  virtual ~cISStream();
38 
45  virtual int Read(void* buffer, int count) { (void)buffer; (void)count; return -1; }
46 
53  virtual int Write(const void* buffer, int count) { (void)buffer; (void)count; return -1; }
54 
59  virtual int Flush() { return -1; }
60 
65  virtual int Close() { return -1; }
66 
71  virtual long long GetBytesAvailableToRead() { return -1; }
72 
73 private:
74  cISStream(const cISStream& copy); // Disable copy constructor
75 };
76 
77 class cISFileStream : public cISStream
78 {
79 public:
81  cISFileStream();
82 
89  bool Open(const std::string& path, const char* mode);
90 
97  int Read(void* buffer, int count) OVERRIDE;
98 
105  int Write(const void* buffer, int count) OVERRIDE;
106 
111  int Flush() OVERRIDE;
112 
117  int Close() OVERRIDE;
118 
123  long long GetBytesAvailableToRead() OVERRIDE;
124 
129  bool Eof();
130 
131 private:
132  cISFileStream(const cISFileStream& copy); // Disable copy constructor
133 
134  FILE* m_file;
135 };
136 
137 #endif // __BASE_STREAM_H__
#define OVERRIDE
Definition: ISConstants.h:423
size_t count(InputIterator first, InputIterator last, T const &item)
Definition: catch.hpp:3206
virtual int Flush()
Definition: ISStream.h:59
virtual ~cISStream()
Definition: ISStream.cpp:20
virtual long long GetBytesAvailableToRead()
Definition: ISStream.h:71
FILE * m_file
Definition: ISStream.h:134
cISStream()
Definition: ISStream.h:31
virtual int Read(void *buffer, int count)
Definition: ISStream.h:45
virtual int Write(const void *buffer, int count)
Definition: ISStream.h:53
virtual int Close()
Definition: ISStream.h:65


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:57