Skip to content

Commit 6f49a74

Browse files
committed
Deprecate generic compiler definitions
Replaced with definitions prefixed with the package name. The old definitions are still present to avoid breaking any user code that checks them.
1 parent c8d3f2b commit 6f49a74

10 files changed

+27
-20
lines changed

simple_message/cmake/platform_build_flags.cmake

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@
33
# cmake's `remove_definitions` command to change these defaults if desired.
44

55
#Include code that interfaces with ROS
6-
add_definitions(-DROS)
6+
add_definitions(-DSIMPLE_MESSAGE_USE_ROS)
77

88
#Control which platform's underlying networking library is used by this package.
99
#The package will not build unless one (and only one) of these definitions is set.
10+
add_definitions(-DSIMPLE_MESSAGE_LINUX)
11+
#add_definitions(-DSIMPLE_MESSAGE_MOTOPLUS)
12+
13+
#--------------------------------------------------------------------------
14+
#Old definitions (deprecated in kinetic, to be removed in lunar or melodic)
15+
#--------------------------------------------------------------------------
16+
add_definitions(-DROS)
1017
add_definitions(-DLINUXSOCKETS)
1118
#add_definitions(-DMOTOPLUS)

simple_message/include/simple_message/log_wrapper.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
#ifndef LOG_WRAPPER_H_
3333
#define LOG_WRAPPER_H_
3434

35-
#ifdef ROS
35+
#ifdef SIMPLE_MESSAGE_USE_ROS
3636
#include "ros/ros.h"
3737
#endif
3838

39-
#ifdef MOTOPLUS
39+
#ifdef SIMPLE_MESSAGE_MOTOPLUS
4040
#include "motoPlus.h"
4141
#endif
4242

@@ -55,7 +55,7 @@ namespace log_wrapper
5555

5656

5757
// Define ROS if this library will execute under ROS
58-
#ifdef ROS
58+
#ifdef SIMPLE_MESSAGE_USE_ROS
5959

6060
// The LOG_COMM redirects to debug in ROS because ROS has
6161
// debug filtering tools that allow the communications messages

simple_message/include/simple_message/robot_status.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ enum RobotMode
6060
MANUAL = 1, AUTO = 2,
6161
};
6262

63-
#ifdef ROS
63+
#ifdef SIMPLE_MESSAGE_USE_ROS
6464
int toROSMsgEnum(RobotModes::RobotMode mode);
6565
#endif
6666

@@ -85,7 +85,7 @@ enum TriState
8585
TS_FALSE = 0, TS_OFF = 0, TS_DISABLED = 0, TS_LOW = 0
8686
};
8787

88-
#ifdef ROS
88+
#ifdef SIMPLE_MESSAGE_USE_ROS
8989
int toROSMsgEnum(TriStates::TriState state);
9090
#endif
9191

simple_message/include/simple_message/socket/simple_socket.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#include "smpl_msg_connection.h"
4343
#endif
4444

45-
#ifdef LINUXSOCKETS
45+
#ifdef SIMPLE_MESSAGE_LINUX
4646

4747
#include "sys/socket.h"
4848
#include "arpa/inet.h"
@@ -73,7 +73,7 @@
7373

7474
#endif
7575

76-
#ifdef MOTOPLUS
76+
#ifdef SIMPLE_MESSAGE_MOTOPLUS
7777

7878
#include "motoPlus.h"
7979

simple_message/include/simple_message/socket/tcp_socket.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@
4040
#include "shared_types.h"
4141
#endif
4242

43-
#ifdef LINUXSOCKETS
43+
#ifdef SIMPLE_MESSAGE_LINUX
4444
#include "sys/socket.h"
4545
#include "netdb.h"
4646
#include "arpa/inet.h"
4747
#include "string.h"
4848
#include "unistd.h"
4949
#endif
5050

51-
#ifdef MOTOPLUS
51+
#ifdef SIMPLE_MESSAGE_MOTOPLUS
5252
#include "motoPlus.h"
5353
#endif
5454

simple_message/include/simple_message/socket/udp_socket.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@
4242
#include "smpl_msg_connection.h"
4343
#endif
4444

45-
#ifdef LINUXSOCKETS
45+
#ifdef SIMPLE_MESSAGE_LINUX
4646
#include "sys/socket.h"
4747
#include "arpa/inet.h"
4848
#include "string.h"
4949
#include "netdb.h"
5050
#include "unistd.h"
5151
#endif
5252

53-
#ifdef MOTOPLUS
53+
#ifdef SIMPLE_MESSAGE_MOTOPLUS
5454
#include "motoPlus.h"
5555
#endif
5656

simple_message/src/message_manager.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include "simple_message.h"
3939
#endif
4040

41-
#ifdef ROS
41+
#ifdef SIMPLE_MESSAGE_USE_ROS
4242
#include "ros/ros.h"
4343
#else
4444
#include "unistd.h"
@@ -171,7 +171,7 @@ void MessageManager::spinOnce()
171171
int ms_per_clock;
172172
void mySleep(int sec)
173173
{
174-
#ifdef MOTOPLUS
174+
#ifdef SIMPLE_MESSAGE_MOTOPLUS
175175
if (ms_per_clock <= 0)
176176
ms_per_clock = mpGetRtc();
177177

@@ -184,7 +184,7 @@ void mySleep(int sec)
184184
void MessageManager::spin()
185185
{
186186
LOG_INFO("Entering message manager spin loop");
187-
#ifdef ROS
187+
#ifdef SIMPLE_MESSAGE_USE_ROS
188188
while (ros::ok())
189189
#else
190190
while (true)

simple_message/src/robot_status.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include "log_wrapper.h"
3939
#endif
4040

41-
#ifdef ROS
41+
#ifdef SIMPLE_MESSAGE_USE_ROS
4242
// Files below used to translate between ROS messages enums and
4343
// enums defined in this file
4444
#include "industrial_msgs/RobotMode.h"
@@ -55,7 +55,7 @@ namespace robot_status
5555
namespace RobotModes
5656
{
5757

58-
#ifdef ROS
58+
#ifdef SIMPLE_MESSAGE_USE_ROS
5959

6060
int toROSMsgEnum(RobotModes::RobotMode mode)
6161
{
@@ -83,7 +83,7 @@ int toROSMsgEnum(RobotModes::RobotMode mode)
8383
namespace TriStates
8484
{
8585

86-
#ifdef ROS
86+
#ifdef SIMPLE_MESSAGE_USE_ROS
8787

8888
int toROSMsgEnum(TriStates::TriState state)
8989
{

simple_message/src/simple_message.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "log_wrapper.h"
3838
#endif
3939

40-
#ifdef MOTOPLUS
40+
#ifdef SIMPLE_MESSAGE_MOTOPLUS
4141
#include "motoPlus.h"
4242
#endif
4343

simple_message/src/smpl_msg_connection.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include "byte_array.h"
4040
#endif
4141

42-
#ifdef MOTOPLUS
42+
#ifdef SIMPLE_MESSAGE_MOTOPLUS
4343
#include "motoPlus.h"
4444
#endif
4545

0 commit comments

Comments
 (0)