1 //============================================================================== 2 // 3 // This file is part of GPSTk, the GPS Toolkit. 4 // 5 // The GPSTk 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 GPSTk 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 GPSTk; 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-2020, 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 /** 40 * @file LoopedFramework.hpp 41 * Basic framework for programs processing loops in the GPS toolkit 42 */ 43 44 #ifndef GPSTK_LOOPEDFRAMEWORK_HPP 45 #define GPSTK_LOOPEDFRAMEWORK_HPP 46 47 #include "BasicFramework.hpp" 48 49 namespace gpstk 50 { 51 /// @ingroup AppFrame 52 //@{ 53 54 /** 55 * This is a basic framework for programs processing in loops in 56 * the GPSTK. 57 * 58 * The end user should define subclasses of this class, 59 * implementing those methods described as being meant to be 60 * overridden; initialize(), additionalSetup(), spinUp(), process(), and 61 * shutDown(). 62 * In the process() method, simply set variable timeToDie true prior to 63 * returning for the program to call shutDown() and then terminate. 64 * 65 * In use, the user will construct an object of the class 66 * derived from this, then call the initialize() and run() 67 * methods in that order. 68 */ 69 class LoopedFramework : public BasicFramework 70 { 71 public: 72 /** 73 * Constructor for LoopedFramework. 74 * @param[in] applName name of the program (argv[0]). 75 * @param[in] applDesc text description of program's function 76 * (used by CommandOption help). 77 */ LoopedFramework(const std::string & applName,const std::string & applDesc)78 LoopedFramework(const std::string& applName, 79 const std::string& applDesc) 80 throw() 81 : BasicFramework(applName, applDesc), timeToDie(false) 82 { } 83 84 /// Destructor. ~LoopedFramework()85 virtual ~LoopedFramework() {} 86 87 protected: 88 bool timeToDie; ///< if set to true, the loop will terminate 89 90 /** 91 * Called by the run() method, calls additionalSetup(), 92 * spinUp(), and process(), in that order. Generally should not be 93 * overridden. 94 */ 95 virtual void completeProcessing(); 96 97 private: 98 // Do not allow the use of the default constructor. 99 LoopedFramework(); 100 }; // class LoopedFramework 101 102 //@} 103 104 } // namespace gpstk 105 106 #endif 107