NavMsgDataWords.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 
39 #ifndef NAVMSGDATAWORDS_HPP
40 #define NAVMSGDATAWORDS_HPP
41 
42 #include "NavMsgData.hpp"
43 #include <math.h>
44 
45 namespace gnsstk
46 {
48 
49 
57  template <std::size_t WordSize = 30>
58  class NavMsgDataWords : public NavMsgData
59  {
60  public:
69  uint32_t getBits(unsigned start, unsigned num) const override;
75  void dump(std::ostream& s, unsigned totalBits) const override;
77  uint32_t *sf;
78  };
79 
81 
82  template <std::size_t WordSize>
84  getBits(unsigned start, unsigned num) const
85  {
86  if (num == 0)
87  return 0;
88  // mask and shift the desired bits
89  uint32_t fbmodN = (start % WordSize);
90  return ((sf[start/WordSize] & (((uint32_t)-1) >> (fbmodN+1))) >>
91  (31-fbmodN-num));
92  }
93 
94 
95  template <std::size_t WordSize>
97  dump(std::ostream& s, unsigned totalBits) const
98  {
99  unsigned numWords = ceil((double)totalBits / (double)WordSize);
100  s << std::hex << std::setfill('0');
101  for (unsigned j=0;j<numWords;j++)
102  {
103  s << "0x" << std::setw(8) << sf[j] << " ";
104  }
105  s << std::dec << std::setfill(' ') << " ";
106  }
107 
108 } // namespace gnsstk
109 
110 #endif // NAVMSGDATAWORDS_HPP
gnsstk::NavMsgDataWords
Definition: NavMsgDataWords.hpp:58
gnsstk::NavMsgData
Definition: NavMsgData.hpp:55
NavMsgData.hpp
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::NavMsgDataWords::getBits
uint32_t getBits(unsigned start, unsigned num) const override
Definition: NavMsgDataWords.hpp:84
gnsstk::StringUtils::numWords
int numWords(const std::string &s, const char delimiter=' ')
Definition: StringUtils.hpp:2171
gnsstk::NavMsgDataWords::dump
void dump(std::ostream &s, unsigned totalBits) const override
Definition: NavMsgDataWords.hpp:97
gnsstk::NavMsgDataWords::sf
uint32_t * sf
The subframe contents, an array of words of WordSize bits.
Definition: NavMsgDataWords.hpp:77


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