From 10baacb543e59d532a880486cadcd6dc91c228de Mon Sep 17 00:00:00 2001 From: scttgs0 <scttgs0@gmail.com> Date: Mon, 22 May 2023 19:17:44 -0500 Subject: [PATCH] Maintenance: FlightHistory SPDX tags. header guard. initialize member variables. spelling. --- src/Aircraft/FlightHistory.hxx | 51 +++++++++++----------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/src/Aircraft/FlightHistory.hxx b/src/Aircraft/FlightHistory.hxx index 7a3991cc8..274f55ad8 100644 --- a/src/Aircraft/FlightHistory.hxx +++ b/src/Aircraft/FlightHistory.hxx @@ -1,34 +1,17 @@ -// FlightHistory -// -// Written by James Turner, started December 2012. -// -// Copyright (C) 2012 James Turner - zakalawe (at) mac com -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -// -/////////////////////////////////////////////////////////////////////////////// +/* + * SPDX-FileName: FlightHistory.hxx + * SPDX-FileCopyrightText: Copyright (C) 2012 James Turner - zakalawe (at) mac com + * SPDX-License-Identifier: GPL-2.0-or-later + */ -#ifndef FG_AIRCRAFT_FLIGHT_HISTORY_HXX -#define FG_AIRCRAFT_FLIGHT_HISTORY_HXX - -#include <simgear/structure/subsystem_mgr.hxx> -#include <simgear/props/props.hxx> -#include <simgear/math/SGMath.hxx> +#pragma once #include <vector> +#include <simgear/math/SGMath.hxx> +#include <simgear/props/props.hxx> +#include <simgear/structure/subsystem_mgr.hxx> + typedef std::vector<SGGeod> SGGeodVec; class PagedPathForHistory : public SGReferenced @@ -98,7 +81,7 @@ private: * Bucket is a fixed-size container of samples. This is a crude slab * allocation of samples, in chunks defined by the width constant above. * Keep in mind that even with a 1Hz sample frequency, we use less than - * 200kbytes per hour - avoiding continous malloc traffic, or expensive + * 200 KB per hour - avoiding continuous malloc traffic, or expensive * std::vector reallocations, is the key factor here. */ class SampleBucket @@ -107,10 +90,10 @@ private: Sample samples[SAMPLE_BUCKET_WIDTH]; }; - double m_lastCaptureTime; + double m_lastCaptureTime{0.0}; double m_sampleInterval; ///< sample interval in seconds - /// our store of samples (in buckets). The last bucket is partially full, - /// with the number of valid samples indicated by m_validSampleCount + /// our store of samples (in buckets). The last bucket is partially full, + /// with the number of valid samples indicated by m_validSampleCount std::vector<SampleBucket*> m_buckets; /// number of valid samples in the final bucket @@ -119,8 +102,8 @@ private: SGPropertyNode_ptr m_weightOnWheels; SGPropertyNode_ptr m_enabled; - bool m_lastWoW; - size_t m_maxMemoryUseBytes; + bool m_lastWoW{false}; + size_t m_maxMemoryUseBytes{0}; void allocateNewBucket(); @@ -128,5 +111,3 @@ private: size_t currentMemoryUseBytes() const; }; - -#endif