File: Generator.hpp

package info (click to toggle)
vite 1.2%2Bsvn1430-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 20,164 kB
  • ctags: 3,915
  • sloc: cpp: 26,903; makefile: 455; sh: 111; ansic: 67
file content (88 lines) | stat: -rw-r--r-- 2,779 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef _VITE_GENERATOR_
#define _VITE_GENERATOR_

#include <QMainWindow>

#include "PajeGenerator.hpp"
#include "TauGenerator.hpp"
#include "OTFGenerator.hpp"

typedef struct _my_link{
    int time;
    int proc;
    int type;
    int value;
    int key;
}my_link;

class Generator : public Writer{

private :
    PajeGenerator* _pajeGen;
    TauGenerator * _tauGen ;
    OTFGenerator * _otfGen ;

    bool _paje;
    bool _tau;
    bool _otf;

    // Values 
    QString _name          ; // Name of the file to create
    int     _depth         ; // Depth of the container tree
    int     _procNbr       ; // Number of procs
    int     _numberOfState ; // Number of different states
    int     _numberOfLine  ; // Number of line generated
    bool    _counter       ; // If counter are enabled
    bool    _event         ; // If events are enabled
    bool    _link          ; // If link are enabled
    int     _linkNbr       ; // Number of proc with links
    int     _linkTypeNbr   ; // Number of type of link
    int     _eventNbr      ; // Number of proc with events
    int     _eventTypeNbr  ; // Number of event type
    int     _counterNbr    ; // Number of proc with counters
    int     _numberAction  ; // Number of action available

    // List of started links
    QList<my_link> _startedLink  ;
    int         _size         ; // Number of link started
    int*        _arrayOfValues; 

    // Action = changeState, startLink, endLink, event, incCpt, decCpt
    static const int TYPEACTION  = 6;
    static const int CHANGESTATE = 0;
    static const int STARTLINK   = 1;
    static const int ENDLINK     = 2;
    static const int EVENT       = 3;
    static const int INCCPT      = 4;
    static const int DECCPT      = 5;

    int getRand (int maxVal);
    void launchAction (int val, int time);
    my_link getLink (int pos);

public :

    // Constructor
    Generator (QString name,
               int depth, int procNbr, int nbrOfState, int nbrOfLine, 
               int countNbr, int eventNbr, int linkNbr,
               int eventTypeNbr, int linkTypeNbr,
               bool paje, bool otf, bool tau);
    // Destructor
    virtual ~Generator     ();
    // Main function that launch the creation of the traces
    void generate  ();

    void initTrace (QString name, int depth, int procNbr, int stateTypeNbr, int eventTypeNbr, int linkTypeNbr, int varNbr);
    void addState  (int proc    , int state, double time);
    void startLink (int proc    , int type , double time);
    void endLink   (int proc    , int type , double time);
    void addEvent  (int proc    , int type , double time);
    void incCpt    (int proc    , int var  , double time);
    void decCpt    (int proc    , int var  , double time);
    void endTrace  ();

};


#endif