cscore: Change impl to only one singleton (#1398)

This avoids a number of shutdown use-after-free races by controlling the
destruction order.  It also is a prerequisite to making the internal
interfaces mockable for unit testing.
This commit is contained in:
Peter Johnson
2018-10-31 20:22:58 -07:00
committed by GitHub
parent 1dec0393a1
commit e27d6d7bb8
28 changed files with 433 additions and 356 deletions

View File

@@ -11,6 +11,7 @@
#include <memory>
#include <string>
#include <wpi/Logger.h>
#include <wpi/StringRef.h>
#include <wpi/Twine.h>
#include <wpi/mutex.h>
@@ -20,10 +21,13 @@
namespace cs {
class Frame;
class Notifier;
class Telemetry;
class SinkImpl : public PropertyContainer {
public:
explicit SinkImpl(const wpi::Twine& name);
explicit SinkImpl(const wpi::Twine& name, wpi::Logger& logger,
Notifier& notifier, Telemetry& telemetry);
virtual ~SinkImpl();
SinkImpl(const SinkImpl& queue) = delete;
SinkImpl& operator=(const SinkImpl& queue) = delete;
@@ -55,6 +59,11 @@ class SinkImpl : public PropertyContainer {
virtual void SetSourceImpl(std::shared_ptr<SourceImpl> source);
protected:
wpi::Logger& m_logger;
Notifier& m_notifier;
Telemetry& m_telemetry;
private:
std::string m_name;
std::string m_description;