GEOS  3.9.1dev
ByteOrderDataInStream.h
Go to the documentation of this file.
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 
25 //#include <geos/io/ParseException.h>
26 //#include <geos/io/ByteOrderValues.h>
27 #include <geos/inline.h>
28 
29 #include <iosfwd> // ostream, istream (if we remove inlines)
30 
31 namespace geos {
32 namespace io {
33 
42 
43 public:
44 
45  ByteOrderDataInStream(std::istream* s = nullptr);
46 
48 
53  void setInStream(std::istream* s);
54 
55  void setOrder(int order);
56 
57  unsigned char readByte(); // throws ParseException
58 
59  int readInt(); // throws ParseException
60 
61  long readLong(); // throws ParseException
62 
63  double readDouble(); // throws ParseException
64 
65 private:
66  int byteOrder;
67  std::istream* stream;
68 
69  // buffers to hold primitive datatypes
70  unsigned char buf[8];
71 
72 };
73 
74 } // namespace io
75 } // namespace geos
76 
77 #ifdef GEOS_INLINE
78 #include <geos/io/ByteOrderDataInStream.inl>
79 #endif
80 
81 #endif // #ifndef GEOS_IO_BYTEORDERDATAINSTREAM_H
#define GEOS_DLL
Definition: export.h:28
Allows reading an stream of primitive datatypes from an underlying istream, with the representation b...
Basic namespace for all GEOS functionalities.