summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/cpp/Makefile.am3
-rw-r--r--lib/cpp/src/thrift/TNonCopyable.h42
-rw-r--r--lib/cpp/src/thrift/concurrency/Monitor.h3
-rw-r--r--lib/cpp/src/thrift/concurrency/Mutex.h4
-rw-r--r--lib/cpp/src/thrift/transport/TPipe.cpp10
-rw-r--r--lib/cpp/src/thrift/transport/TPipe.h2
-rw-r--r--lib/cpp/src/thrift/transport/TPipeServer.cpp4
-rw-r--r--lib/cpp/src/thrift/windows/OverlappedSubmissionThread.cpp2
-rw-r--r--lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h6
-rw-r--r--lib/cpp/src/thrift/windows/Sync.h13
-rw-r--r--lib/cpp/src/thrift/windows/TWinsockSingleton.h4
11 files changed, 69 insertions, 24 deletions
diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am
index eab2e217e..c015b0db6 100755
--- a/lib/cpp/Makefile.am
+++ b/lib/cpp/Makefile.am
@@ -143,7 +143,8 @@ include_thrift_HEADERS = \
src/thrift/TLogging.h \
src/thrift/TToString.h \
src/thrift/TBase.h \
- src/thrift/TConfiguration.h
+ src/thrift/TConfiguration.h \
+ src/thrift/TNonCopyable.h
include_concurrencydir = $(include_thriftdir)/concurrency
include_concurrency_HEADERS = \
diff --git a/lib/cpp/src/thrift/TNonCopyable.h b/lib/cpp/src/thrift/TNonCopyable.h
new file mode 100644
index 000000000..a60f1f0fb
--- /dev/null
+++ b/lib/cpp/src/thrift/TNonCopyable.h
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef TNONCOPYABLE_H
+#define TNONCOPYABLE_H
+
+/**
+ * @brief A simple non-copyable base class pattern. Derive from TNonCopyable to
+ * make a class non-copyable and prohibit assignment and copy-construction.
+ */
+namespace apache {
+namespace thrift {
+
+class TNonCopyable {
+protected:
+ TNonCopyable() = default;
+ ~TNonCopyable() = default;
+
+ TNonCopyable(const TNonCopyable&) = delete;
+ TNonCopyable& operator=(const TNonCopyable&) = delete;
+};
+
+}
+}
+
+#endif
diff --git a/lib/cpp/src/thrift/concurrency/Monitor.h b/lib/cpp/src/thrift/concurrency/Monitor.h
index b3939cb01..ada237a18 100644
--- a/lib/cpp/src/thrift/concurrency/Monitor.h
+++ b/lib/cpp/src/thrift/concurrency/Monitor.h
@@ -23,6 +23,7 @@
#include <chrono>
#include <thrift/concurrency/Exception.h>
#include <thrift/concurrency/Mutex.h>
+#include <thrift/TNonCopyable.h>
namespace apache {
namespace thrift {
@@ -46,7 +47,7 @@ namespace concurrency {
*
* @version $Id:$
*/
-class Monitor : boost::noncopyable {
+class Monitor : apache::thrift::TNonCopyable {
public:
/** Creates a new mutex, and takes ownership of it. */
Monitor();
diff --git a/lib/cpp/src/thrift/concurrency/Mutex.h b/lib/cpp/src/thrift/concurrency/Mutex.h
index 27e386ed4..1e5c3fba3 100644
--- a/lib/cpp/src/thrift/concurrency/Mutex.h
+++ b/lib/cpp/src/thrift/concurrency/Mutex.h
@@ -21,7 +21,7 @@
#define _THRIFT_CONCURRENCY_MUTEX_H_ 1
#include <memory>
-#include <boost/noncopyable.hpp>
+#include <thrift/TNonCopyable.h>
namespace apache {
namespace thrift {
@@ -55,7 +55,7 @@ private:
};
-class Guard : boost::noncopyable {
+class Guard : apache::thrift::TNonCopyable {
public:
Guard(const Mutex& value, int64_t timeout = 0) : mutex_(&value) {
if (timeout == 0) {
diff --git a/lib/cpp/src/thrift/transport/TPipe.cpp b/lib/cpp/src/thrift/transport/TPipe.cpp
index 953cec167..a18c4f7ee 100644
--- a/lib/cpp/src/thrift/transport/TPipe.cpp
+++ b/lib/cpp/src/thrift/transport/TPipe.cpp
@@ -40,7 +40,7 @@ void pipe_write(HANDLE pipe, const uint8_t* buf, uint32_t len);
uint32_t pseudo_sync_read(HANDLE pipe, HANDLE event, uint8_t* buf, uint32_t len);
void pseudo_sync_write(HANDLE pipe, HANDLE event, const uint8_t* buf, uint32_t len);
-class TPipeImpl : boost::noncopyable {
+class TPipeImpl : apache::thrift::TNonCopyable {
public:
TPipeImpl() {}
virtual ~TPipeImpl() {}
@@ -223,7 +223,7 @@ uint32_t pseudo_sync_read(HANDLE pipe, HANDLE event, uint8_t* buf, uint32_t len)
//---- Constructors ----
TPipe::TPipe(TAutoHandle &Pipe, std::shared_ptr<TConfiguration> config)
- : impl_(new TWaitableNamedPipeImpl(Pipe)), TimeoutSeconds_(3),
+ : impl_(new TWaitableNamedPipeImpl(Pipe)), TimeoutSeconds_(3),
isAnonymous_(false), TVirtualTransport(config) {
}
@@ -234,12 +234,12 @@ TPipe::TPipe(HANDLE Pipe, std::shared_ptr<TConfiguration> config)
impl_.reset(new TWaitableNamedPipeImpl(pipeHandle));
}
-TPipe::TPipe(const char* pipename, std::shared_ptr<TConfiguration> config) : TimeoutSeconds_(3),
+TPipe::TPipe(const char* pipename, std::shared_ptr<TConfiguration> config) : TimeoutSeconds_(3),
isAnonymous_(false), TVirtualTransport(config) {
setPipename(pipename);
}
-TPipe::TPipe(const std::string& pipename, std::shared_ptr<TConfiguration> config) : TimeoutSeconds_(3),
+TPipe::TPipe(const std::string& pipename, std::shared_ptr<TConfiguration> config) : TimeoutSeconds_(3),
isAnonymous_(false), TVirtualTransport(config) {
setPipename(pipename);
}
@@ -249,7 +249,7 @@ TPipe::TPipe(HANDLE PipeRd, HANDLE PipeWrt, std::shared_ptr<TConfiguration> conf
TVirtualTransport(config) {
}
-TPipe::TPipe(std::shared_ptr<TConfiguration> config) : TimeoutSeconds_(3), isAnonymous_(false),
+TPipe::TPipe(std::shared_ptr<TConfiguration> config) : TimeoutSeconds_(3), isAnonymous_(false),
TVirtualTransport(config) {
}
diff --git a/lib/cpp/src/thrift/transport/TPipe.h b/lib/cpp/src/thrift/transport/TPipe.h
index 7795151a6..ec0c44282 100644
--- a/lib/cpp/src/thrift/transport/TPipe.h
+++ b/lib/cpp/src/thrift/transport/TPipe.h
@@ -28,7 +28,7 @@
#ifdef _WIN32
#include <thrift/windows/Sync.h>
#endif
-#include <boost/noncopyable.hpp>
+#include <thrift/TNonCopyable.h>
#ifdef _WIN32
#include <thrift/windows/Sync.h>
#endif
diff --git a/lib/cpp/src/thrift/transport/TPipeServer.cpp b/lib/cpp/src/thrift/transport/TPipeServer.cpp
index 27635513c..1d7577fbe 100644
--- a/lib/cpp/src/thrift/transport/TPipeServer.cpp
+++ b/lib/cpp/src/thrift/transport/TPipeServer.cpp
@@ -22,7 +22,7 @@
#include <thrift/transport/TPipe.h>
#include <thrift/transport/TPipeServer.h>
-#include <boost/noncopyable.hpp>
+#include <thrift/TNonCopyable.h>
#ifdef _WIN32
#include <thrift/windows/OverlappedSubmissionThread.h>
@@ -39,7 +39,7 @@ namespace transport {
using std::shared_ptr;
-class TPipeServerImpl : boost::noncopyable {
+class TPipeServerImpl : apache::thrift::TNonCopyable {
public:
TPipeServerImpl() {}
virtual ~TPipeServerImpl() {}
diff --git a/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.cpp b/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.cpp
index 5ac6fe00b..02beec7ee 100644
--- a/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.cpp
+++ b/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.cpp
@@ -19,7 +19,7 @@
#include <thrift/windows/OverlappedSubmissionThread.h>
#include <thrift/transport/TTransportException.h>
-#include <boost/noncopyable.hpp>
+#include <thrift/TNonCopyable.h>
#include <boost/scope_exit.hpp>
#include <process.h>
diff --git a/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h b/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h
index dd0c5c957..6cecfc357 100644
--- a/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h
+++ b/lib/cpp/src/thrift/windows/OverlappedSubmissionThread.h
@@ -25,7 +25,7 @@
#endif
#include <thrift/windows/Sync.h>
-#include <boost/noncopyable.hpp>
+#include <thrift/TNonCopyable.h>
#include <Windows.h>
/*
@@ -89,7 +89,7 @@ struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) TOverlappedWorkItem : public
bool process();
};
-class TOverlappedSubmissionThread : boost::noncopyable {
+class TOverlappedSubmissionThread : apache::thrift::TNonCopyable {
public:
void addWorkItem(TOverlappedWorkItem* item);
@@ -117,7 +117,7 @@ private:
HANDLE thread_;
};
-class TAutoOverlapThread : boost::noncopyable {
+class TAutoOverlapThread : apache::thrift::TNonCopyable {
private:
TOverlappedSubmissionThread* p;
diff --git a/lib/cpp/src/thrift/windows/Sync.h b/lib/cpp/src/thrift/windows/Sync.h
index a296d7ec4..b1c83ee45 100644
--- a/lib/cpp/src/thrift/windows/Sync.h
+++ b/lib/cpp/src/thrift/windows/Sync.h
@@ -25,7 +25,8 @@
#endif
#include <thrift/concurrency/Exception.h>
-#include <boost/noncopyable.hpp>
+#include <thrift/TNonCopyable.h>
+
#include <Windows.h>
/*
@@ -36,13 +37,13 @@
namespace apache {
namespace thrift {
-struct TCriticalSection : boost::noncopyable {
+struct TCriticalSection : apache::thrift::TNonCopyable {
CRITICAL_SECTION cs;
TCriticalSection() { InitializeCriticalSection(&cs); }
~TCriticalSection() { DeleteCriticalSection(&cs); }
};
-class TAutoCrit : boost::noncopyable {
+class TAutoCrit : apache::thrift::TNonCopyable {
private:
CRITICAL_SECTION* cs_;
@@ -51,7 +52,7 @@ public:
~TAutoCrit() { LeaveCriticalSection(cs_); }
};
-struct TAutoResetEvent : boost::noncopyable {
+struct TAutoResetEvent : apache::thrift::TNonCopyable {
HANDLE h;
TAutoResetEvent() {
@@ -64,7 +65,7 @@ struct TAutoResetEvent : boost::noncopyable {
~TAutoResetEvent() { CloseHandle(h); }
};
-struct TManualResetEvent : boost::noncopyable {
+struct TManualResetEvent : apache::thrift::TNonCopyable {
HANDLE h;
TManualResetEvent() {
@@ -77,7 +78,7 @@ struct TManualResetEvent : boost::noncopyable {
~TManualResetEvent() { CloseHandle(h); }
};
-struct TAutoHandle : boost::noncopyable {
+struct TAutoHandle : apache::thrift::TNonCopyable {
HANDLE h;
explicit TAutoHandle(HANDLE h_ = INVALID_HANDLE_VALUE) : h(h_) {}
~TAutoHandle() {
diff --git a/lib/cpp/src/thrift/windows/TWinsockSingleton.h b/lib/cpp/src/thrift/windows/TWinsockSingleton.h
index a30806b98..a098d2c71 100644
--- a/lib/cpp/src/thrift/windows/TWinsockSingleton.h
+++ b/lib/cpp/src/thrift/windows/TWinsockSingleton.h
@@ -31,7 +31,7 @@
#include <thrift/thrift-config.h>
// boost
-#include <boost/noncopyable.hpp>
+#include <thrift/TNonCopyable.h>
#include <memory>
#include <mutex>
@@ -45,7 +45,7 @@ namespace transport {
* Winsock2 must be intialised once only in order to create sockets. This class
* performs a one time initialisation when create is called.
*/
-class TWinsockSingleton : private boost::noncopyable {
+class TWinsockSingleton : private apache::thrift::TNonCopyable {
public:
typedef std::shared_ptr<TWinsockSingleton> instance_ptr;