12 #include <condition_variable> 21 template <
class NodeImpl>
35 Nodewrap(
int argc,
char** argv,
const std::string& nodeName,
int numSpinners = -1,
36 const bool installSignalHandler =
true)
54 nh_ = std::make_shared<ros::NodeHandle>(
"~");
56 if (numSpinners == -1)
58 if (!
nh_->param(
"num_spinners", numSpinners, 2))
61 <<
"' from server. Parameter still contains '" << numSpinners
81 bool init_success =
init();
132 impl_->stopAllWorkers();
153 if (signum == SIGSEGV)
155 signal(signum, SIG_DFL);
156 kill(getpid(), signum);
162 if (std::chrono::steady_clock::period::num != 1 || std::chrono::steady_clock::period::den != 1000000000)
164 ROS_ERROR(
"std::chrono::steady_clock does not have a nanosecond resolution!");
166 if (std::chrono::system_clock::period::num != 1 || std::chrono::system_clock::period::den != 1000000000)
168 ROS_ERROR(
"std::chrono::system_clock does not have a nanosecond resolution!");
178 std::shared_ptr<ros::NodeHandle>
nh_;
std::unique_ptr< NodeImpl > impl_
static void checkSteadyClock()
std::shared_ptr< ros::NodeHandle > nh_
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Nodewrap(int argc, char **argv, const std::string &nodeName, int numSpinners=-1, const bool installSignalHandler=true)
std::condition_variable cvRunning_
ROSCPP_DECL const std::string & getName()
ROSCPP_DECL const std::string & getNamespace()
static void unbindAll(void(T::*fp)(int), T *object)
#define ROS_WARN_STREAM(args)
#define ROS_DEBUG_STREAM(args)
std::atomic< bool > running_
std::unique_ptr< ros::AsyncSpinner > spinner_
static void bindAll(void(T::*fp)(int), T *object)
void signalHandler(const int signum)
INTERNAL FUNCTIONS.
bool signalHandlerInstalled_
virtual ~Nodewrap()=default