Project

General

Profile

Statistics
| Branch: | Revision:

root / src / scave / filewriter.h @ a3be1d55

History | View | Annotate | Download (1.64 KB)

1 01873262 Georg Kunz
//=========================================================================
2
//  FILEWRITER.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 _FILEWRITER_H_
19
#define _FILEWRITER_H_
20
21
#include <string>
22
#include "commonnodes.h"
23
24
NAMESPACE_BEGIN
25
26
27
/**
28
 * Processing node which writes data into a file. Every line contains two
29
 * real numbers (time and value) separated by a tab.
30
 */
31
class SCAVE_API FileWriterNode : public SingleSinkNode
32
{
33
    private:
34
        std::string fileName;
35
        std::string banner;
36
        FILE *f;
37
        int prec;
38
    public:
39
        FileWriterNode(const char *filename, const char *banner=NULL);
40
        virtual ~FileWriterNode();
41
        void setPrecision(int prec) {this->prec = prec;}
42
        virtual bool isReady() const;
43
        virtual void process();
44
        virtual bool isFinished() const;
45
};
46
47
class SCAVE_API FileWriterNodeType : public SingleSinkNodeType
48
{
49
    public:
50
        virtual const char *getName() const {return "filewriter";}
51
        virtual const char *getDescription() const;
52
        virtual void getAttributes(StringMap& attrs) const;
53
        virtual Node *create(DataflowManager *mgr, StringMap& attrs) const;
54
};
55
56
57
NAMESPACE_END
58
59
60
#endif
61