Switch from default argument to two constructors

This commit is contained in:
Josh Faust 2009-11-10 19:49:28 +00:00
parent 8c049083ce
commit 6d1a9f6615
2 changed files with 16 additions and 3 deletions

View File

@ -34,7 +34,7 @@
namespace ros namespace ros
{ {
class NodeHandle;
class CallbackQueue; class CallbackQueue;
class Spinner class Spinner
@ -80,11 +80,19 @@ class AsyncSpinner
{ {
public: public:
/** /**
* \brief Constructor * \brief Simple constructor. Uses the global callback queue
* \param thread_count The number of threads to use. A value of 0 means to use the number of processor cores
*/
AsyncSpinner(uint32_t thread_count);
/**
* \brief Constructor with custom callback queue
* \param thread_count The number of threads to use. A value of 0 means to use the number of processor cores * \param thread_count The number of threads to use. A value of 0 means to use the number of processor cores
* \param queue The callback queue to operate on. A null value means to use the global queue * \param queue The callback queue to operate on. A null value means to use the global queue
*/ */
AsyncSpinner(uint32_t thread_count, CallbackQueue* queue = 0); AsyncSpinner(uint32_t thread_count, CallbackQueue* queue);
/** /**
* \brief Start this spinner spinning asynchronously * \brief Start this spinner spinning asynchronously

View File

@ -186,6 +186,11 @@ void AsyncSpinnerImpl::threadFunc()
} }
} }
AsyncSpinner::AsyncSpinner(uint32_t thread_count)
: impl_(new AsyncSpinnerImpl(thread_count, 0))
{
}
AsyncSpinner::AsyncSpinner(uint32_t thread_count, CallbackQueue* queue) AsyncSpinner::AsyncSpinner(uint32_t thread_count, CallbackQueue* queue)
: impl_(new AsyncSpinnerImpl(thread_count, queue)) : impl_(new AsyncSpinnerImpl(thread_count, queue))
{ {