Package org.ros.internal.node.topic
Class PublisherFactory
java.lang.Object
org.ros.internal.node.topic.PublisherFactory
A factory for
Publisher instances.- Author:
- damonkohler@google.com (Damon Kohler)
-
Constructor Summary
ConstructorsConstructorDescriptionPublisherFactory(NodeIdentifier nodeIdentifier, TopicParticipantManager topicParticipantManager, org.ros.message.MessageFactory messageFactory, ScheduledExecutorService executorService) -
Method Summary
Modifier and TypeMethodDescription<T> Publisher<T>newOrExisting(TopicDeclaration topicDeclaration, org.ros.message.MessageSerializer<T> messageSerializer) Gets or creates aPublisherinstance.
-
Constructor Details
-
PublisherFactory
public PublisherFactory(NodeIdentifier nodeIdentifier, TopicParticipantManager topicParticipantManager, org.ros.message.MessageFactory messageFactory, ScheduledExecutorService executorService)
-
-
Method Details
-
newOrExisting
public <T> Publisher<T> newOrExisting(TopicDeclaration topicDeclaration, org.ros.message.MessageSerializer<T> messageSerializer) Gets or creates aPublisherinstance.Publishers are cached and reused per topic. When a newPublisheris generated, it is registered with the master.- Type Parameters:
T- the message type associated with thePublisher- Parameters:
topicDeclaration-TopicDeclarationthat is being publishedmessageSerializer- theMessageSerializerused for published messages- Returns:
- a new or cached
Publisherinstance
-