Get rid of all the using namespace and using boost:: declarations in Thrift header files
Summary: To remove upstream dependencies. Still keeping some specific using directives around.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665047 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/PosixThreadFactory.h b/lib/cpp/src/concurrency/PosixThreadFactory.h
index 4e50dff..ede7d79 100644
--- a/lib/cpp/src/concurrency/PosixThreadFactory.h
+++ b/lib/cpp/src/concurrency/PosixThreadFactory.h
@@ -13,8 +13,6 @@
namespace facebook { namespace thrift { namespace concurrency {
-using namespace boost;
-
/**
* A thread factory to create posix threads
*
@@ -57,7 +55,7 @@
PosixThreadFactory(POLICY policy=ROUND_ROBIN, PRIORITY priority=NORMAL, int stackSize=1, bool detached=false);
// From ThreadFactory;
- shared_ptr<Thread> newThread(shared_ptr<Runnable> runnable) const;
+ boost::shared_ptr<Thread> newThread(boost::shared_ptr<Runnable> runnable) const;
/**
* Sets stack size for created threads
@@ -85,7 +83,7 @@
private:
class Impl;
- shared_ptr<Impl> impl_;
+ boost::shared_ptr<Impl> impl_;
};
}}} // facebook::thrift::concurrency
diff --git a/lib/cpp/src/concurrency/Thread.h b/lib/cpp/src/concurrency/Thread.h
index 1b07fd5..96ca668 100644
--- a/lib/cpp/src/concurrency/Thread.h
+++ b/lib/cpp/src/concurrency/Thread.h
@@ -12,8 +12,6 @@
namespace facebook { namespace thrift { namespace concurrency {
-using namespace boost;
-
class Thread;
/**
@@ -30,18 +28,18 @@
/**
* Gets the thread object that is hosting this runnable object - can return
- * an empty shared pointer if no references remain on thet thread object
+ * an empty boost::shared pointer if no references remain on thet thread object
*/
- virtual shared_ptr<Thread> thread() { return thread_.lock(); }
+ virtual boost::shared_ptr<Thread> thread() { return thread_.lock(); }
/**
* Sets the thread that is executing this object. This is only meant for
* use by concrete implementations of Thread.
*/
- virtual void thread(shared_ptr<Thread> value) { thread_ = value; }
+ virtual void thread(boost::shared_ptr<Thread> value) { thread_ = value; }
private:
- weak_ptr<Thread> thread_;
+ boost::weak_ptr<Thread> thread_;
};
/**
@@ -74,13 +72,13 @@
/**
* Gets the runnable object this thread is hosting
*/
- virtual shared_ptr<Runnable> runnable() const { return _runnable; }
+ virtual boost::shared_ptr<Runnable> runnable() const { return _runnable; }
protected:
- virtual void runnable(shared_ptr<Runnable> value) { _runnable = value; }
+ virtual void runnable(boost::shared_ptr<Runnable> value) { _runnable = value; }
private:
- shared_ptr<Runnable> _runnable;
+ boost::shared_ptr<Runnable> _runnable;
};
/**
@@ -91,7 +89,7 @@
public:
virtual ~ThreadFactory() {}
- virtual shared_ptr<Thread> newThread(shared_ptr<Runnable> runnable) const = 0;
+ virtual boost::shared_ptr<Thread> newThread(boost::shared_ptr<Runnable> runnable) const = 0;
};
}}} // facebook::thrift::concurrency
diff --git a/lib/cpp/src/concurrency/ThreadManager.h b/lib/cpp/src/concurrency/ThreadManager.h
index cc13665..f0c745f 100644
--- a/lib/cpp/src/concurrency/ThreadManager.h
+++ b/lib/cpp/src/concurrency/ThreadManager.h
@@ -13,8 +13,6 @@
namespace facebook { namespace thrift { namespace concurrency {
-using namespace boost;
-
/**
* Thread Pool Manager and related classes
*
@@ -81,9 +79,9 @@
virtual const STATE state() const = 0;
- virtual shared_ptr<ThreadFactory> threadFactory() const = 0;
+ virtual boost::shared_ptr<ThreadFactory> threadFactory() const = 0;
- virtual void threadFactory(shared_ptr<ThreadFactory> value) = 0;
+ virtual void threadFactory(boost::shared_ptr<ThreadFactory> value) = 0;
virtual void addWorker(size_t value=1) = 0;
@@ -114,19 +112,19 @@
*
* @param value The task to run
*/
- virtual void add(shared_ptr<Runnable>value) = 0;
+ virtual void add(boost::shared_ptr<Runnable>value) = 0;
/**
* Removes a pending task
*/
- virtual void remove(shared_ptr<Runnable> task) = 0;
+ virtual void remove(boost::shared_ptr<Runnable> task) = 0;
- static shared_ptr<ThreadManager> newThreadManager();
+ static boost::shared_ptr<ThreadManager> newThreadManager();
/**
* Creates a simple thread manager the uses count number of worker threads
*/
- static shared_ptr<ThreadManager> newSimpleThreadManager(size_t count=4);
+ static boost::shared_ptr<ThreadManager> newSimpleThreadManager(size_t count=4);
class Task;
diff --git a/lib/cpp/src/concurrency/TimerManager.cpp b/lib/cpp/src/concurrency/TimerManager.cpp
index 09f7a9c..050885d 100644
--- a/lib/cpp/src/concurrency/TimerManager.cpp
+++ b/lib/cpp/src/concurrency/TimerManager.cpp
@@ -14,6 +14,8 @@
namespace facebook { namespace thrift { namespace concurrency {
+using boost::shared_ptr;
+
typedef std::multimap<long long, shared_ptr<TimerManager::Task> >::iterator task_iterator;
typedef std::pair<task_iterator, task_iterator> task_range;
diff --git a/lib/cpp/src/concurrency/TimerManager.h b/lib/cpp/src/concurrency/TimerManager.h
index 4e83c9e..a150e8a 100644
--- a/lib/cpp/src/concurrency/TimerManager.h
+++ b/lib/cpp/src/concurrency/TimerManager.h
@@ -17,8 +17,6 @@
namespace facebook { namespace thrift { namespace concurrency {
-using namespace boost;
-
/**
* Timer Manager
*
@@ -35,9 +33,9 @@
virtual ~TimerManager();
- virtual shared_ptr<const ThreadFactory> threadFactory() const;
+ virtual boost::shared_ptr<const ThreadFactory> threadFactory() const;
- virtual void threadFactory(shared_ptr<const ThreadFactory> value);
+ virtual void threadFactory(boost::shared_ptr<const ThreadFactory> value);
/**
* Starts the timer manager service
@@ -59,7 +57,7 @@
* @param task The task to execute
* @param timeout Time in milliseconds to delay before executing task
*/
- virtual void add(shared_ptr<Runnable> task, long long timeout);
+ virtual void add(boost::shared_ptr<Runnable> task, long long timeout);
/**
* Adds a task to be executed at some time in the future by a worker thread.
@@ -67,7 +65,7 @@
* @param task The task to execute
* @param timeout Absolute time in the future to execute task.
*/
- virtual void add(shared_ptr<Runnable> task, const struct timespec& timeout);
+ virtual void add(boost::shared_ptr<Runnable> task, const struct timespec& timeout);
/**
* Removes a pending task
@@ -79,7 +77,7 @@
* @throws UncancellableTaskException Specified task is already being
* executed or has completed execution.
*/
- virtual void remove(shared_ptr<Runnable> task);
+ virtual void remove(boost::shared_ptr<Runnable> task);
enum STATE {
UNINITIALIZED,
@@ -92,17 +90,17 @@
virtual const STATE state() const;
private:
- shared_ptr<const ThreadFactory> threadFactory_;
+ boost::shared_ptr<const ThreadFactory> threadFactory_;
class Task;
friend class Task;
- std::multimap<long long, shared_ptr<Task> > taskMap_;
+ std::multimap<long long, boost::shared_ptr<Task> > taskMap_;
size_t taskCount_;
Monitor monitor_;
STATE state_;
class Dispatcher;
friend class Dispatcher;
- shared_ptr<Dispatcher> dispatcher_;
- shared_ptr<Thread> dispatcherThread_;
+ boost::shared_ptr<Dispatcher> dispatcher_;
+ boost::shared_ptr<Thread> dispatcherThread_;
};
}}} // facebook::thrift::concurrency
diff --git a/lib/cpp/src/concurrency/test/ThreadFactoryTests.h b/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
index 3f58859..90d0e4f 100644
--- a/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
+++ b/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
@@ -15,6 +15,7 @@
namespace facebook { namespace thrift { namespace concurrency { namespace test {
+using boost::shared_ptr;
using namespace facebook::thrift::concurrency;
/**