DebugTrace_T.cpp
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 #include "BasicFramework.hpp"
40 #include "DebugTrace.hpp"
41 
42 using namespace std;
43 
49 {
50 public:
51  DebugTrace_T(const string& applName)
52  : gnsstk::BasicFramework(applName, "Compile-time test of DebugTrace")
53  {}
54  bool initialize(int argc, char *argv[], bool pretty = true) noexcept
55  override
56  {
57  if (!BasicFramework::initialize(argc, argv, pretty))
58  return false;
59  if (debugLevel)
60  {
62  }
64  DEBUGTRACE("argc = " << argc);
65  DEBUGTRACE("pretty = " << boolalpha << pretty << noboolalpha);
66  return true;
67  }
68  void completeProcessing() override
69  {
71  BasicFramework::completeProcessing();
72  }
73  void additionalSetup() override
74  {
76  BasicFramework::additionalSetup();
77  }
78  void spinUp() override
79  {
81  BasicFramework::spinUp();
82  }
83  void process() override
84  {
86  DEBUGTRACE_DISABLE(); // if we don't want BasicFramework::process debug
87  BasicFramework::process();
88  if (debugLevel)
89  {
90  // reenable if desired
92  }
93  doSomething();
94  }
95  void shutDown() override
96  {
98  BasicFramework::shutDown();
99  }
100  void doSomething()
101  {
103  int foo;
104  DEBUGTRACE("foo = " << foo);
105  }
106 };
107 
108 int main(int argc, char *argv[])
109 {
110  try
111  {
112  DebugTrace_T app(argv[0]);
113  if (!app.initialize(argc, argv))
114  return app.exitCode;
115  app.run();
116  return app.exitCode;
117  }
118  catch(gnsstk::Exception& e)
119  {
120  cout << e << endl;
121  }
122  catch(std::exception& e)
123  {
124  cout << e.what() << endl;
125  }
126  catch(...)
127  {
128  cout << "unknown error" << endl;
129  }
130  // only reach this point if an exception was caught
132 }
DEBUGTRACE
#define DEBUGTRACE(EXPR)
Definition: DebugTrace.hpp:119
gnsstk::Exception::what
std::string what() const
Dump to a string.
Definition: Exception.cpp:193
gnsstk::BasicFramework::EXCEPTION_ERROR
static const int EXCEPTION_ERROR
Definition: BasicFramework.hpp:392
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
DebugTrace_T::doSomething
void doSomething()
Definition: DebugTrace_T.cpp:100
DebugTrace_T::shutDown
void shutDown() override
Definition: DebugTrace_T.cpp:95
gnsstk::Exception
Definition: Exception.hpp:151
initialize
int initialize(string &errors)
Definition: RinEdit.cpp:513
gnsstk::BasicFramework
Definition: BasicFramework.hpp:387
DebugTrace_T::initialize
bool initialize(int argc, char *argv[], bool pretty=true) noexcept override
Definition: DebugTrace_T.cpp:54
gnsstk::BasicFramework::run
bool run() noexcept
Definition: BasicFramework.cpp:126
DebugTrace_T::DebugTrace_T
DebugTrace_T(const string &applName)
Definition: DebugTrace_T.cpp:51
DebugTrace_T::process
void process() override
Definition: DebugTrace_T.cpp:83
DebugTrace_T::spinUp
void spinUp() override
Definition: DebugTrace_T.cpp:78
DEBUGTRACE_DISABLE
#define DEBUGTRACE_DISABLE()
Definition: DebugTrace.hpp:113
DebugTrace.hpp
BasicFramework.hpp
std
Definition: Angle.hpp:142
DEBUGTRACE_ENABLE
#define DEBUGTRACE_ENABLE()
Definition: DebugTrace.hpp:107
gnsstk::BasicFramework::exitCode
int exitCode
Definition: BasicFramework.hpp:450
main
int main(int argc, char *argv[])
Definition: DebugTrace_T.cpp:108
DEBUGTRACE_FUNCTION
#define DEBUGTRACE_FUNCTION()
Definition: DebugTrace.hpp:117
DebugTrace_T
Definition: DebugTrace_T.cpp:48
DebugTrace_T::additionalSetup
void additionalSetup() override
Definition: DebugTrace_T.cpp:73
DebugTrace_T::completeProcessing
void completeProcessing() override
Definition: DebugTrace_T.cpp:68


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