DataStatus.hpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
46 #ifndef DATASTATUS_HPP
47 #define DATASTATUS_HPP
48 
49 #include <iostream>
50 
51 namespace gnsstk
52 {
53  class DataStatus
54  {
55  std::ios_base::iostate state;
56 
57  public:
58 
59  DataStatus() : state(std::ios_base::goodbit) {};
60 
63  bool good() const
64  {return rdstate() == std::ios_base::goodbit;}
65 
66  std::ios_base::iostate rdstate() const
67  {return state;}
68 
69  void clear(std::ios_base::iostate s = std::ios_base::goodbit)
70  {state=s;}
71 
72  void setstate(std::ios_base::iostate s)
73  {clear(rdstate() | s);}
74 
75  void clearstate(std::ios_base::iostate s)
76  {state &= ~s;}
77 
78  bool operator()() const
79  {return good();}
80 
81  operator void*() const
82  {return good() ? const_cast<DataStatus*>(this) : 0;}
83  };
84 
86  static const std::ios_base::iostate crcbit = std::ios_base::iostate(0x01);
87  static const std::ios_base::iostate fmtbit = std::ios_base::iostate(0x02);
88  static const std::ios_base::iostate lenbit = std::ios_base::iostate(0x04);
89  static const std::ios_base::iostate parbit = std::ios_base::iostate(0x08);
90 
91  class CRCDataStatus : public DataStatus
92  {
93  public:
94  bool crcerr() const {return (rdstate() & crcbit) != 0;}
95  bool fmterr() const {return (rdstate() & fmtbit) != 0;}
96  bool lenerr() const {return (rdstate() & lenbit) != 0;}
97  bool parerr() const {return (rdstate() & parbit) != 0;}
98  };
99 } // namespace gnsstk
100 
101 #endif // DATASTATUS_HPP
gnsstk::CRCDataStatus
Definition: DataStatus.hpp:91
gnsstk::DataStatus::DataStatus
DataStatus()
Definition: DataStatus.hpp:59
gnsstk::parbit
static const std::ios_base::iostate parbit
Definition: DataStatus.hpp:89
gnsstk::lenbit
static const std::ios_base::iostate lenbit
Definition: DataStatus.hpp:88
gnsstk::crcbit
static const std::ios_base::iostate crcbit
Define additional/other bits are the data requires.
Definition: DataStatus.hpp:86
gnsstk::DataStatus::setstate
void setstate(std::ios_base::iostate s)
Definition: DataStatus.hpp:72
gnsstk::DataStatus::rdstate
std::ios_base::iostate rdstate() const
Definition: DataStatus.hpp:66
gnsstk::fmtbit
static const std::ios_base::iostate fmtbit
Definition: DataStatus.hpp:87
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::DataStatus::clear
void clear(std::ios_base::iostate s=std::ios_base::goodbit)
Definition: DataStatus.hpp:69
gnsstk::CRCDataStatus::lenerr
bool lenerr() const
Definition: DataStatus.hpp:96
gnsstk::DataStatus::clearstate
void clearstate(std::ios_base::iostate s)
Definition: DataStatus.hpp:75
gnsstk::DataStatus::good
bool good() const
Definition: DataStatus.hpp:63
gnsstk::CRCDataStatus::fmterr
bool fmterr() const
Definition: DataStatus.hpp:95
gnsstk::CRCDataStatus::parerr
bool parerr() const
Definition: DataStatus.hpp:97
gnsstk::DataStatus::operator()
bool operator()() const
Definition: DataStatus.hpp:78
std
Definition: Angle.hpp:142
gnsstk::DataStatus::state
std::ios_base::iostate state
Definition: DataStatus.hpp:55
gnsstk::CRCDataStatus::crcerr
bool crcerr() const
Definition: DataStatus.hpp:94
gnsstk::DataStatus
Definition: DataStatus.hpp:53


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:38