GEOS  3.10.1
ByteOrderDataInStream.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2005-2006 Refractions Research Inc.
7  * Copyright (C) 2001-2002 Vivid Solutions Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************
15  *
16  * Last port: io/ByteOrderDataInStream.java rev. 1.1 (JTS-1.10)
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_IO_BYTEORDERDATAINSTREAM_H
21 #define GEOS_IO_BYTEORDERDATAINSTREAM_H
22 
23 #include <geos/export.h>
24 #include <cstdint>
25 
26 //#include <geos/io/ParseException.h>
27 //#include <geos/io/ByteOrderValues.h>
28 #include <geos/inline.h>
29 
30 #include <iosfwd> // ostream, istream (if we remove inlines)
31 
32 namespace geos {
33 namespace io {
34 
42 class GEOS_DLL ByteOrderDataInStream {
43 
44 public:
45 
46  ByteOrderDataInStream(const unsigned char* buff = nullptr, size_t buff_sz = 0);
47 
49 
50  void setOrder(int order);
51 
52  unsigned char readByte(); // throws ParseException
53 
54  int32_t readInt(); // throws ParseException
55 
56  uint32_t readUnsigned(); // throws ParseException
57 
58  int64_t readLong(); // throws ParseException
59 
60  double readDouble(); // throws ParseException
61 
62  size_t size() const;
63 
64 private:
65  int byteOrder;
66  const unsigned char* buf;
67  const unsigned char* end;
68 };
69 
70 } // namespace io
71 } // namespace geos
72 
73 #ifdef GEOS_INLINE
74 #include <geos/io/ByteOrderDataInStream.inl>
75 #endif
76 
77 #endif // #ifndef GEOS_IO_BYTEORDERDATAINSTREAM_H
Allows reading an stream of primitive datatypes from an underlying istream, with the representation b...
Definition: ByteOrderDataInStream.h:42
Basic namespace for all GEOS functionalities.
Definition: Angle.h:26