Public Member Functions | |
def | __init__ |
def | disable_buffer |
def | enable_buffer |
def | get_from_buffer |
def | get_last_msg |
def | has_buffered |
def | has_msg |
def | has_topic |
def | is_available |
def | make_persistant |
def | remove_last_msg |
def | set_callback |
def | shutdown |
def | subscribe |
def | unsubscribe_topic |
Private Member Functions | |
def | _callback |
Static Private Attributes | |
list | _persistant_topics = [] |
_simulate_delay = False | |
dictionary | _topics = {} |
A proxy for subscribing topics that caches and buffers received messages.
Definition at line 10 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached.__init__ | ( | self, | |
topics = {} |
|||
) |
Initializes the proxy with optionally a given set of topics. @type topics: dictionary string - message_class @param topics: A dictionary containing a collection of topic - message type pairs.
Definition at line 19 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached._callback | ( | self, | |
msg, | |||
topic | |||
) | [private] |
Standard callback that is executed when a message is received. @type topic: message @param topic: The latest message received on this topic. @type topic: string @param topic: The topic to which this callback belongs.
Definition at line 57 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached.disable_buffer | ( | self, | |
topic | |||
) |
Disables the buffer on the given topic. @type topic: string @param topic: The topic of interest.
Definition at line 100 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached.enable_buffer | ( | self, | |
topic | |||
) |
Enables the buffer on the given topic. @type topic: string @param topic: The topic of interest.
Definition at line 90 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached.get_from_buffer | ( | self, | |
topic | |||
) |
Pops the oldest buffered message of the given topic. @type topic: string @param topic: The topic of interest.
Definition at line 131 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached.get_last_msg | ( | self, | |
topic | |||
) |
Returns the latest cached message of the given topic. @type topic: string @param topic: The topic of interest.
Definition at line 121 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached.has_buffered | ( | self, | |
topic | |||
) |
Determines if the given topic has any messages in its buffer. @type topic: string @param topic: The topic of interest.
Definition at line 156 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached.has_msg | ( | self, | |
topic | |||
) |
Determines if the given topic has a message in its cache. @type topic: string @param topic: The topic of interest.
Definition at line 146 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached.has_topic | ( | self, | |
topic | |||
) |
Determines if the given topic is already subscribed. @type topic: string @param topic: The topic of interest.
Definition at line 193 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached.is_available | ( | self, | |
topic | |||
) |
Checks if the subscriber on the given topic is available. @type topic: string @param topic: The topic of interest.
Definition at line 111 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached.make_persistant | ( | self, | |
topic | |||
) |
Makes the given topic persistant which means messages can no longer be removed (remove_last_msg will have no effect), only overwritten by a new message. @type topic: string @param topic: The topic of interest.
Definition at line 182 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached.remove_last_msg | ( | self, | |
topic, | |||
clear_buffer = False |
|||
) |
Removes the cached message of the given topic and optionally clears its buffer. @type topic: string @param topic: The topic of interest. @type topic: boolean @param topic: Set to true if the buffer of the given topic should be cleared as well.
Definition at line 166 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached.set_callback | ( | self, | |
topic, | |||
callback | |||
) |
Adds the given callback to the topic subscriber. @type topic: string @param topic: The topic to add the callback to. @type callback: function @param callback: The callback to be added.
Definition at line 77 of file proxy_subscriber_cached.py.
Shuts this proxy down by unregistering all subscribers.
Definition at line 217 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached.subscribe | ( | self, | |
topic, | |||
msg_type, | |||
callback = None , |
|||
buffered = False |
|||
) |
Adds a new subscriber to the proxy. @type topic: string @param topic: The topic to subscribe. @type msg_type: a message class @param msg_type: The type of messages of this topic. @type callback: function @param callback: A function to be called when receiving messages. @type buffered: boolean @param buffered: True if all messages should be bufferd, False if only the last message should be cached.
Definition at line 30 of file proxy_subscriber_cached.py.
def flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached.unsubscribe_topic | ( | self, | |
topic | |||
) |
Removes the given topic from the list of subscribed topics. @type topic: string @param topic: The topic of interest.
Definition at line 205 of file proxy_subscriber_cached.py.
list flexbe_core::proxy::proxy_subscriber_cached.ProxySubscriberCached::_persistant_topics = [] [static, private] |
Definition at line 17 of file proxy_subscriber_cached.py.
flexbe_core::proxy::proxy_subscriber_cached.ProxySubscriberCached::_simulate_delay = False [static, private] |
Definition at line 14 of file proxy_subscriber_cached.py.
dictionary flexbe_core::proxy::proxy_subscriber_cached.ProxySubscriberCached::_topics = {} [static, private] |
Definition at line 16 of file proxy_subscriber_cached.py.