Table Of Contents

Previous topic

dsx.application

Next topic

The TCG

This Page

The Task abstract model

Task Ports

The taskmodel module defines all the datatypes needed to define a new Task Model. All ports inherit the TaskPort

Inheritance diagram of MwmrPort, MwmrInput, MwmrOutput, MwmrObserver, ConstPort, MemspacePort, BarrierPort, LockPort

class dsx.application.taskmodel.TaskPort

A TaskModel port.

accept

A dsx.application.widget.Widget subclass, or list of subclasses.

convert(rsrc)

Converts a given data to the correct resource type

Parameters:rsrc – An object or value
Returns:A datatype asserting isCompatible()
isCompatible(rsrc)

Checks whether the passed resource is conform to the types accepted by this port.

class dsx.application.taskmodel.ConstPort
accept

alias of Const

class dsx.application.taskmodel.BarrierPort
accept

alias of Barrier

class dsx.application.taskmodel.MwmrPort
__init__(width)

Creates a new MwmrPort

Parameters:size (int, bytes) – Size of one item in the channel
accept

alias of Mwmr

class dsx.application.taskmodel.MwmrInput
__init__(width)

Creates a new MwmrPort

Parameters:size (int, bytes) – Size of one item in the channel
class dsx.application.taskmodel.MwmrOutput
__init__(width)

Creates a new MwmrPort

Parameters:size (int, bytes) – Size of one item in the channel
class dsx.application.taskmodel.MwmrObserver
accept

alias of Mwmr

class dsx.application.taskmodel.LockPort
accept

alias of Lock

class dsx.application.taskmodel.MemspacePort
__init__(size)

Creates a new MemspacePort

Parameters:size (int, bytes) – Minimal size of Memspace
accept

alias of Memspace

Task Model

class dsx.application.taskmodel.TaskModel
__init__(name, ports={}, impls=[])

Creates a Task definition.

fifos, locks, barriers, memspaces and signals are names (i.e. strings) of ports for each of those resources. Thread instantiated from this task will have to plug something into those slots.

Evey resource should have an unique name for this task.

checkUpInstance(inst)

Checks the instance satisfies all the implementation’s constraints.

Parameters:inst (dsx.application.widgets.Task) – Task instance
Returns:None if OK
Raises :any, if check failed
classmethod getByName(name)

Retrieves an already-declared model by its name

Parameters:name (str) – Model name
Returns:A TaskModel object
Raises :KeyError if not found
getDeclaration()

Retrieves the file name and line where this model was declared.

Returns:a dsx.util.place.Place object
getImpl(clas)

Retrieves a task implementation by its class.

Parameters:clas (dsx.application.taskmodel.TaskImpl subclass) – Implementation class type
Returns:an clas instance object
Raises :NotImplementedError if not found
models = {}

This defines the model of a processing entity. Each implementation should be declared on its own, and referenced here.

For each instance of a task purpose is to map i/o and resources.

This is used to declare _all_ ways of communication of a task.

classmethod registerByName(name, model)

Registers a model

Parameters:
setDeclaration(level=0)

Sets the declaration place from the current traceback.

Parameters:level (int) – Levels to go above the caller’s one.

Task Implementation

class dsx.application.taskmodel.TaskImpl

A task implementation. Implementations have to be attached to models, when they are, setModel() is called with the model.

__init__(type)

Creates a new implementation

Parameters:type (str) – Implementation type name
checkUpInstance(inst)

Asserts the task instance is valid for the model.

Parameters:inst (Task) – a Task instance
Returns:None if OK
Raises :any, if check failed
model()

Accessor for attached model

Returns:a TaskModel object
setModel(model)

Called by TaskModel when scanning through implementations.

Parameters:model (TaskModel) – Attached model