TTToken
Tokens carry values between SQs, and contain TTTime
and TTTag
attributes that designate their context with respect to time and their place
within the application. The TTTime
is primarily used to associate like
tokens during the synchronization phase of an SQ.
Tokens may carry any serializable value (there is no shared memory between SQs or Ensembles); we use Python native ‘pickle’ format for serialization. For example, a ‘Process’ object is not serializable, nor are most objects that work with hardware interfaces. The best way to check if an object is serializable is by calling pickle.dumps(obj), which will raise an Exception if it is not serializable.
- class ticktalkpython.TTToken.TTToken(value, time, streaming=False, tag=None)
TTToken
objects carry a data value and a time-tag. They are designed and implemented in such a way that many Python infix operators can acceptTTToken
objects as parameters, extracting the data value and operating on that while properly handling the time value.Tokens originating from streaming sources should be flagged as such by setting the
streaming
parameter toTrue
- Parameters:
value (any) – an un-interpreted item representing the data to be transported by this token
time (TTTime) – the time corresponding to the value – intended to indicate the interval of its validity
streaming (bool, optional) – a flag indicating that this token originated from a streaming souroce or from an SQ that had received a streaming token as input
tag (
TTTag
) – A tag that dictates where to send a token in the TickTalk system and program
- copy_token()
Make a copy of the token. The tag and value are deep copied , but the time is not, as it would lead to copies of the clock tree, which may cause odd side effects
- Returns:
A copy of this token
- Return type:
TTToken