3.1.18. c3po.LocalExchanger module
Contains the classes LocalExchanger, ShortcutToField and ShortcutToValue.
ShortcutToData is for internal use only.
- class c3po.LocalExchanger.LocalExchanger(method, fieldsToGet, fieldsToSet, valuesToGet=[], valuesToSet=[])
Bases:
ExchangerLocalExchangeris anExchangerfor local data exchanges betweenDataAccessorobjects (PhysicsDriverorLocalDataManager).Once the object has been constructed, a call to
exchange()triggers the exchanges of data.- __init__(method, fieldsToGet, fieldsToSet, valuesToGet=[], valuesToSet=[])
Build a
LocalExchangerobject.- Parameters:
method –
A user-defined function (or class with the special method
__call__).- method must have three input lists:
The MED fields obtained by
(get/update)OutputMED(Double/Int/String)Field()from thefieldsToGetobjects, in the same order.The MED fields obtained by
getInputMED(Double/Int/String)FieldTemplate()from thefieldsToSetobjects, in the same order.The scalars obtained by
(get/update)Output(Double/Int/String)Value()from thevaluesToGetobjects, in the same order.
- It must have two ouput lists:
The MED fields to impose by
setInputMED(Double/Int/String)Field()to thefieldsToSetobjects, in the same order.The scalars to impose by
setIntput(Double/Int/String)Value()to thevaluesToSetobjects, in the same order.
A list of tuples
(object, name, type).objectmust be either aDataAccessor(PhysicsDriveror aLocalDataManager), or aCollaborativeObjectwithDataAccessorobjects.nameis the name of the field to get from object.typeis either ‘Double’, ‘Int’ or ‘String’ (seec3po.DataAccessor.DataAccessor.ValueType).typecan be omitted: in this case,LocalExchangerusesgetFieldTypeto get the type. IfgetFieldTypeis not implemented, ‘Double’ is tried.
fieldsToSet (list[tuple]) – A list of tuples in the same format as
fieldsToGet.nameis the name of the field to set in object.valuesToGet (list[tuple]) – Idem
fieldsToGetbut for scalars.valuesToSet (list[tuple]) – Idem
fieldsToSetbut for scalars.
- clean()
See
Exchanger.clean().
- exchange()
Trigger the exchange of data.