summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-10-02 21:25:12 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-10-02 21:25:12 +0100
commit42107bb466982e3d6810fb5cb36a97fa8a225042 (patch)
tree59fb8cb5ab5f934c32031db2a7f383403860dca2
parentUpdate to work with system dbpp (diff)
parentSlash the amount of inclusion in pre-compiled headers (diff)
downloadp2pvr-0.1.2.tar.bz2
p2pvr-0.1.2.tar.xz
p2pvr-0.1.2.zip
Merge branch 'project2-adhoc-plugins'p2pvr-0.1.2
-rw-r--r--p2pvr/carddaemon/Jamfile.jam1
-rw-r--r--p2pvr/carddaemon/carddaemon.cpp2
-rw-r--r--p2pvr/daemon/daemon.cpp2
-rw-r--r--p2pvr/daemon/pch.hpp6
-rw-r--r--p2pvr/daemon/schedulers/bitDumbScheduler.cpp2
-rw-r--r--p2pvr/daemon/schedules.cpp6
-rw-r--r--p2pvr/daemon/schedules.h4
-rw-r--r--p2pvr/daemon/unittests/testp2ice.cpp14
-rw-r--r--p2pvr/daemonbase/pch.hpp4
-rw-r--r--p2pvr/devices/frontend.cpp10
-rw-r--r--p2pvr/devices/frontend.h6
-rw-r--r--p2pvr/devices/frontends/ofdm.cpp2
-rw-r--r--p2pvr/devices/pch.hpp5
-rw-r--r--p2pvr/devices/tuner.cpp11
-rw-r--r--p2pvr/dvb/pch.hpp2
-rw-r--r--p2pvr/dvb/siParsers/network.cpp1
-rw-r--r--p2pvr/lib/pch.hpp4
-rw-r--r--p2pvr/p2comp/recordingStream.cpp4
-rw-r--r--p2pvr/p2comp/serviceStream.cpp2
19 files changed, 40 insertions, 48 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 ]
:
+ <library>..//adhocutil
<library>../ice//p2pvrice
<library>../devices//p2pvrdevices
<library>../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/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 <Ice/Ice.h>
#include <glibmm.h>
#include <boost/bind.hpp>
-#include <boost/function.hpp>
+#include <boost/function/function_fwd.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/shared_ptr.hpp>
@@ -15,10 +15,6 @@
#include <string>
#include <vector>
-#include <variableType.h>
-#include <rdbmsDataSource.h>
-#include <p2pvr.h>
-
#endif
#endif
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 <boost/date_time/posix_time/posix_time.hpp>
-#include <instanceStore.impl.h>
+#include <factory.impl.h>
#include "sqlSelectDeserializer.h"
#include <slicer/slicer.h>
#include <p2pvr-int.h>
@@ -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<ShowingPtr> 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 <p2pvr.h>
#include <options.h>
#include "dbClient.h"
-#include <genLoader.h>
+#include <factory.h>
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<EpisodeGroup, std::string, const Episodes &> EpisodeGroupLoader;
+typedef AdHoc::Factory<EpisodeGroup, const Episodes &> EpisodeGroupFactory;
typedef boost::shared_ptr<EpisodeGroup> 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 <definedDirs.h>
#include <sourceObject.h>
#include <testAppInstance.h>
+#include <stream.h>
+#include <rowSet.h>
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/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 <Ice/Ice.h>
-#include <variableType.h>
-#include <daemon.h>
-#include <options.h>
-#include <logger.h>
#endif
#endif
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 <logger.h>
#include <sys/ioctl.h>
#include <linux/dvb/frontend.h>
-#include <instanceStore.impl.h>
+#include <factory.impl.h>
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 <linux/dvb/frontend.h>
-#include <genLoader.h>
+#include <factory.h>
#include <dvb.h>
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<Frontend, fe_type, Tuner *, int, const struct dvb_frontend_info &> FrontendLoader;
+typedef AdHoc::Factory<Frontend, Tuner *, int, const struct dvb_frontend_info &> FrontendFactory;
typedef boost::shared_ptr<Frontend> 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..7a7881c 100644
--- a/p2pvr/devices/pch.hpp
+++ b/p2pvr/devices/pch.hpp
@@ -4,7 +4,7 @@
#include <Ice/Ice.h>
#include <boost/bind.hpp>
-#include <boost/function.hpp>
+#include <boost/function/function_fwd.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/shared_ptr.hpp>
@@ -15,9 +15,6 @@
#include <vector>
#include <thread>
-#include <options.h>
-#include <plugable.h>
-
#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 <sys/ioctl.h>
#include <poll.h>
#include <logger.h>
-#include <plugable.h>
+#include <factory.h>
#include <linux/dvb/frontend.h>
#include <linux/dvb/dmx.h>
#include <boost/tuple/tuple.hpp>
@@ -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<FrontendNotSupported>(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/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 <Ice/Ice.h>
#include <glibmm.h>
#include <boost/bind.hpp>
-#include <boost/function.hpp>
+#include <boost/function/function_fwd.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/shared_ptr.hpp>
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 <boost/bind.hpp>
#include <linux/dvb/frontend.h>
#include <safeMapFind.h>
+#include <exceptions.h>
struct NetworkStreamsHeader {
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
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 <Ice/Ice.h>
#include <glibmm.h>
#include <boost/bind.hpp>
-#include <boost/function.hpp>
+#include <boost/function/function_fwd.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/shared_ptr.hpp>
@@ -15,8 +15,6 @@
#include <string>
#include <vector>
-#include <variableType.h>
-
#endif
#endif
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<P2PVR::StoragePrx>("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);