Package org.ros.internal.node.topic
Class SubscriberFactory
java.lang.Object
org.ros.internal.node.topic.SubscriberFactory
A factory for
Subscriber instances.- Author:
- damonkohler@google.com (Damon Kohler)
-
Constructor Summary
ConstructorsConstructorDescriptionSubscriberFactory(NodeIdentifier nodeIdentifier, TopicParticipantManager topicParticipantManager, ScheduledExecutorService executorService) -
Method Summary
Modifier and TypeMethodDescription<T> Subscriber<T>newOrExisting(TopicDeclaration topicDeclaration, org.ros.message.MessageDeserializer<T> messageDeserializer) Gets or creates aSubscriberinstance.
-
Constructor Details
-
SubscriberFactory
public SubscriberFactory(NodeIdentifier nodeIdentifier, TopicParticipantManager topicParticipantManager, ScheduledExecutorService executorService)
-
-
Method Details
-
newOrExisting
public <T> Subscriber<T> newOrExisting(TopicDeclaration topicDeclaration, org.ros.message.MessageDeserializer<T> messageDeserializer) Gets or creates aSubscriberinstance.Subscribers are cached and reused per topic. When a newSubscriberis generated, it is registered with the master.- Type Parameters:
T- the message type associated with the newSubscriber- Parameters:
topicDeclaration-TopicDeclarationthat is subscribed tomessageDeserializer- theMessageDeserializerto use for incoming messages- Returns:
- a new or cached
Subscriberinstance
-