-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatomic.h
More file actions
103 lines (68 loc) · 2.38 KB
/
atomic.h
File metadata and controls
103 lines (68 loc) · 2.38 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*******************************************************************
*
* DESCRIPTION: class Atomic
*
* AUTHOR: Amir Barylko & Jorge Beyoglonian
* VERSION 2: Daniel Rodriguez
* VERSION 3: Alejandro Troccoli
*
* EMAIL: mailto://amir@dc.uba.ar
* mailto://jbeyoglo@dc.uba.ar
* mailto://drodrigu@dc.uba.ar
* mailto://atroccol@dc.uba.ar
*
* DATE: 27/6/1998
* DATE: 25/4/1999 (v2)
* DATE: 07/11/2000 (v3)
*
*******************************************************************/
#ifndef __ATOMIC_H
#define __ATOMIC_H
/** include files **/
#include "model.h" //class Model
#include "atomicstate.h" //class AtomicState
#include "pSimulatorState.h"
#include "message.h"
#include "msgbag.h"
#define ATOMIC_NAME "Atomic"
/** definitions **/
class Atomic : public Model
{
public:
virtual ~Atomic(); // Destructor
protected:
friend class ParallelSimulator ;
Atomic( const std::string &name = "Atomic" ); // Constructor
Atomic( const Atomic & ) ; // Copy constructor
Atomic &operator = ( const Atomic & ); // Assignment operator
int operator ==( const Atomic & ) const; // Equality operator
virtual Model &initFunction() = 0;
virtual Model &externalFunction ( const MessageBag & );
virtual Model &externalFunction( const ExternalMessage & );
virtual Model &internalFunction( const InternalMessage & ) = 0 ;
virtual Model &outputFunction( const CollectMessage & ) = 0 ;
virtual Model &confluentFunction ( const InternalMessage &, const MessageBag & );
Model &holdIn( const AtomicState::State &, const VTime & ) ;
Model &passivate();
Model &state( const AtomicState::State &s )
{ ((AtomicState *)getCurrentState())->st = s; return *this; }
const AtomicState::State &state() const
{return ((AtomicState *)getCurrentState())->st;}
virtual std::string className() const
{return ATOMIC_NAME;}
//State functions
virtual ModelState* allocateState();
//Returns the current model state.
//This method will only be available for those atomic models
//thar are local to the current machine
virtual ModelState* getCurrentState() const;
virtual ModelState* getCurrentState() ;
virtual ParallelProcessor &createParallelProcessor();
unsigned long totalProcCount() const;
unsigned long localProcCount() const;
private:
friend class MainSimulator ;
friend class StandAloneMainSimulator;
friend class ParallelMainSimulator;
}; // class Atomic
#endif //__ATOMIC_H