40#ifndef GEOGRAM_BASIC_B_STREAM
41#define GEOGRAM_BASIC_B_STREAM
100 return stream_endian_;
109 return machine_endian_;
117 return has_record_markers_;
128 has_record_markers_ = b;
164 bool has_record_markers_;
254 input_->
read((
char*) ptr, (std::streamsize) n);
269 void* ptr,
size_t size,
size_t n
342 return input_->tellg();
349 void seek(std::streamoff pos) {
361 void seek(std::streamoff off, std::ios_base::seekdir dir) {
362 input_->seekg(off, dir);
401 std::istream* input_;
488 const void* ptr,
size_t size
490 output_->
write((
const char*) ptr, (std::streamsize) size);
505 const void* ptr,
size_t size,
size_t n
523 (
const char*) data, n,
565 (
const char*) data, n,
614 std::ostream* output_;
BinaryOutputStream(const std::string &file_name, int stream_endian=GEO_BIG_ENDIAN)
Creates a new binary output stream.
bool OK() const
Gets the status of the stream.
BinaryOutputStream & write_record(const T *data, size_t n)
Writes an array of elements in a record.
BinaryOutputStream & write(const char *data, size_t n, ItemSize< 4 >)
Writes an array of elements of size 4.
BinaryOutputStream & write_array(const T *data, size_t n)
Writes an array of elements.
BinaryOutputStream & write(const char *data, size_t n, ItemSize< 2 >)
Writes an array of elements of size 2.
BinaryOutputStream & write_opaque_data(const void *ptr, size_t size, size_t n)
Writes opaque data.
BinaryOutputStream & write_opaque_data(const void *ptr, size_t size)
Writes opaque data.
BinaryOutputStream & write(const char *data, size_t n, ItemSize< 8 >)
Writes an array of elements of size 8.
BinaryOutputStream(std::ostream &output, int stream_endian=GEO_BIG_ENDIAN)
Creates a new binary output stream.
~BinaryOutputStream()
Deletes the output stream.
BinaryOutputStream & write(const char *data, size_t n, ItemSize< 1 >)
Writes an array of elements of size 1.
void begin_record()
Starts writing a data record.
void end_record()
Stops writing a data record.
void set_has_record_markers(bool b)
Enables/disables support for record markers.
static const int GEO_BIG_ENDIAN
bool has_record_markers() const
Checks support for record markers.
static const int GEO_LITTLE_ENDIAN
BinaryStream(int stream_endian=GEO_BIG_ENDIAN)
Base constructor.
void detect_machine_endian()
Detects the current architecture's endianness.
int machine_endian() const
Gets the current architecture's endianness.
void set_stream_endian(int stream_endian)
Sets the stream endianness.
int stream_endian() const
Gets the stream endianness.
std::ostream & operator<<(std::ostream &os, const GEO::expansion_nt &a)
Displays the approximated value of an expansion_nt to a stream.
std::istream & operator>>(std::istream &is, GEO::expansion_nt &a)
Reads a double precision number from a stream and converts it to an approximation.
Common include file, providing basic definitions. Should be included before anything else by all head...
Global Vorpaline namespace.
Types and functions for numbers manipulation.
Extends std::numeric_limits with additional information.