21 package org.opensplice.dds.topic;
23 import java.util.Arrays;
24 import java.util.List;
25 import java.util.concurrent.atomic.AtomicInteger;
43 private final DDS.ContentFilteredTopic old;
46 private AtomicInteger refCount;
51 List<String> expressionParameters) {
52 this.environment = environment;
54 this.relatedTopic = relatedTopic;
55 this.relatedTopic.
retain();
56 this.refCount =
new AtomicInteger(1);
58 if (expressionParameters != null) {
59 this.old = parent.
getOld().create_contentfilteredtopic(
64 .toArray(
new String[expressionParameters.size()]));
66 this.old = parent.
getOld().create_contentfilteredtopic(name,
67 relatedTopic.
getOld(), filterExpression, null);
70 if (this.old == null) {
77 return this.relatedTopic.getTypeSupport();
80 @SuppressWarnings(
"unchecked")
87 }
catch (ClassCastException cce) {
89 "Unable to perform requested cast.");
96 return this.old.get_type_name();
101 return this.old.get_name();
111 int newValue = this.refCount.decrementAndGet();
114 this.parent.destroyContentFilteredTopic(
this);
115 }
else if (newValue < 0) {
117 "ContentFilteredTopic already closed.");
123 return this.environment;
133 return this.old.get_filter_expression();
138 DDS.StringSeqHolder holder =
new DDS.StringSeqHolder();
139 int rc = this.old.get_expression_parameters(holder);
141 "ContentFilteredTopic.getExpressionParameters() failed.");
142 return Arrays.asList(holder.value);
147 if (expressionParameters == null) {
149 "expressionParameters == null");
151 this.old.set_expression_parameters(expressionParameters
152 .toArray(
new String[expressionParameters.size()]));
158 return this.relatedTopic;
163 if (expressionParameters == null) {
165 "expressionParameters == null");
172 int newValue = this.refCount.incrementAndGet();
175 int refCount = this.refCount.decrementAndGet();
177 "ContentFilteredTopic already closed. refcount:" + refCount);
179 assert (newValue > newValue - 1);
180 assert (newValue > 1);
The DomainParticipant object plays several roles:
ContentFilteredTopicImpl(OsplServiceEnvironment environment, DomainParticipantImpl parent, String name, AbstractTopic< TYPE > relatedTopic, String filterExpression, List< String > expressionParameters)
void close()
Dispose the resources held by this object.
Topic<? extends TYPE > getRelatedTopic()
The org.omg.dds.topic.Topic associated with the ContentFilteredTopic, that is, the Topic specified wh...
DDS.TopicDescription getOld()
List< String > getExpressionParameters()
This operation returns the expression parameters associated with the ContentFilteredTopic, that is, the parameters specified on the last successful call to setExpressionParameters(List), or if setExpressionParameters(List) was never called, the parameters specified when the ContentFilteredTopic was created.
String getTypeName()
Returns the type name used to create the TopicDescription.
ServiceEnvironment getEnvironment()
String getFilterExpression()
The filter expression associated with the ContentFilteredTopic, that is, the expression specified whe...
void setExpressionParameters(List< String > expressionParameters)
This operation changes the expression parameters associated with the ContentFilteredTopic.
void setExpressionParameters(String... expressionParameters)
This operation changes the expression parameters associated with the ContentFilteredTopic.
DomainParticipant getParent()
Returns the org.omg.dds.domain.DomainParticipant to which the TopicDescription belongs.
static void checkReturnCode(int retCode, OsplServiceEnvironment environment, String message)
TypeSupport< TYPE > getTypeSupport()
Returns the org.omg.dds.type.TypeSupport used to create this TopicDescription.
String getName()
Returns the name used to create the TopicDescription.
TypeSupport is an abstract interface that has to be specialized for each concrete type that will be u...
ContentFilteredTopic is a specialization of TopicDescription that allows for content-based subscripti...
DDS implementations are rooted in this class, a concrete subclass of which can be instantiated based ...
static void throwLastErrorException(OsplServiceEnvironment environment)
This interface is the base for org.omg.dds.topic.Topic, org.omg.dds.topic.ContentFilteredTopic, and org.omg.dds.topic.MultiTopic.
Topic is the most basic description of the data to be published and subscribed.
void retain()
Indicates that references to this object may go out of scope but that the application expects to look...