diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-02-04 00:24:55 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-02-04 00:24:55 +0100 |
| commit | 42cdfe79afa72a428b5ee851611079f84d237f63 (patch) | |
| tree | 5924126c4a849574a8be6b423051eda3120491ea /src/lib | |
| parent | 81e16caf6414a011bbbe6e8c788f9dc1e4c0ce52 (diff) | |
Some noncopyable removal.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/encoder.h | 9 | ||||
| -rw-r--r-- | src/lib/player_video.h | 13 | ||||
| -rw-r--r-- | src/lib/server.cc | 14 | ||||
| -rw-r--r-- | src/lib/server.h | 13 | ||||
| -rw-r--r-- | src/lib/signal_manager.cc | 6 | ||||
| -rw-r--r-- | src/lib/signal_manager.h | 13 |
6 files changed, 54 insertions, 14 deletions
diff --git a/src/lib/encoder.h b/src/lib/encoder.h index 78c1f9908..1403e75b2 100644 --- a/src/lib/encoder.h +++ b/src/lib/encoder.h @@ -32,13 +32,18 @@ class Job; class PlayerVideo; class AudioBuffers; -/** @class Encoder */ -class Encoder : public boost::noncopyable +/** @class Encoder + * @brief Parent class for something that can encode a film into some format + */ +class Encoder { public: Encoder (std::shared_ptr<const Film> film, std::weak_ptr<Job> job); virtual ~Encoder () {} + Encoder (Encoder const&) = delete; + Encoder& operator= (Encoder const&) = delete; + virtual void go () = 0; /** @return the current frame rate over the last short while */ diff --git a/src/lib/player_video.h b/src/lib/player_video.h index 569789c8c..df0007ddf 100644 --- a/src/lib/player_video.h +++ b/src/lib/player_video.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2020 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,9 +18,11 @@ */ + #ifndef DCPOMATIC_PLAYER_VIDEO_H #define DCPOMATIC_PLAYER_VIDEO_H + #include "types.h" #include "position.h" #include "dcpomatic_time.h" @@ -30,18 +32,19 @@ extern "C" { #include <libavutil/pixfmt.h> } #include <boost/thread/mutex.hpp> -#include <boost/noncopyable.hpp> + class Image; class ImageProxy; class Film; class Socket; + /** Everything needed to describe a video frame coming out of the player, but with the * bits still their raw form. We may want to combine the bits on a remote machine, * or maybe not even bother to combine them at all. */ -class PlayerVideo : public boost::noncopyable +class PlayerVideo { public: PlayerVideo ( @@ -61,6 +64,9 @@ public: PlayerVideo (std::shared_ptr<cxml::Node>, std::shared_ptr<Socket>); + PlayerVideo (PlayerVideo const&) = delete; + PlayerVideo& operator= (PlayerVideo const&) = delete; + std::shared_ptr<PlayerVideo> shallow_copy () const; void set_text (PositionImage); @@ -143,4 +149,5 @@ private: mutable bool _error; }; + #endif diff --git a/src/lib/server.cc b/src/lib/server.cc index acb8d08d8..c1be5735e 100644 --- a/src/lib/server.cc +++ b/src/lib/server.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,13 +18,18 @@ */ + #include "server.h" #include "dcpomatic_socket.h" + #include "i18n.h" + +using std::make_shared; using std::shared_ptr; + Server::Server (int port, int timeout) : _terminate (false) , _acceptor (_io_service, boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(), port)) @@ -33,6 +38,7 @@ Server::Server (int port, int timeout) } + Server::~Server () { { @@ -44,6 +50,7 @@ Server::~Server () stop (); } + void Server::run () { @@ -51,6 +58,7 @@ Server::run () _io_service.run (); } + void Server::start_accept () { @@ -61,10 +69,11 @@ Server::start_accept () } } - shared_ptr<Socket> socket (new Socket(_timeout)); + auto socket = make_shared<Socket>(_timeout); _acceptor.async_accept (socket->socket (), boost::bind (&Server::handle_accept, this, socket, boost::asio::placeholders::error)); } + void Server::handle_accept (shared_ptr<Socket> socket, boost::system::error_code const & error) { @@ -76,6 +85,7 @@ Server::handle_accept (shared_ptr<Socket> socket, boost::system::error_code cons start_accept (); } + void Server::stop () { diff --git a/src/lib/server.h b/src/lib/server.h index fbcd7e870..0b1950aa7 100644 --- a/src/lib/server.h +++ b/src/lib/server.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,23 +18,29 @@ */ + #ifndef DCPOMATIC_SERVER_H #define DCPOMATIC_SERVER_H + #include <boost/thread.hpp> #include <boost/asio.hpp> #include <boost/thread/condition.hpp> -#include <boost/noncopyable.hpp> #include <string> + class Socket; -class Server : public boost::noncopyable + +class Server { public: explicit Server (int port, int timeout = 30); virtual ~Server (); + Server (Server const&) = delete; + Server& operator= (Server const&) = delete; + virtual void run (); void stop (); @@ -53,4 +59,5 @@ private: int _timeout; }; + #endif diff --git a/src/lib/signal_manager.cc b/src/lib/signal_manager.cc index b052e9e05..942e05105 100644 --- a/src/lib/signal_manager.cc +++ b/src/lib/signal_manager.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,7 +18,9 @@ */ + #include "signal_manager.h" + /** Global SignalManager instance */ -SignalManager* signal_manager = 0; +SignalManager* signal_manager = nullptr; diff --git a/src/lib/signal_manager.h b/src/lib/signal_manager.h index 6ba4a9456..78e936ea2 100644 --- a/src/lib/signal_manager.h +++ b/src/lib/signal_manager.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -18,20 +18,24 @@ */ + #ifndef DCPOMATIC_SIGNAL_MANAGER_H #define DCPOMATIC_SIGNAL_MANAGER_H + #include "exception_store.h" #include <boost/asio.hpp> #include <boost/thread.hpp> #include <boost/noncopyable.hpp> + class Signaller; + /** A class to allow signals to be emitted from non-UI threads and handled * by a UI thread. */ -class SignalManager : public boost::noncopyable, public ExceptionStore +class SignalManager : public ExceptionStore { public: /** Create a SignalManager. Must be called from the UI thread */ @@ -43,6 +47,9 @@ public: virtual ~SignalManager () {} + SignalManager (Signaller const&) = delete; + SignalManager& operator= (Signaller const&) = delete; + /* Do something next time the UI is idle */ template <typename T> void when_idle (T f) { @@ -95,6 +102,8 @@ private: boost::thread::id _ui_thread; }; + extern SignalManager* signal_manager; + #endif |
