You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.5 KiB
C

5 years ago
/*! \file StatisticEle.h
\brief A brief file description.
A more elaborated file description.
Created: 2015/07/12, author: Jin Bingwen.
*/
#ifndef __StatisticEle_h_
#define __StatisticEle_h_
#include <vector>
#include <deque>
#include <list>
#include "StdUtils.h"
#include "CyclopsVersion.h"
#include "CyclopsModules.h"
class StatisticsNode : public ICyclopsModuleInstance
{
public:
enum TrimMode
{
HeadTail,
HeadOnly,
TailOnly
};
/*! \fn getMean
* Get value of average value of source data
*/
DECLARE_PARAMETER_GET(double, Mean)
/*! \fn getMax
* Get value of maximum value in source data
*/
DECLARE_PARAMETER_GET(double, Max)
/*! \fn getMin
* Get value of minimum value in source data
*/
DECLARE_PARAMETER_GET(double, Min)
/*! \fn getStdDev
* Get value of standard deviation of source data
*/
DECLARE_PARAMETER_GET(double, StdDev)
/*! \fn getLast
* Get value of last value in source data
*/
DECLARE_PARAMETER_GET(double, Last)
/*! \fn getMaxIdx
* Get value of index of the maximum element in source data
*/
DECLARE_PARAMETER_GET(int, MaxIdx)
/*! \fn getMinIdx
* Get value of index of the minimum element in source data
*/
DECLARE_PARAMETER_GET(int, MinIdx)
/*! \fn getCount
* Get value of total count of source data
*/
DECLARE_PARAMETER_GET(int, Count)
/*! \fn getTargetPercent
* Get the percentage of target elements whose value is above defined threshold among source data
*/
DECLARE_PARAMETER_GET(double, TargetPercent)
/*! \fn getTargetCoun
* Get the count of target elements whose value is above defined threshold
*/
DECLARE_PARAMETER_GET(int, TargetCount)
public:
StatisticsNode();
StatisticsNode(double mean, double maxVal, double minVal, double stdDev, unsigned int count);
virtual ~StatisticsNode() {}
//! Smart pointer to hold an instance of StatisticsNode
typedef std::shared_ptr<StatisticsNode> Ptr;
DECL_GET_INSTANCE(StatisticsNode::Ptr)
virtual void compute(float filterPercent = 0, float targetThre = 0, TrimMode trimMode = HeadTail);
virtual void writeFile(std::string filePath);
static void compute(vector<StatisticsNode>& statVec,
float filterPercent = 0,
float targetAbsThre = 0,
TrimMode trimMode = HeadTail);
static void writeFile(std::string baseFilePath, vector<StatisticsNode>& statVec);
virtual std::list<double> getSourceInList(int num = 0) const;
virtual void clear(bool clearSource = true);
public:
std::deque<double> mSource;
};
#endif // __StatisticEle_h_