Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions uhal/uhal/include/uhal/ClientInterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
18 changes: 11 additions & 7 deletions uhal/uhal/include/uhal/Node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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
Expand Down
37 changes: 0 additions & 37 deletions uhal/uhal/src/common/ClientInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
42 changes: 0 additions & 42 deletions uhal/uhal/src/common/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down