Project

General

Profile

Statistics
| Branch: | Revision:

root / src / scave / arraybuilder.h @ a3be1d55

History | View | Annotate | Download (1.94 KB)

1 01873262 Georg Kunz
//=========================================================================
2
//  ARRAYBUILDER.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 _ARRAYBUILDER_H_
19
#define _ARRAYBUILDER_H_
20
21
#include "commonutil.h"
22
#include "commonnodes.h"
23
#include "xyarray.h"
24
25
NAMESPACE_BEGIN
26
27
class ArrayBuilderNodeType;
28
29
/**
30
 * Stores all data in vector (two 'double' vectors in fact).
31
 */
32
class SCAVE_API ArrayBuilderNode : public SingleSinkNode
33
{
34
    friend class ArrayBuilderNodeType;
35
    private:
36
        double *xvec;
37
        double *yvec;
38
        size_t veccapacity;
39
        size_t veclen;
40
        BigDecimal *xpvec;
41
        bool collectEvec;
42
        eventnumber_t *evec; // event numbers
43
        void resize();
44
    public:
45
        ArrayBuilderNode();
46
        virtual ~ArrayBuilderNode();
47
        virtual bool isReady() const;
48
        virtual void process();
49
        virtual bool isFinished() const;
50
51
        void sort();
52
        size_t length() {return veclen;}
53
        XYArray *getArray();
54
};
55
56
57
class SCAVE_API ArrayBuilderNodeType : public SingleSinkNodeType
58
{
59
    friend class ArrayBuilderNode;
60
    public:
61
        virtual const char *getName() const {return "arraybuilder";}
62
        virtual const char *getDescription() const;
63
        virtual bool isHidden() const {return true;}
64
        virtual void getAttributes(StringMap& attrs) const;
65
        virtual void getAttrDefaults(StringMap& attrs) const;
66
        virtual Node *create(DataflowManager *mgr, StringMap& attrs) const;
67
};
68
69
NAMESPACE_END
70
71
72
#endif
73