Maintenance: FlightHistory
SPDX tags. header guard. initialize member variables. spelling.
This commit is contained in:
parent
85a3ac5761
commit
10baacb543
1 changed files with 16 additions and 35 deletions
|
@ -1,34 +1,17 @@
|
||||||
// FlightHistory
|
/*
|
||||||
//
|
* SPDX-FileName: FlightHistory.hxx
|
||||||
// Written by James Turner, started December 2012.
|
* SPDX-FileCopyrightText: Copyright (C) 2012 James Turner - zakalawe (at) mac com
|
||||||
//
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
// 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.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef FG_AIRCRAFT_FLIGHT_HISTORY_HXX
|
#pragma once
|
||||||
#define FG_AIRCRAFT_FLIGHT_HISTORY_HXX
|
|
||||||
|
|
||||||
#include <simgear/structure/subsystem_mgr.hxx>
|
|
||||||
#include <simgear/props/props.hxx>
|
|
||||||
#include <simgear/math/SGMath.hxx>
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <simgear/math/SGMath.hxx>
|
||||||
|
#include <simgear/props/props.hxx>
|
||||||
|
#include <simgear/structure/subsystem_mgr.hxx>
|
||||||
|
|
||||||
typedef std::vector<SGGeod> SGGeodVec;
|
typedef std::vector<SGGeod> SGGeodVec;
|
||||||
|
|
||||||
class PagedPathForHistory : public SGReferenced
|
class PagedPathForHistory : public SGReferenced
|
||||||
|
@ -98,7 +81,7 @@ private:
|
||||||
* Bucket is a fixed-size container of samples. This is a crude slab
|
* Bucket is a fixed-size container of samples. This is a crude slab
|
||||||
* allocation of samples, in chunks defined by the width constant above.
|
* 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
|
* 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.
|
* std::vector reallocations, is the key factor here.
|
||||||
*/
|
*/
|
||||||
class SampleBucket
|
class SampleBucket
|
||||||
|
@ -107,10 +90,10 @@ private:
|
||||||
Sample samples[SAMPLE_BUCKET_WIDTH];
|
Sample samples[SAMPLE_BUCKET_WIDTH];
|
||||||
};
|
};
|
||||||
|
|
||||||
double m_lastCaptureTime;
|
double m_lastCaptureTime{0.0};
|
||||||
double m_sampleInterval; ///< sample interval in seconds
|
double m_sampleInterval; ///< sample interval in seconds
|
||||||
/// our store of samples (in buckets). The last bucket is partially full,
|
/// our store of samples (in buckets). The last bucket is partially full,
|
||||||
/// with the number of valid samples indicated by m_validSampleCount
|
/// with the number of valid samples indicated by m_validSampleCount
|
||||||
std::vector<SampleBucket*> m_buckets;
|
std::vector<SampleBucket*> m_buckets;
|
||||||
|
|
||||||
/// number of valid samples in the final bucket
|
/// number of valid samples in the final bucket
|
||||||
|
@ -119,8 +102,8 @@ private:
|
||||||
SGPropertyNode_ptr m_weightOnWheels;
|
SGPropertyNode_ptr m_weightOnWheels;
|
||||||
SGPropertyNode_ptr m_enabled;
|
SGPropertyNode_ptr m_enabled;
|
||||||
|
|
||||||
bool m_lastWoW;
|
bool m_lastWoW{false};
|
||||||
size_t m_maxMemoryUseBytes;
|
size_t m_maxMemoryUseBytes{0};
|
||||||
|
|
||||||
void allocateNewBucket();
|
void allocateNewBucket();
|
||||||
|
|
||||||
|
@ -128,5 +111,3 @@ private:
|
||||||
|
|
||||||
size_t currentMemoryUseBytes() const;
|
size_t currentMemoryUseBytes() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in a new issue