Skip to content

Commit

Permalink
Disallow copy and move of Network objects
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSchinazi committed Jan 9, 2025
1 parent 8cdafd3 commit dfbee38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/jazzlights/network/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ std::string networkMessageToString(const NetworkMessage& message, Milliseconds c

class Network {
public:
// Disallow copy and move.
Network(const Network&) = delete;
Network(Network&&) = delete;
Network& operator=(const Network&) = delete;
Network& operator=(Network&&) = delete;

virtual ~Network() = default;

// Set message to send during next send opportunity.
Expand Down Expand Up @@ -186,10 +192,6 @@ class Network {

class UdpNetwork : public Network {
public:
UdpNetwork() = default;
~UdpNetwork() = default;
UdpNetwork(const UdpNetwork&) = default;

void setMessageToSend(const NetworkMessage& messageToSend, Milliseconds currentTime) override;
void disableSending(Milliseconds currentTime) override;
void triggerSendAsap(Milliseconds currentTime) override;
Expand Down
1 change: 0 additions & 1 deletion src/jazzlights/network/unix_udp.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace jazzlights {
class UnixUdpNetwork : public UdpNetwork {
public:
UnixUdpNetwork(uint16_t port = DefaultUdpPort(), const char* addr = DefaultMulticastAddress());
UnixUdpNetwork(const UnixUdpNetwork&) = default;

NetworkStatus update(NetworkStatus status, Milliseconds currentTime) override;
NetworkDeviceId getLocalDeviceId() override { return localDeviceId_; }
Expand Down

0 comments on commit dfbee38

Please sign in to comment.