OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
StatusConditionImpl.java
Go to the documentation of this file.
1 /*
2  * Vortex OpenSplice
3  *
4  * This software and documentation are Copyright 2006 to 2024 ADLINK
5  * Technology Limited, its affiliated companies and licensors. All rights
6  * reserved.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 package org.opensplice.dds.core;
22 
23 import java.util.Arrays;
24 import java.util.Collection;
25 import java.util.Set;
26 
27 import org.omg.dds.core.Entity;
30 import org.omg.dds.core.status.Status;
32 
33 public class StatusConditionImpl<T extends Entity<?, ?>> implements
34  StatusCondition<T>, Condition<DDS.StatusCondition> {
35  private final DDS.StatusCondition old;
36  private final T parent;
37  private final OsplServiceEnvironment environment;
38 
40  DDS.StatusCondition oldCondition, T parent) {
41  this.old = oldCondition;
42  this.parent = parent;
43  this.environment = environment;
44  }
45 
46  @Override
47  public boolean getTriggerValue() {
48  return this.old.get_trigger_value();
49  }
50 
51  @Override
53  return this.environment;
54  }
55 
56  @Override
57  public T getParent() {
58  return this.parent;
59  }
60 
61  @Override
62  public Set<Class<? extends Status>> getEnabledStatuses() {
63  return StatusConverter.convertMask(this.environment,
64  this.old.get_enabled_statuses());
65  }
66 
67  @Override
68  public void setEnabledStatuses(Collection<Class<? extends Status>> statuses) {
69  int rc = this.old.set_enabled_statuses(StatusConverter.convertMask(
70  this.environment, statuses));
71 
72  Utilities.checkReturnCode(rc, this.environment,
73  "StatusCondition.withEnabledStatuses() failed.");
74  }
75 
76  @Override
77  public void setEnabledStatuses(Class<? extends Status>... statuses) {
78  this.setEnabledStatuses(Arrays.asList(statuses));
79 
80  }
81 
82  @Override
83  public DDS.StatusCondition getOldCondition() {
84  return this.old;
85  }
86 
87  @Override
88  public String toString(){
89  return "StatusCondition (" + Integer.toHexString(this.hashCode()) + ")";
90  }
91 }
Set< Class<? extends Status > > getEnabledStatuses()
This operation retrieves the list of communication statuses that are taken into account to determine ...
A StatusCondition object is an immutable object that specifies Condition that is associated with each...
void setEnabledStatuses(Collection< Class<? extends Status >> statuses)
This operation accepts a collection of statuses that are encapsulated in a new StatusCondition object...
void setEnabledStatuses(Class<? extends Status >... statuses)
This operation accepts a variable number of statuses that are encapsulated in a new StatusCondition o...
static Set< Class<? extends Status > > convertMask(OsplServiceEnvironment environment, int state)
A Condition is a root interface for all the conditions that may be attached to a org.omg.dds.core.WaitSet.
Definition: Condition.java:31
static void checkReturnCode(int retCode, OsplServiceEnvironment environment, String message)
Definition: Utilities.java:33
This class is the abstract base class for all the DCPS objects that support QoS policies, a listener and a status condition.
Definition: Entity.java:36
DDS implementations are rooted in this class, a concrete subclass of which can be instantiated based ...
StatusConditionImpl(OsplServiceEnvironment environment, DDS.StatusCondition oldCondition, T parent)
Status is the abstract root class for all communication status objects.
Definition: Status.java:41