add EPICS_NOT_COPYABLE()
More localize (my preference), and avoids warning spam with windows builds.
This commit is contained in:
+2
-1
@@ -33,7 +33,8 @@ typedef epicsMutex Mutex;
|
||||
* This is based on item 14 of
|
||||
* * Effective C++, Third Edition, Scott Meyers
|
||||
*/
|
||||
class Lock : private NoDefaultMethods {
|
||||
class Lock {
|
||||
EPICS_NOT_COPYABLE(Lock)
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@@ -11,15 +11,41 @@
|
||||
|
||||
#include <shareLib.h>
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
/* This is based on Item 6 of
|
||||
* Effective C++, Third Edition, Scott Meyers
|
||||
/** @macro EPICS_NOT_COPYABLE(CLASS)
|
||||
* @brief Disable implicit copyable
|
||||
*
|
||||
* Prevent the default copy constructor and assignment
|
||||
* operator from being usable.
|
||||
*
|
||||
* For >= C++11 explicitly disable. Attempts to copy/assign will
|
||||
* fail to compile.
|
||||
*
|
||||
* For C++98 make these private, and don't implement them.
|
||||
* User code will fail to compile, implementation code will fail to link.
|
||||
@code
|
||||
struct MyClass {
|
||||
EPICS_NOT_COPYABLE(MyClass)
|
||||
public:
|
||||
...
|
||||
};
|
||||
@code
|
||||
*
|
||||
* @note This macro contains 'private:'.
|
||||
*/
|
||||
#if __cplusplus>=201103L
|
||||
# define EPICS_NOT_COPYABLE(CLASS) private: CLASS(const CLASS&) = delete; CLASS& operator=(const CLASS&) = delete;
|
||||
#else
|
||||
# define EPICS_NOT_COPYABLE(CLASS) private: CLASS(const CLASS&); CLASS& operator=(const CLASS&);
|
||||
#endif
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
/**
|
||||
* @brief Base class for not allowing default methods.
|
||||
*
|
||||
* Note that copy constructor a copy methods are declared private.
|
||||
*
|
||||
* @deprecated Deprecated in favor of EPICS_NOT_COPYABLE() pvDataCPP 7.0.0
|
||||
*/
|
||||
class NoDefaultMethods {
|
||||
public:
|
||||
|
||||
@@ -26,7 +26,8 @@ namespace epics {
|
||||
* @brief Serialization helper.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass SerializeHelper : public NoDefaultMethods {
|
||||
class epicsShareClass SerializeHelper {
|
||||
EPICS_NOT_COPYABLE(SerializeHelper)
|
||||
public:
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,8 +43,9 @@ typedef epicsThreadRunable Runnable;
|
||||
|
||||
//! Helper for those cases where a class should have more than one runnable
|
||||
template<typename C>
|
||||
class RunnableMethod : public Runnable, private NoDefaultMethods
|
||||
class RunnableMethod : public Runnable
|
||||
{
|
||||
EPICS_NOT_COPYABLE(RunnableMethod)
|
||||
typedef void (C::*meth_t)();
|
||||
C *inst;
|
||||
meth_t meth;
|
||||
@@ -104,7 +105,8 @@ struct BindRunner : public epicsThreadRunable
|
||||
* @brief C++ wrapper for epicsThread from EPICS base.
|
||||
*
|
||||
*/
|
||||
class Thread : public epicsThread, private NoDefaultMethods {
|
||||
class Thread : public epicsThread {
|
||||
EPICS_NOT_COPYABLE(Thread)
|
||||
public:
|
||||
/** @brief Holds all the configuration necessary to launch a @class Thread
|
||||
*
|
||||
|
||||
@@ -35,7 +35,8 @@ typedef std::tr1::shared_ptr<StandardPVField> StandardPVFieldPtr;
|
||||
StandardPVField *standardPVField = getStandardPVField();
|
||||
* }
|
||||
*/
|
||||
class epicsShareClass StandardPVField : private NoDefaultMethods {
|
||||
class epicsShareClass StandardPVField {
|
||||
EPICS_NOT_COPYABLE(StandardPVField)
|
||||
public:
|
||||
/**
|
||||
* getStandardPVField returns the singleton.
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#ifndef BITSETUTIL_H
|
||||
#define BITSETUTIL_H
|
||||
|
||||
#include <pv/noDefaultMethods.h>
|
||||
#include <pv/pvData.h>
|
||||
#include <pv/bitSet.h>
|
||||
|
||||
@@ -21,7 +20,7 @@ namespace epics { namespace pvData {
|
||||
* @brief Compress a bitSet.
|
||||
*
|
||||
*/
|
||||
class epicsShareClass BitSetUtil : private NoDefaultMethods {
|
||||
class epicsShareClass BitSetUtil {
|
||||
public:
|
||||
/**
|
||||
* compress the bitSet for a pvStructure.
|
||||
|
||||
@@ -60,8 +60,8 @@ static DeserializableControl* control;
|
||||
static ByteBuffer* buffer;
|
||||
|
||||
|
||||
class SerializableControlImpl : public SerializableControl,
|
||||
public NoDefaultMethods {
|
||||
class SerializableControlImpl : public SerializableControl {
|
||||
EPICS_NOT_COPYABLE(SerializableControlImpl)
|
||||
public:
|
||||
virtual void flushSerializeBuffer() {
|
||||
}
|
||||
@@ -91,8 +91,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class DeserializableControlImpl : public DeserializableControl,
|
||||
public NoDefaultMethods {
|
||||
class DeserializableControlImpl : public DeserializableControl {
|
||||
EPICS_NOT_COPYABLE(DeserializableControlImpl)
|
||||
public:
|
||||
virtual void ensureData(size_t /*size*/) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user