TaurusFactory
¶

-
class
TaurusFactory
[source]¶ Bases:
object
The base class for valid Factories in Taurus.
-
DefaultPollingPeriod
= 3000¶
-
addAttributeToPolling
(attribute, period, unsubscribe_evts=False)[source]¶ Activates the polling (client side) for the given attribute with the given period (seconds).
Parameters: - attribute (
TangoAttribute
) – attribute name. - period (
float
) – polling period (in seconds) - unsubscribe_evts (
bool
) – whether or not to unsubscribe from events
- attribute (
-
caseSensitive
= True¶
-
cleanUp
()[source]¶ Reimplement if you need to execute code on program execution exit. Default implementation does nothing.
-
findObjectClass
(absolute_name)[source]¶ Obtain the class object corresponding to the given name.
Note, this generic implementation expects that derived classes provide a an attribute called elementTypesMap consisting in a dictionary whose keys are TaurusElementTypes and whose values are the corresponding specific object classes. e.g., the FooFactory should provide:
class FooFactory(TaurusFactory): elementTypesMap = {TaurusElementType.Authority: FooAuthority, TaurusElementType.Device: FooDevice, TaurusElementType.Attribute: FooAttribute, } (...)
Parameters: absolute_name ( str
) – the object absolute name stringReturn type: TaurusModel
orNone
Returns: a TaurusModel class derived type or None if the name is not valid
-
getAttribute
(string attr_name) → taurus.core.taurusattribute.TaurusAttribute[source]¶ Obtain the object corresponding to the given attribute name. If the corresponding attribute already exists, the existing instance is returned. Otherwise a new instance is stored and returned.
Parameters: attr_name – [in] string attribute name
Returns: a taurus.core.taurusattribute.TaurusAttribute object
Raise: TaurusException: if the given name is invalid.
-
getAuthority
(string db_name) → taurus.core.taurusauthority.TaurusAuthority[source]¶ Obtain the object corresponding to the given authority name or the default authority if db_name is None. If the corresponding authority object already exists, the existing instance is returned. Otherwise a new instance is stored and returned.
Parameters: db_name – [in] authority name string. It should be formed like: <scheme>://<authority>. If <scheme> is ommited then it will use the default scheme. if db_name is None, the default authority is used
Returns: a taurus.core.taurusauthority.TaurusAuthority object
Raise: TaurusException: if the given name is invalid.
-
getDevice
(string dev_name) → taurus.core.taurusdevice.TaurusDevice[source]¶ Obtain the object corresponding to the given device name. If the corresponding device already exists, the existing instance is returned. Otherwise a new instance is stored and returned.
Parameters: dev_name – [in] the device name string. It should be formed like: <scheme>://<authority>/<device name>. If <scheme> is ommited then it will use the default scheme. If authority is ommited then it will use the default authority for the scheme.
Returns: a taurus.core.taurusdevice.TaurusDevice object
Raise: TaurusException: if the given name is invalid.
-
getSerializationMode
()[source]¶ Gives the serialization operation mode.
Return type: TaurusSerializationMode
Returns: the current serialization mode
-
getValidTypesForName
(name, strict=None)[source]¶ Returns a list of all Taurus element types for which name is a valid model name (while in many cases a name may only be valid for one element type, this is not necessarily true in general)
In this base implementation, name is checked first for Attribute, then for Device and finally for Authority, and the return value is sorted in that same order.
If a given schema requires a different ordering, reimplement this method
Parameters: name ( str
) – taurus model nameReturn type: list
<element
>Returns: where element can be one of: Attribute, Device or Authority
-
isPollingEnabled
()[source]¶ Tells if the local tango polling is enabled
Return type: bool
Returns: whether or not the polling is enabled
-
removeAttributeFromPolling
(attribute)[source]¶ Deactivate the polling (client side) for the given attribute. If the polling of the attribute was not previously enabled, nothing happens.
Parameters: attribute ( str
) – attribute name.
-
schemes
= ()¶
-
setSerializationMode
(mode)[source]¶ Sets the serialization mode for the system.
Parameters: mode ( TaurusSerializationMode
) – the new serialization mode
-