ARTS 2.5.4 (git: 4c0d3b4d)
bifstream.h
Go to the documentation of this file.
1/* Copyright (C) 2003-2012 Oliver Lemke <olemke@core-dump.info>
2
3 This program is free software; you can redistribute it and/or modify it
4 under the terms of the GNU General Public License as published by the
5 Free Software Foundation; either version 2, or (at your option) any
6 later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 USA. */
17
19// File description
21
30#ifndef BIFSTREAM_H_INCLUDED
31#define BIFSTREAM_H_INCLUDED
32
33#include <fstream>
34
35#include "binio.h"
36
38
42class bifstream : public binistream, public ifstream {
43 public:
44 bifstream() : ifstream() {}
45
46 explicit bifstream(const char* name,
47 ios::openmode mode = ios::in | ios::binary)
48 : ifstream(name, mode) {
49 // Set Little Endian mode, with IEEE-754 floats.
50 this->setFlag(binio::BigEndian, false); // remove flag
51 this->setFlag(binio::FloatIEEE); // set flag
52 }
53
54 virtual ~bifstream() {}
55 void seek(long spos, Offset offs) override final;
56 streampos pos() override final;
57
58 bifstream::Byte getByte() override final;
59 void getRaw(char* c, streamsize n) override final { this->read(c, n); }
60};
61
62/* Overloaded input operators */
63bifstream& operator>>(bifstream& bif, double& n);
64
65bifstream& operator>>(bifstream& bif, float& n);
66
67bifstream& operator>>(bifstream& bif, long& n);
68
69bifstream& operator>>(bifstream& bif, int& n);
70
71#endif
bifstream & operator>>(bifstream &bif, double &n)
Definition: bifstream.cc:75
Binary output file stream class.
Definition: bifstream.h:42
void seek(long spos, Offset offs) override final
Definition: bifstream.cc:34
void getRaw(char *c, streamsize n) override final
Definition: bifstream.h:59
virtual ~bifstream()
Definition: bifstream.h:54
bifstream(const char *name, ios::openmode mode=ios::in|ios::binary)
Definition: bifstream.h:46
streampos pos() override final
Definition: bifstream.cc:53
bifstream::Byte getByte() override final
Definition: bifstream.cc:61
bifstream()
Definition: bifstream.h:44
void setFlag(Flag f, bool set=true)
Definition: binio.cc:84
Offset
Definition: binio.h:80
@ FloatIEEE
Definition: binio.h:68
@ BigEndian
Definition: binio.h:68
unsigned char Byte
Definition: binio.h:99
void read(HitranRelaxationMatrixData &hitran, ArrayOfAbsorptionLines &bands, const SpeciesIsotopologueRatios &isotopologue_ratio, const String &basedir, const Numeric linemixinglimit, const Numeric fmin, const Numeric fmax, const Numeric stot, const ModeOfLineMixing mode)
Read from HITRAN online line mixing file.
#define c