| 1 | // replay.cxx - a system to record and replay FlightGear flights |
| 2 | // |
| 3 | // Written by Curtis Olson, started July 2003. |
| 4 | // Updated by Thorsten Brehm, September 2011 and November 2012. |
| 5 | // |
| 6 | // Copyright (C) 2003 Curtis L. Olson - http://www.flightgear.org/~curt |
| 7 | // |
| 8 | // This program is free software; you can redistribute it and/or |
| 9 | // modify it under the terms of the GNU General Public License as |
| 10 | // published by the Free Software Foundation; either version 2 of the |
| 11 | // License, or (at your option) any later version. |
| 12 | // |
| 13 | // This program is distributed in the hope that it will be useful, but |
| 14 | // WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | // General Public License for more details. |
| 17 | // |
| 18 | // You should have received a copy of the GNU General Public License |
| 19 | // along with this program; if not, write to the Free Software |
| 20 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 21 | // |
| 22 | // $Id$ |
| 23 | |
| 24 | |
| 25 | #include "replay.hxx" |
| 26 | #include "replay-internal.hxx" |
| 27 | |
| 28 | |
| 29 | FGReplay::FGReplay() |
| 30 | : |
| 31 | m_internal(new FGReplayInternal) |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | FGReplay::~FGReplay() |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | void |
| 40 | FGReplay::init() |
| 41 | { |
| 42 | m_internal->init(); |
| 43 | } |
| 44 | |
| 45 | void |
| 46 | FGReplay::reinit() |
| 47 | { |
| 48 | m_internal->reinit(); |
| 49 | } |
| 50 | |
| 51 | void |
| 52 | FGReplay::bind() |
| 53 | { |
| 54 | m_internal->bind(); |
| 55 | } |
| 56 | |
| 57 | void |
| 58 | FGReplay::unbind() |
| 59 | { |
| 60 | m_internal->unbind(); |
| 61 | } |
| 62 | |
| 63 | |
| 64 | /** Start replay session |
| 65 | */ |
| 66 | bool |
| 67 | FGReplay::start(bool NewTape) |
| 68 | { |
| 69 | return m_internal->start(NewTape); |
| 70 | } |
| 71 | |
| 72 | void |
| 73 | FGReplay::update( double dt ) |
| 74 | { |
| 75 | timingInfo.clear(); |
| 76 | stamp("begin"); |
| 77 | m_internal->update(dt); |
| 78 | } |
| 79 | |
| 80 | |
| 81 | /** Write flight recorder tape to disk. User/script command. */ |
| 82 | bool |
| 83 | FGReplay::saveTape(const SGPropertyNode* Extra) |
| 84 | { |
| 85 | return m_internal->saveTape(Extra); |
| 86 | } |
| 87 | |
| 88 | |
| 89 | bool |
| 90 | FGReplay::loadTape( |
| 91 | const SGPath& filename, |
| 92 | bool preview, |
| 93 | bool create_video, |
| 94 | double fixed_dt, |
| 95 | SGPropertyNode& meta_meta, |
| 96 | simgear::HTTP::FileRequestRef file_request |
| 97 | ) |
| 98 | { |
| 99 | return m_internal->loadTape(filename, preview, create_video, fixed_dt, meta_meta, file_request); |
| 100 | } |
| 101 | |
| 102 | |
| 103 | std::string FGReplay::makeTapePath(const std::string& tape_name) |
| 104 | { |
| 105 | return FGReplayInternal::makeTapePath(tape_name); |
| 106 | } |
| 107 | |
| 108 | int FGReplay::loadContinuousHeader(const std::string& path, std::istream* in, SGPropertyNode* properties) |
| 109 | { |
| 110 | return FGReplayInternal::loadContinuousHeader(path, in, properties); |
| 111 | } |
| 112 | |
| 113 | /** Load a flight recorder tape from disk. User/script command. */ |
| 114 | bool |
| 115 | FGReplay::loadTape(const SGPropertyNode* ConfigData) |
| 116 | { |
| 117 | return m_internal->loadTape(ConfigData); |
| 118 | } |
| 119 | void FGReplay::resetStatisticsProperties() |
| 120 | { |
| 121 | FGReplayData::resetStatisticsProperties(); |
| 122 | } |
| 123 | |
| 124 | |
| 125 | // Register the subsystem. |
| 126 | SGSubsystemMgr::Registrant<FGReplay> registrantFGReplay( |
| 127 | SGSubsystemMgr::POST_FDM); |