Skip to content

Commit 320539c

Browse files
author
Sam Raeburn
committed
CORE-13335: Fix linting errors
1 parent b89cfb8 commit 320539c

File tree

4 files changed

+38
-27
lines changed

4 files changed

+38
-27
lines changed

examples/connext_dds/keyed_data/c++11/keys_subscriber.cxx

+12-9
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,26 @@ int process_data(dds::sub::DataReader<keys> reader)
3434
std::cout << "Instance " << sample.data().code()
3535
<< ", x: " << sample.data().x()
3636
<< ", y: " << sample.data().y() << std::endl;
37-
} else {
37+
} else {
3838
// A sample without valid data can be in any instance state, but the
3939
// key value is only available if it is ALIVE or NOT_ALIVE_DISPOSED
4040
const dds::sub::status::InstanceState &state =
4141
info.state().instance_state();
42-
if (state == dds::sub::status::InstanceState::not_alive_no_writers()) {
43-
std::cout << "Instance is in NOT_ALIVE_NO_WRITERS instance state"
44-
<< std::endl;
42+
if (state
43+
== dds::sub::status::InstanceState::not_alive_no_writers()) {
44+
std::cout
45+
<< "Instance is in NOT_ALIVE_NO_WRITERS instance state"
46+
<< std::endl;
4547
} else {
4648
// Since there is not valid data, it may include metadata.
4749
keys sample;
4850
reader.key_value(sample, info.instance_handle());
49-
std::cout << "Instance " << sample.code() << " is " <<
50-
((state == dds::sub::status::InstanceState::not_alive_disposed())
51-
? "disposed "
52-
: "alive ")
53-
<< std::endl;
51+
std::cout << "Instance " << sample.code() << " is "
52+
<< ((state
53+
== dds::sub::status::InstanceState::alive())
54+
? "alive"
55+
: "disposed")
56+
<< std::endl;
5457
}
5558
}
5659

examples/connext_dds/keyed_data/c++98/keys_subscriber.cxx

+6-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ unsigned int process_data(keysDataReader *typed_reader)
5959
* An invalid sample can be in any instance state. The key value is
6060
* only available if it is ALIVE or NOT_ALIVE_DISPOSED.
6161
*/
62-
if (info_seq[i].instance_state == DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE) {
62+
if (info_seq[i].instance_state
63+
== DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE) {
6364
std::cout << "Instance has no writers" << std::endl;
6465
} else {
6566
keys dummy;
@@ -71,9 +72,10 @@ unsigned int process_data(keysDataReader *typed_reader)
7172
continue;
7273
}
7374
std::cout << "Instance " << dummy.code << " is "
74-
<< ((info_seq[i].instance_state == DDS_ALIVE_INSTANCE_STATE)
75-
? "alive"
76-
: "disposed")
75+
<< ((info_seq[i].instance_state
76+
== DDS_ALIVE_INSTANCE_STATE)
77+
? "alive"
78+
: "disposed")
7779
<< std::endl;
7880
}
7981
}

examples/connext_dds/keyed_data/c/keys_subscriber.c

+8-6
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,13 @@ void keysListener_on_data_available(void *listener_data, DDS_DataReader *reader)
149149

150150
} else {
151151
printf("No valid data for sample\n");
152-
/*
152+
/*
153153
* An invalid data sample can be in any instance state. The key
154154
* value may be available if the instance is either ALIVE or
155155
* NOT_ALIVE_DISPOSED.
156156
*/
157-
if (info->instance_state == DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE) {
157+
if (info->instance_state
158+
== DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE) {
158159
printf("Instance is in NOT_ALIVE_NO_WRITERS instance state\n");
159160
} else {
160161
keys key_value;
@@ -166,11 +167,12 @@ void keysListener_on_data_available(void *listener_data, DDS_DataReader *reader)
166167
printf("get_key_value error %d\n", retcode);
167168
continue;
168169
}
169-
printf("Instance %d is in %s instance state\n",
170+
printf(
171+
"Instance %d is in %s instance state\n",
170172
key_value.code,
171-
info->instance_state == DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE
172-
? "NOT_ALIVE_DISPOSED"
173-
: "ALIVE");
173+
((info->instance_state == DDS_ALIVE_INSTANCE_STATE)
174+
? "ALIVE"
175+
: "NOT_ALIVE_DISPOSED"));
174176
}
175177
}
176178
/* End changes for Keyed_Data */

examples/connext_dds/keyed_data/java/keysSubscriber.java

+12-8
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,22 @@ private int processData()
6767
"Instance " + sample.code + ": x: " + sample.x
6868
+ ", y: " + sample.y + "\n");
6969
} else {
70-
if (info.instance_state ==
71-
InstanceStateKind.NOT_ALIVE_NO_WRITERS_INSTANCE_STATE) {
70+
if (info.instance_state
71+
== InstanceStateKind
72+
.NOT_ALIVE_NO_WRITERS_INSTANCE_STATE) {
7273
System.out.print("Instance has no writers\n");
7374
} else {
7475
keys dummy = new keys();
7576
reader.get_key_value(dummy, info.instance_handle);
76-
if (info.instance_state ==
77-
InstanceStateKind.ALIVE_INSTANCE_STATE) {
78-
System.out.print("Instance " + dummy.code + " is ALIVE\n");
79-
} else if (info.instance_state ==
80-
InstanceStateKind.NOT_ALIVE_DISPOSED_INSTANCE_STATE) {
81-
System.out.print("Instance " + dummy.code + " is disposed\n");
77+
if (info.instance_state
78+
== InstanceStateKind.ALIVE_INSTANCE_STATE) {
79+
System.out.print(
80+
"Instance " + dummy.code + " is ALIVE\n");
81+
} else if (info.instance_state
82+
== InstanceStateKind.NOT_ALIVE_DISPOSED_INSTANCE_STATE) {
83+
System.out.print(
84+
"Instance " + dummy.code
85+
+ " is disposed\n");
8286
}
8387
}
8488
}

0 commit comments

Comments
 (0)