|
AJA NTV2 SDK
17.1.3.1410
NTV2 SDK 17.1.3.1410
|
Go to the documentation of this file.
8 #ifndef AJA_MOVINGAVG_H
9 #define AJA_MOVINGAVG_H
18 #if defined(AJA_WINDOWS)
19 #pragma warning(disable:4056)
41 reset(inMaxNumSamples);
51 mValues.push_front(inValue);
52 if (mValues.size() > mSampleCapacity)
55 if (inValue < mMinValue)
57 if (inValue > mMaxValue)
69 mSampleCapacity = inMaxNumSamples;
132 for (
auto it(mValues.begin()); it != mValues.end(); ++it)
150 for (
auto it(mValues.begin()); it != mValues.end(); ++it)
164 inline std::ostream &
Print (std::ostream & oss,
const bool inDetailed =
false)
const
185 for (
auto it(mValues.begin()); it != mValues.end(); ++it)
192 if (
typeid(T) ==
typeid(
char))
194 else if (
typeid(T) ==
typeid(int8_t))
196 else if (
typeid(T) ==
typeid(uint8_t))
198 else if (
typeid(T) ==
typeid(int16_t))
200 else if (
typeid(T) ==
typeid(uint16_t))
202 else if (
typeid(T) ==
typeid(
int))
204 else if (
typeid(T) ==
typeid(int32_t))
206 else if (
typeid(T) ==
typeid(uint32_t))
208 else if (
typeid(T) ==
typeid(int64_t))
210 else if (
typeid(T) ==
typeid(uint64_t))
212 else if (
typeid(T) ==
typeid(
float))
214 else if (
typeid(T) ==
typeid(
double))
216 else if (
typeid(T) ==
typeid(
long double))
223 if (
typeid(T) ==
typeid(
char))
225 else if (
typeid(T) ==
typeid(int8_t))
227 else if (
typeid(T) ==
typeid(uint8_t))
229 else if (
typeid(T) ==
typeid(int16_t))
231 else if (
typeid(T) ==
typeid(uint16_t))
233 else if (
typeid(T) ==
typeid(
int))
235 else if (
typeid(T) ==
typeid(int32_t))
237 else if (
typeid(T) ==
typeid(uint32_t))
238 return T(0xFFFFFFFF);
239 else if (
typeid(T) ==
typeid(int64_t))
241 else if (
typeid(T) ==
typeid(uint64_t))
242 return T(0xFFFFFFFFFFFFFFFF);
243 else if (
typeid(T) ==
typeid(
float))
245 else if (
typeid(T) ==
typeid(
double))
247 else if (
typeid(T) ==
typeid(
long double))
254 std::deque<T> mValues;
255 size_t mSampleCapacity;
256 size_t mTotNumSamples;
271 inAvg.
Print(oss,
true);
275 #endif // AJA_MOVINGAVG_H
T recentMaximum(void) const
static T smallestPossibleValue(void)
T recentMinimum(void) const
std::ostream & Print(std::ostream &oss, const bool inDetailed=false) const
static const size_t kDefaultMaxNumSamples
size_t numStoredSamples(void) const
AJAMovingAvg(const size_t inMaxNumSamples=kDefaultMaxNumSamples)
Declares the AJALock class.
size_t totalSamples(void) const
size_t sampleCapacity(void) const
void reset(const size_t inMaxNumSamples=kDefaultMaxNumSamples)
void addSample(const T inValue)
std::ostream & operator<<(std::ostream &oss, const AJAMovingAvg< T > &inAvg)
static T largestPossibleValue(void)
double averageF(void) const