Project

General

Profile

Statistics
| Branch: | Revision:

root / src / tkenv / statinsp.h @ e1750c09

History | View | Annotate | Download (3.12 KB)

1
//==========================================================================
2
//  STATINSP.H - part of
3
//
4
//                     OMNeT++/OMNEST
5
//            Discrete System Simulation in C++
6
//
7
//==========================================================================
8

    
9
/*--------------------------------------------------------------*
10
  Copyright (C) 1992-2008 Andras Varga
11
  Copyright (C) 2006-2008 OpenSim Ltd.
12

13
  This file is distributed WITHOUT ANY WARRANTY. See the file
14
  `license' for details on this and other legal matters.
15
*--------------------------------------------------------------*/
16

    
17
#ifndef __STATINSP_H
18
#define __STATINSP_H
19

    
20
#include <tk.h>
21
#include "inspector.h"
22
#include "envirbase.h"
23

    
24
NAMESPACE_BEGIN
25

    
26

    
27
class THistogramWindow : public TInspector
28
{
29
   protected:
30
      char canvas[64];
31
   public:
32
      THistogramWindow(cObject *obj,int typ,const char *geom,void *dat=NULL);
33
      virtual void createWindow();
34
      virtual void update();
35
      virtual void writeBack() {}
36
      virtual int inspectorCommand(Tcl_Interp *interp, int argc, const char **argv);
37

    
38
      // return textual information in general or about a value/value pair
39
      void generalInfo( char *buf );
40
      void getCellInfo( char *buf, int cellindex );
41
};
42

    
43
class CircBuffer
44
{
45
   public:
46
      struct CBEntry {
47
        simtime_t t;
48
        double value1, value2;
49
      };
50
   protected:
51
      CBEntry *buf;
52
      int siz, n, head;
53
   public:
54
      CircBuffer( int size );
55
      ~CircBuffer();
56
      void add(simtime_t t, double value1, double value2);
57
      int headPos() {return head;}
58
      int tailPos() {return (head-n+1+siz)%siz;}
59
      int items() {return n;}
60
      int size() {return siz;}
61
      CBEntry& entry(int k) {return buf[k];}
62
};
63

    
64
class TOutVectorWindow : public TInspector
65
{
66
   public:
67
      CircBuffer circbuf;     // buffer to store values
68
   protected:
69
      char canvas[64];        // widget namestr
70

    
71
      // configuration
72
      enum {DRAW_DOTS, DRAW_BARS, DRAW_PINS, DRAW_SAMPLEHOLD, DRAW_LINES, NUM_DRAWINGMODES};
73
      bool autoscale;
74
      int drawing_mode;
75
      double miny, maxy;
76
      double time_factor; // x scaling: secs/10 pixel
77
      simtime_t moving_tline;   // t position of moving axis
78

    
79
   public:
80
      TOutVectorWindow(cObject *obj,int typ,const char *geom,void *dat=NULL, int size=100);
81
      ~TOutVectorWindow();
82
      virtual void createWindow();
83
      virtual void update();
84
      virtual int inspectorCommand(Tcl_Interp *interp, int argc, const char **argv);
85

    
86
      // return textual information in general or about a value/value pair
87
      void generalInfo( char *buf );
88
      void valueInfo( char *buf, int valueindex );
89

    
90
      // configuration get (text form) / set
91
      void getConfig( char *buf );
92
      void setConfig( bool autoscale, double timef, double miny, double maxy, const char *mode);
93
};
94

    
95
//
96
// *** Note: the following inspectors have been replaced with TGenericObjectInspector ***
97
//
98
// class TStatisticInspector: public TInspector
99
// {
100
//    public:
101
//       TStatisticInspector(cObject *obj,int typ,const char *geom,void *dat=NULL);
102
//       virtual void createWindow();
103
//       virtual void update();
104
// };
105
//
106

    
107
NAMESPACE_END
108

    
109

    
110
#endif
111

    
112