Project

General

Profile

Statistics
| Branch: | Revision:

root / src / scave / slidingwinavg.h @ a3be1d55

History | View | Annotate | Download (1.67 KB)

1 01873262 Georg Kunz
//=========================================================================
2
//  SLIDINGWINAVG.H - part of
3
//                  OMNeT++/OMNEST
4
//           Discrete System Simulation in C++
5
//
6
//  Author: Andras Varga
7
//
8
//=========================================================================
9
10
/*--------------------------------------------------------------*
11
  Copyright (C) 1992-2008 Andras Varga
12
  Copyright (C) 2006-2008 OpenSim Ltd.
13

14
  This file is distributed WITHOUT ANY WARRANTY. See the file
15
  `license' for details on this and other legal matters.
16
*--------------------------------------------------------------*/
17
18
#ifndef _SLIDINGWINAVG_H_
19
#define _SLIDINGWINAVG_H_
20
21
#include "commonnodes.h"
22
23
NAMESPACE_BEGIN
24
25
26
/**
27
 * Processing node which performs sliding window average. Replaces every
28
 * value with the mean of values in the window.
29
 */
30
class SCAVE_API SlidingWindowAverageNode : public FilterNode
31
{
32
    protected:
33
        int winsize;
34
        Datum *array;
35
        double sum;
36
        int count, pos;
37
38
    public:
39
        SlidingWindowAverageNode(int windowSize);
40
        virtual ~SlidingWindowAverageNode();
41
        virtual bool isReady() const;
42
        virtual void process();
43
};
44
45
class SCAVE_API SlidingWindowAverageNodeType : public FilterNodeType
46
{
47
    public:
48
        virtual const char *getName() const {return "slidingwinavg";}
49
        virtual const char *getDescription() const;
50
        virtual void getAttributes(StringMap& attrs) const;
51
        virtual void getAttrDefaults(StringMap& attrs) const;
52
        virtual Node *create(DataflowManager *mgr, StringMap& attrs) const;
53
        virtual void mapVectorAttributes(/*inout*/StringMap &attrs) const;
54
};
55
56
NAMESPACE_END
57
58
59
#endif
60