diff --git a/uhal/uhal/include/uhal/ClientInterface.hpp b/uhal/uhal/include/uhal/ClientInterface.hpp index 2d5bc33ef..08037f435 100644 --- a/uhal/uhal/include/uhal/ClientInterface.hpp +++ b/uhal/uhal/include/uhal/ClientInterface.hpp @@ -108,24 +108,16 @@ namespace uhal */ ClientInterface ( const std::string& aId, const URI& aUri , const boost::posix_time::time_duration& aTimeoutPeriod ); - private: - //! Default Constructor - ClientInterface (); - - /** - Copy Constructor - @param aClientInterface a ClientInterface to copy - */ - ClientInterface ( const ClientInterface& aClientInterface ); + public: + // Disable default constructor + ClientInterface () = delete; - /** - Assignment operator - @param aClientInterface a ClientInterface to copy - @return reference to this object for chained assignment - */ - virtual ClientInterface& operator= ( const ClientInterface& aClientInterface ); + // Client classes should not be copied or moved + ClientInterface(const ClientInterface&) = delete; + ClientInterface(ClientInterface&&) = delete; + ClientInterface& operator=(const ClientInterface&) = delete; + ClientInterface& operator=(ClientInterface&&) = delete; - public: //! Destructor virtual ~ClientInterface(); diff --git a/uhal/uhal/include/uhal/Node.hpp b/uhal/uhal/include/uhal/Node.hpp index b5fe6e309..65c9f189e 100644 --- a/uhal/uhal/include/uhal/Node.hpp +++ b/uhal/uhal/include/uhal/Node.hpp @@ -89,12 +89,18 @@ namespace uhal friend class DerivedNodeFactory; public: - class const_iterator : public std::iterator< std::forward_iterator_tag , Node , ptrdiff_t, const Node* , const Node& > + class const_iterator { friend class Node; typedef std::deque< std::vector< Node* >::const_iterator > stack; public: + using iterator_category = std::forward_iterator_tag; + using value_type = Node; + using difference_type = ptrdiff_t; + using pointer = const Node*; + using reference = const Node&; + const_iterator(); virtual ~const_iterator(); @@ -130,12 +136,10 @@ namespace uhal */ Node ( const Node& aNode ); - /** - Assignment operator - @param aNode a Node to copy - @return reference to this object for chained assignment - */ - virtual Node& operator= ( const Node& aNode ); + // Node classes should not be assigned or moved (and only copied by derived classes, for their clone methods) + Node(Node&&) = delete; + Node& operator=(const Node&) = delete; + Node& operator=(Node&&) = delete; /** Function to produce a new copy of the current Node diff --git a/uhal/uhal/src/common/ClientInterface.cpp b/uhal/uhal/src/common/ClientInterface.cpp index 003584f68..b9307463a 100644 --- a/uhal/uhal/src/common/ClientInterface.cpp +++ b/uhal/uhal/src/common/ClientInterface.cpp @@ -60,43 +60,6 @@ namespace uhal } - ClientInterface::ClientInterface ( ) : - mBuffers(), -#ifdef NO_PREEMPTIVE_DISPATCH - mNoPreemptiveDispatchBuffers(), -#endif - mId ( ), - mTimeoutPeriod ( boost::posix_time::pos_infin ), - mUri ( ), - mUriString( "" ) - { - } - - - ClientInterface::ClientInterface ( const ClientInterface& aClientInterface ) : - mBuffers(), -#ifdef NO_PREEMPTIVE_DISPATCH - mNoPreemptiveDispatchBuffers(), -#endif - mId ( aClientInterface.mId ), - mTimeoutPeriod ( aClientInterface.mTimeoutPeriod ), - mUri ( aClientInterface.mUri ), - mUriString( aClientInterface.mUriString ) - { - } - - - ClientInterface& ClientInterface::operator= ( const ClientInterface& aClientInterface ) - { - deleteBuffers(); - mId = aClientInterface.mId; - mUri = aClientInterface.mUri; - mUriString = aClientInterface.mUriString; - mTimeoutPeriod = aClientInterface.mTimeoutPeriod; - return *this; - } - - ClientInterface::~ClientInterface() { deleteBuffers(); diff --git a/uhal/uhal/src/common/Node.cpp b/uhal/uhal/src/common/Node.cpp index 1906627de..515c3aa41 100644 --- a/uhal/uhal/src/common/Node.cpp +++ b/uhal/uhal/src/common/Node.cpp @@ -101,48 +101,6 @@ namespace uhal } - Node& Node::operator= ( const Node& aNode ) - { - mHw = aNode.mHw; - mUid = aNode.mUid ; - mPartialAddr = aNode.mPartialAddr; - mAddr = aNode.mAddr; - mMask = aNode.mMask; - mPermission = aNode.mPermission; - mMode = aNode.mMode; - mSize = aNode.mSize; - mTags = aNode.mTags; - mDescription = aNode.mDescription; - mModule = aNode.mModule; - mClassName = aNode.mClassName; - mParameters = aNode.mParameters; - - for (Node* lChild: mChildren) - { - if (lChild) - { - delete lChild; - lChild = NULL; - } - } - - mChildren.clear(); - mChildrenMap.clear(); - - mChildren.reserve(aNode.mChildren.size()); - for (Node* lNode: aNode.mChildren) - mChildren.push_back ( lNode->clone() ); - - for (Node* lNode: mChildren) - { - lNode->mParent = this; - mChildrenMap.insert ( std::make_pair ( lNode->mUid , lNode ) ); - } - - return *this; - } - - Node* Node::clone ( ) const { return new Node ( *this );