| Safe Haskell | Safe-Infered |
|---|
SoOSiM
- data SimM a
- type ComponentId = Unique
- type NodeId = Unique
- class ComponentIface s where
- initState :: s
- componentName :: s -> ComponentName
- componentBehaviour :: s -> ComponentInput -> SimM s
- data ComponentInput
- registerComponent :: ComponentIface s => s -> SimM ()
- createComponent :: Maybe NodeId -> Maybe ComponentId -> String -> SimM ComponentId
- invoke :: Maybe ComponentId -> ComponentId -> Dynamic -> SimM Dynamic
- invokeNoWait :: Maybe ComponentId -> ComponentId -> Dynamic -> SimM ()
- yield :: ComponentIface s => s -> SimM s
- getComponentId :: SimM ComponentId
- getNodeId :: SimM NodeId
- createNode :: SimM NodeId
- writeMemory :: Maybe NodeId -> Int -> Dynamic -> SimM ()
- readMemory :: Maybe NodeId -> Int -> SimM Dynamic
- componentCreator :: SimM ComponentId
- componentLookup :: Maybe NodeId -> ComponentName -> SimM (Maybe ComponentId)
- runIO :: IO a -> SimM a
- traceMsg :: String -> SimM ()
- module Data.Dynamic
- module Unique
Documentation
type ComponentId = UniqueSource
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 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
registerComponent :: ComponentIface s => s -> SimM ()Source
Register a component interface with the simulator
Arguments
| :: Maybe NodeId | Node to create component on, leave to |
| -> Maybe ComponentId | ComponentId to set as parent, set to |
| -> String | Name of the registered component |
| -> SimM ComponentId |
|
Create a new component
Arguments
| :: Maybe ComponentId | Caller, leave |
| -> ComponentId | Callee |
| -> Dynamic | Argument |
| -> SimM Dynamic | Response from recipient |
Synchronously invoke another component
Arguments
| :: Maybe ComponentId | Caller, leave |
| -> ComponentId | Callee |
| -> Dynamic | Argument |
| -> SimM () | Call returns immediately |
Invoke another component, don't wait for a response
yield :: ComponentIface s => s -> SimM sSource
Yield to the simulator scheduler
getComponentId :: SimM ComponentIdSource
Get the component id of your component
Arguments
| :: Maybe NodeId | Node you want to write on, leave |
| -> Int | Address to write |
| -> Dynamic | Value to write |
| -> SimM () |
Write memory of local node
Arguments
| :: Maybe NodeId | Node you want to look on, leave |
| -> Int | Address to read |
| -> SimM Dynamic |
Read memory of local node
componentCreator :: SimM ComponentIdSource
Return the ComponentId of the component that created the current component
Arguments
| :: Maybe NodeId | Node you want to look on, leave |
| -> ComponentName | Name of the component you are looking for |
| -> SimM (Maybe ComponentId) |
|
Get the unique ComponentId of a certain component
module Data.Dynamic
module Unique