|
AJA NTV2 SDK
17.5.0.1492
NTV2 SDK 17.5.0.1492
|
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;
137 for (
auto it(mValues.begin()); it != mValues.end(); ++it)
155 for (
auto it(mValues.begin()); it != mValues.end(); ++it)
169 inline std::ostream &
Print (std::ostream & oss,
const bool inDetailed =
false)
const
190 for (
auto it(mValues.begin()); it != mValues.end(); ++it)
197 if (
typeid(T) ==
typeid(
char))
199 else if (
typeid(T) ==
typeid(int8_t))
201 else if (
typeid(T) ==
typeid(uint8_t))
203 else if (
typeid(T) ==
typeid(int16_t))
205 else if (
typeid(T) ==
typeid(uint16_t))
207 else if (
typeid(T) ==
typeid(
int))
209 else if (
typeid(T) ==
typeid(int32_t))
211 else if (
typeid(T) ==
typeid(uint32_t))
213 else if (
typeid(T) ==
typeid(int64_t))
215 else if (
typeid(T) ==
typeid(uint64_t))
217 else if (
typeid(T) ==
typeid(
float))
219 else if (
typeid(T) ==
typeid(
double))
221 else if (
typeid(T) ==
typeid(
long double))
228 if (
typeid(T) ==
typeid(
char))
230 else if (
typeid(T) ==
typeid(int8_t))
232 else if (
typeid(T) ==
typeid(uint8_t))
234 else if (
typeid(T) ==
typeid(int16_t))
236 else if (
typeid(T) ==
typeid(uint16_t))
238 else if (
typeid(T) ==
typeid(
int))
240 else if (
typeid(T) ==
typeid(int32_t))
242 else if (
typeid(T) ==
typeid(uint32_t))
243 return T(0xFFFFFFFF);
244 else if (
typeid(T) ==
typeid(int64_t))
246 else if (
typeid(T) ==
typeid(uint64_t))
247 return T(0xFFFFFFFFFFFFFFFF);
248 else if (
typeid(T) ==
typeid(
float))
250 else if (
typeid(T) ==
typeid(
double))
252 else if (
typeid(T) ==
typeid(
long double))
259 std::deque<T> mValues;
260 size_t mSampleCapacity;
261 size_t mTotNumSamples;
276 inAvg.
Print(oss,
true);
280 #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.
bool isFilled(void) const
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