From 009c003f4235db50002ee732309dff175ac8f969 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 2 Oct 2015 21:19:51 +0100 Subject: Swtich everything to new libs/interfaces --- p2pvr/carddaemon/Jamfile.jam | 1 + p2pvr/carddaemon/carddaemon.cpp | 2 +- p2pvr/daemon/daemon.cpp | 2 +- p2pvr/daemon/schedulers/bitDumbScheduler.cpp | 2 +- p2pvr/daemon/schedules.cpp | 6 +++--- p2pvr/daemon/schedules.h | 4 ++-- p2pvr/daemon/unittests/testp2ice.cpp | 14 ++++++++------ p2pvr/devices/frontend.cpp | 10 ++++++++-- p2pvr/devices/frontend.h | 6 ++++-- p2pvr/devices/frontends/ofdm.cpp | 2 +- p2pvr/devices/pch.hpp | 3 --- p2pvr/devices/tuner.cpp | 11 ++--------- p2pvr/dvb/siParsers/network.cpp | 1 + p2pvr/p2comp/recordingStream.cpp | 4 ++-- p2pvr/p2comp/serviceStream.cpp | 2 +- 15 files changed, 36 insertions(+), 34 deletions(-) diff --git a/p2pvr/carddaemon/Jamfile.jam b/p2pvr/carddaemon/Jamfile.jam index 3598c3b..7088966 100644 --- a/p2pvr/carddaemon/Jamfile.jam +++ b/p2pvr/carddaemon/Jamfile.jam @@ -1,6 +1,7 @@ lib p2pvrcarddaemon : [ glob *.cpp ] : + ..//adhocutil ../ice//p2pvrice ../devices//p2pvrdevices ../daemonbase//p2pvrdaemonbase diff --git a/p2pvr/carddaemon/carddaemon.cpp b/p2pvr/carddaemon/carddaemon.cpp index a9b9beb..0b234e5 100644 --- a/p2pvr/carddaemon/carddaemon.cpp +++ b/p2pvr/carddaemon/carddaemon.cpp @@ -15,5 +15,5 @@ class P2PvrCardDaemon : public DaemonBase { } }; -DECLARE_GENERIC_LOADER("p2pvrcarddaemon", DaemonLoader, P2PvrCardDaemon); +NAMEDFACTORY("p2pvrcarddaemon", P2PvrCardDaemon, DaemonFactory); diff --git a/p2pvr/daemon/daemon.cpp b/p2pvr/daemon/daemon.cpp index 374a8b4..874ea3b 100644 --- a/p2pvr/daemon/daemon.cpp +++ b/p2pvr/daemon/daemon.cpp @@ -49,5 +49,5 @@ class P2PvrDaemon : public DaemonBase { } }; -DECLARE_GENERIC_LOADER("p2pvrdaemon", DaemonLoader, P2PvrDaemon); +NAMEDFACTORY("p2pvrdaemon", P2PvrDaemon, DaemonFactory); diff --git a/p2pvr/daemon/schedulers/bitDumbScheduler.cpp b/p2pvr/daemon/schedulers/bitDumbScheduler.cpp index eb40431..1681103 100644 --- a/p2pvr/daemon/schedulers/bitDumbScheduler.cpp +++ b/p2pvr/daemon/schedulers/bitDumbScheduler.cpp @@ -51,5 +51,5 @@ class TheBitDumbScheduler : public EpisodeGroup { const Episodes episodes; }; -DECLARE_GENERIC_LOADER("BitDumb", EpisodeGroupLoader, TheBitDumbScheduler); +NAMEDFACTORY("BitDumb", TheBitDumbScheduler, EpisodeGroupFactory); diff --git a/p2pvr/daemon/schedules.cpp b/p2pvr/daemon/schedules.cpp index 5e3881d..40d7863 100644 --- a/p2pvr/daemon/schedules.cpp +++ b/p2pvr/daemon/schedules.cpp @@ -10,7 +10,7 @@ #include "containerIterator.h" #include "resources.h" #include -#include +#include #include "sqlSelectDeserializer.h" #include #include @@ -246,7 +246,7 @@ Schedules::DoReschedule(const Ice::Current & ice) } Logger()->messagebf(LOG_DEBUG, "group complexity of %d options", total); - EpisodeGroupPtr sched = EpisodeGroupPtr(EpisodeGroupLoader::createNew(SchedulerAlgorithm, group)); + EpisodeGroupPtr sched = EpisodeGroupPtr(EpisodeGroupFactory::createNew(SchedulerAlgorithm, group)); sched->tuners = tunerCount; std::set selected; for (const auto & s : sched->Solve()) { @@ -346,5 +346,5 @@ Schedules::UpdateSchedule(const P2PVR::SchedulePtr & s, const Ice::Current & ice return s->ScheduleId; } -INSTANTIATESTORE(std::string, EpisodeGroupLoader); +INSTANTIATEFACTORY(EpisodeGroup, const Episodes &); diff --git a/p2pvr/daemon/schedules.h b/p2pvr/daemon/schedules.h index 2ff9e0f..07f2c23 100644 --- a/p2pvr/daemon/schedules.h +++ b/p2pvr/daemon/schedules.h @@ -4,7 +4,7 @@ #include #include #include "dbClient.h" -#include +#include typedef boost::posix_time::ptime datetime; class Episode; @@ -77,7 +77,7 @@ class Schedules : public P2PVR::Schedules, public DatabaseClient { static std::string SchedulerAlgorithm; }; -typedef GenLoader EpisodeGroupLoader; +typedef AdHoc::Factory EpisodeGroupFactory; typedef boost::shared_ptr EpisodeGroupPtr; #endif diff --git a/p2pvr/daemon/unittests/testp2ice.cpp b/p2pvr/daemon/unittests/testp2ice.cpp index 8229bf5..dc584b6 100644 --- a/p2pvr/daemon/unittests/testp2ice.cpp +++ b/p2pvr/daemon/unittests/testp2ice.cpp @@ -5,6 +5,8 @@ #include #include #include +#include +#include const boost::filesystem::path variant = binDir.leaf(); const boost::filesystem::path compiler = binDir.parent_path().leaf(); @@ -15,19 +17,19 @@ static void commonTests() { - BOOST_REQUIRE(ElementLoader::getFor("p2pvrrecordingstream")); - BOOST_REQUIRE(ElementLoader::getFor("p2pvrservicestream")); - BOOST_REQUIRE(ElementLoader::getFor("P2PVR-SI-GetEvent")); + BOOST_REQUIRE(StreamFactory::get("p2pvrrecordingstream")); + BOOST_REQUIRE(StreamFactory::get("p2pvrservicestream")); + BOOST_REQUIRE(RowSetFactory::get("P2PVR-SI-GetEvent")); } static void unloadTests() { - BOOST_REQUIRE_THROW(ElementLoader::getFor("P2PVR-SI-GetEvent"), NotSupported); + BOOST_REQUIRE_THROW(RowSetFactory::get("P2PVR-SI-GetEvent"), AdHoc::NoSuchPluginException); // Known issue, these *should* unload, but for some reason, don't. - BOOST_WARN_THROW(ElementLoader::getFor("p2pvrrecordingstream"), NotSupported); - BOOST_WARN_THROW(ElementLoader::getFor("p2pvrservicestream"), NotSupported); + BOOST_WARN_THROW(StreamFactory::get("p2pvrrecordingstream"), AdHoc::NoSuchPluginException); + BOOST_WARN_THROW(StreamFactory::get("p2pvrservicestream"), AdHoc::NoSuchPluginException); } BOOST_GLOBAL_FIXTURE( TestAppInstance ); diff --git a/p2pvr/devices/frontend.cpp b/p2pvr/devices/frontend.cpp index 54870a1..5b9280b 100644 --- a/p2pvr/devices/frontend.cpp +++ b/p2pvr/devices/frontend.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include Frontend::Frontend(Tuner * t, int fd, const struct dvb_frontend_info & i) : tuner(t), @@ -35,5 +35,11 @@ Frontend::GetStatus() const return status; } -INSTANTIATESTORE(fe_type, FrontendLoader); +std::string +Frontend::FactoryKey(fe_type t) +{ + return stringbf("Frontend:%x", t); +} + +INSTANTIATEFACTORY(Frontend, Tuner *, int, const struct dvb_frontend_info &); diff --git a/p2pvr/devices/frontend.h b/p2pvr/devices/frontend.h index d33353d..b68cdba 100644 --- a/p2pvr/devices/frontend.h +++ b/p2pvr/devices/frontend.h @@ -2,7 +2,7 @@ #define P2PVR_FRONTEND_H #include -#include +#include #include class Tuner; @@ -19,13 +19,15 @@ class Frontend { virtual std::string Type() const = 0; const struct dvb_frontend_info & Info() const; + static std::string FactoryKey(fe_type); + protected: const Tuner * tuner; const int frontendFD; const struct dvb_frontend_info fe_info; }; -typedef GenLoader FrontendLoader; +typedef AdHoc::Factory FrontendFactory; typedef boost::shared_ptr FrontendPtr; #endif diff --git a/p2pvr/devices/frontends/ofdm.cpp b/p2pvr/devices/frontends/ofdm.cpp index 93e0d86..cb174ba 100644 --- a/p2pvr/devices/frontends/ofdm.cpp +++ b/p2pvr/devices/frontends/ofdm.cpp @@ -155,5 +155,5 @@ class Frontend_OFDM : public Frontend { } }; -DECLARE_GENERIC_LOADER(FE_OFDM, FrontendLoader, Frontend_OFDM); +NAMEDFACTORY(Frontend::FactoryKey(FE_OFDM), Frontend_OFDM, FrontendFactory); diff --git a/p2pvr/devices/pch.hpp b/p2pvr/devices/pch.hpp index 435ce48..0ccd5c0 100644 --- a/p2pvr/devices/pch.hpp +++ b/p2pvr/devices/pch.hpp @@ -15,9 +15,6 @@ #include #include -#include -#include - #endif #endif diff --git a/p2pvr/devices/tuner.cpp b/p2pvr/devices/tuner.cpp index ea3ccad..f6df896 100644 --- a/p2pvr/devices/tuner.cpp +++ b/p2pvr/devices/tuner.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include @@ -14,13 +14,6 @@ #include "tunerSendSi.h" #include "tunerSendTs.h" -class FrontendNotSupported : public NotSupported { - public: - FrontendNotSupported(fe_type t) : NotSupported(stringbf("Frontend not supported: %s", t)) - { - } -}; - Tuner::Tuner(const boost::filesystem::path & df) : deviceFrontend(df), deviceRoot(df.branch_path()), @@ -36,7 +29,7 @@ Tuner::Tuner(const boost::filesystem::path & df) : if (ioctl(fd, FE_GET_INFO, &fe_info) < 0) { throw P2PVR::DeviceError(deviceFrontend.string(), strerror(errno), errno); } - frontend = FrontendPtr(FrontendLoader::createNew(fe_info.type, this, fd, fe_info)); + frontend = FrontendPtr(FrontendFactory::createNew(Frontend::FactoryKey(fe_info.type), this, fd, fe_info)); } catch (...) { close(fd); diff --git a/p2pvr/dvb/siParsers/network.cpp b/p2pvr/dvb/siParsers/network.cpp index 6527d58..fb21683 100644 --- a/p2pvr/dvb/siParsers/network.cpp +++ b/p2pvr/dvb/siParsers/network.cpp @@ -3,6 +3,7 @@ #include #include #include +#include struct NetworkStreamsHeader { #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ diff --git a/p2pvr/p2comp/recordingStream.cpp b/p2pvr/p2comp/recordingStream.cpp index 74d8ba0..fc1687a 100644 --- a/p2pvr/p2comp/recordingStream.cpp +++ b/p2pvr/p2comp/recordingStream.cpp @@ -14,7 +14,7 @@ class RecordingStream : public StreamBase { { } - void runStream(const Sink & sink, ExecContext * ec) const + void runStream(const Sink & sink, ExecContext * ec) const override { auto storage = ice->GetProxy("Storage", ec); assert(storage); @@ -75,5 +75,5 @@ class RecordingStream : public StreamBase { Variable recording; }; -DECLARE_LOADER("p2pvrrecordingstream", RecordingStream); +NAMEDFACTORY("p2pvrrecordingstream", RecordingStream, StreamFactory); diff --git a/p2pvr/p2comp/serviceStream.cpp b/p2pvr/p2comp/serviceStream.cpp index 323234f..3702787 100644 --- a/p2pvr/p2comp/serviceStream.cpp +++ b/p2pvr/p2comp/serviceStream.cpp @@ -53,5 +53,5 @@ END_OPTIONS(ServiceStream); std::string ServiceStream::muxerCommand; -DECLARE_LOADER("p2pvrservicestream", ServiceStream); +NAMEDFACTORY("p2pvrservicestream", ServiceStream, StreamFactory); -- cgit v1.2.3 From d71e113f632f25d915d5e37958de3223e19983f4 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 2 Oct 2015 21:24:39 +0100 Subject: Slash the amount of inclusion in pre-compiled headers --- p2pvr/daemon/pch.hpp | 6 +----- p2pvr/daemonbase/pch.hpp | 4 ---- p2pvr/devices/pch.hpp | 2 +- p2pvr/dvb/pch.hpp | 2 +- p2pvr/lib/pch.hpp | 4 +--- 5 files changed, 4 insertions(+), 14 deletions(-) diff --git a/p2pvr/daemon/pch.hpp b/p2pvr/daemon/pch.hpp index deec57c..7c96f52 100644 --- a/p2pvr/daemon/pch.hpp +++ b/p2pvr/daemon/pch.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include @@ -15,10 +15,6 @@ #include #include -#include -#include -#include - #endif #endif diff --git a/p2pvr/daemonbase/pch.hpp b/p2pvr/daemonbase/pch.hpp index 28b23b5..74671ef 100644 --- a/p2pvr/daemonbase/pch.hpp +++ b/p2pvr/daemonbase/pch.hpp @@ -3,10 +3,6 @@ #define P2PVRLIB_PCH #include -#include -#include -#include -#include #endif #endif diff --git a/p2pvr/devices/pch.hpp b/p2pvr/devices/pch.hpp index 0ccd5c0..7a7881c 100644 --- a/p2pvr/devices/pch.hpp +++ b/p2pvr/devices/pch.hpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include diff --git a/p2pvr/dvb/pch.hpp b/p2pvr/dvb/pch.hpp index 7828bd2..6a76256 100644 --- a/p2pvr/dvb/pch.hpp +++ b/p2pvr/dvb/pch.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include diff --git a/p2pvr/lib/pch.hpp b/p2pvr/lib/pch.hpp index b9a507c..7c96f52 100644 --- a/p2pvr/lib/pch.hpp +++ b/p2pvr/lib/pch.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include @@ -15,8 +15,6 @@ #include #include -#include - #endif #endif -- cgit v1.2.3