Safe Haskell | None |
---|
SoOSiM.Types
- type ComponentId = Unique
- type ComponentName = String
- class ComponentIface s where
- initState :: s
- componentName :: s -> ComponentName
- componentBehaviour :: s -> ComponentInput -> SimM s
- data ComponentContext = forall s . ComponentIface s => CC {
- componentId :: ComponentId
- currentStatus :: TVar (ComponentStatus s)
- componentState :: TVar s
- creator :: ComponentId
- msgBuffer :: TVar [ComponentInput]
- traceMsgs :: [String]
- simMetaData :: TVar SimMetaData
- data SimMetaData = SimMetaData {}
- data ComponentStatus a
- = Idle
- | WaitingForMsg ComponentId (Dynamic -> SimM a)
- | Running
- data ComponentInput
- type NodeId = Unique
- data NodeInfo = NodeInfo
- data Node = Node {}
- newtype SimM a = SimM {}
- data RequestOrYield request response x
- type SimMonad = StateT SimState IO
- data SimState = SimState {}
- data StateContainer = forall s . ComponentIface s => SC s
Documentation
type ComponentId = UniqueSource
type ComponentName = StringSource
class ComponentIface s whereSource
Type class that defines every OS component
Methods
The minimal internal state of your component
componentName :: s -> ComponentNameSource
A function returning the unique global name of your component
componentBehaviour :: s -> ComponentInput -> SimM sSource
The function defining the behaviour of your component
data ComponentContext Source
Context of a running component in the simulator.
We need rank-2 types because we need to make a single collection of several component contexts, each having their own type representing their internal state.
Constructors
forall s . ComponentIface s => CC | |
Fields
|
data SimMetaData Source
Constructors
SimMetaData | |
Fields
|
data ComponentStatus a Source
Status of a running component
Constructors
Idle | Component is doing nothing |
WaitingForMsg ComponentId (Dynamic -> SimM a) | Component is waiting for a message from |
Running | Component is busy doing computations |
data ComponentInput Source
Events send to components by the simulator
Constructors
ComponentMsg ComponentId Dynamic | A message send another component: the field argument is the |
NodeMsg NodeId Dynamic | A message send by a node: the first field is the |
Initialize | Event send when a component is first created |
Deinitialize | Event send when a component is about to be removed |
Tick | Event send every simulation round |
Instances
Meta-data describing the functionaly of the computing node, currently just a singleton type.
Constructors
NodeInfo |
Nodes represent computing entities in the simulator, and host the OS components and application threads
Constructors
Node | |
Fields
|
data RequestOrYield request response x Source
Instances
Functor (RequestOrYield x f) |
type SimMonad = StateT SimState IOSource
The internal monad of the simulator is currently a simple state-monad wrapping IO
The internal simulator state
Constructors
SimState | |
Fields
|
Instances
data StateContainer Source
Constructors
forall s . ComponentIface s => SC s |