Define copy/move ctors and assignment ops

Delete special member functions where they are not used.
(as part of applying suggestions from cppcoreguidelines-special-member-functions)

These classes don't need to be copyable/movable:
  # copy/move not used:
  zmq:: TransportFactory, Socket, Message, UnmanagedRegion, Poller, Context
  shm:: TransportFactory, Socket, Message, UnmanagedRegion, Poller
  ofi:: TransportFactory, Socket, Message, Context
  shm:: ZMsg, Region, Monitor, TerminalConfig, Manager
  plugins:: Config, Control, TerminalConfig
  fairmq::StateQueue, StateMachine, ProgOptions, PluginServices, PluginManager, Plugin, Device, StateSubscription
  TestData, BadDevice, TestDevice (test suite heplers)

  # used via ptr interface:
  fairmq::UnmanagedRegion, TransportFactory, Socket, Poller, Message

These classes need to be movable/copyable:
 MyClass (test suite helper), fairmq::Channel, fairmq::Parts
This commit is contained in:
Alexey Rybalchenko
2021-09-14 11:38:33 +02:00
committed by Dennis Klein
parent 597d88277b
commit ad824b4de1
42 changed files with 174 additions and 47 deletions

View File

@@ -9,7 +9,6 @@
#ifndef FAIR_MQ_CHANNEL_H
#define FAIR_MQ_CHANNEL_H
#include <cstdint> // int64_t
#include <fairmq/Message.h>
#include <fairmq/Parts.h>
#include <fairmq/Properties.h>
@@ -17,8 +16,9 @@
#include <fairmq/TransportFactory.h>
#include <fairmq/Transports.h>
#include <fairmq/UnmanagedRegion.h>
#include <cstdint> // int64_t
#include <memory> // unique_ptr, shared_ptr
#include <mutex>
#include <stdexcept>
#include <string>
#include <utility> // std::move
@@ -73,16 +73,16 @@ class Channel
Channel(const Channel&, std::string name);
/// Move constructor
// Channel(Channel&&) = delete;
Channel(Channel&&) = default;
/// Assignment operator
Channel& operator=(const Channel&);
/// Move assignment operator
// Channel& operator=(Channel&&) = delete;
Channel& operator=(Channel&&) = default;
/// Destructor
virtual ~Channel() = default;
~Channel() = default;
// { LOG(warn) << "Destroying channel '" << fName << "'"; }
struct ChannelConfigurationError : std::runtime_error { using std::runtime_error::runtime_error; };