summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--p2pvr/daemon/events.cpp32
-rw-r--r--p2pvr/daemon/maintenance/events.cpp1
-rw-r--r--p2pvr/daemon/maintenance/network.cpp3
-rw-r--r--p2pvr/daemon/maintenance/services.cpp1
-rw-r--r--p2pvr/daemon/schedules.cpp37
-rw-r--r--p2pvr/daemon/si.cpp1
-rw-r--r--p2pvr/ice/dvbsi.ice21
-rw-r--r--p2pvr/lib/Jamfile.jam2
-rw-r--r--p2pvr/lib/dvbsiHelpers.h22
-rw-r--r--p2pvr/lib/dvbsiHelpers/cableDelivery.cpp28
-rw-r--r--p2pvr/lib/dvbsiHelpers/event.cpp64
-rw-r--r--p2pvr/lib/dvbsiHelpers/network.cpp21
-rw-r--r--p2pvr/lib/dvbsiHelpers/networkService.cpp22
-rw-r--r--p2pvr/lib/dvbsiHelpers/networkTransportStream.cpp23
-rw-r--r--p2pvr/lib/dvbsiHelpers/programMap.cpp24
-rw-r--r--p2pvr/lib/dvbsiHelpers/satelliteDelivery.cpp36
-rw-r--r--p2pvr/lib/dvbsiHelpers/service.cpp34
-rw-r--r--p2pvr/lib/dvbsiHelpers/terrestrialDelivery.cpp42
-rw-r--r--p2pvr/lib/objectRowState.cpp63
-rw-r--r--p2pvr/lib/objectRowState.h16
-rw-r--r--p2pvr/lib/p2pvrHelpers/schedule.cpp35
21 files changed, 100 insertions, 428 deletions
diff --git a/p2pvr/daemon/events.cpp b/p2pvr/daemon/events.cpp
index 01fe01e..4c0bc76 100644
--- a/p2pvr/daemon/events.cpp
+++ b/p2pvr/daemon/events.cpp
@@ -5,38 +5,6 @@
template<>
void
-CreateColumns<P2PVR::EventPtr>(const ColumnCreator & cc)
-{
- cc("eventUid", false);
- cc("serviceId", true);
- cc("eventId", true);
- cc("title", false);
- cc("titleLang", false);
- cc("subtitle", false);
- cc("description", false);
- cc("descriptionLang", false);
- cc("videoAspect", false);
- cc("videoFrameRate", false);
- cc("videoHd", false);
- cc("audioChannels", false);
- cc("audioLanguage", false);
- cc("subtitleLanguage", false);
- cc("category", false);
- cc("subCategory", false);
- cc("userCategory", false);
- cc("dvbRating", false);
- cc("startTime", false);
- cc("stopTime", false);
- cc("episode", false);
- cc("episodes", false);
- cc("year", false);
- cc("flags", false);
- cc("season", false);
- cc("current", false);
-}
-
-template<>
-void
BindColumns(RowState & rs, const P2PVR::EventPtr & e)
{
rs.fields[0] << e->ServiceId;
diff --git a/p2pvr/daemon/maintenance/events.cpp b/p2pvr/daemon/maintenance/events.cpp
index e309f39..01a333d 100644
--- a/p2pvr/daemon/maintenance/events.cpp
+++ b/p2pvr/daemon/maintenance/events.cpp
@@ -4,7 +4,6 @@
#include <sqlMergeTask.h>
#include <Ice/Communicator.h>
#include <p2Helpers.h>
-#include <dvbsiHelpers.h>
#include <containerIterator.h>
#include <singleIterator.h>
#include <temporaryIceAdapterObject.h>
diff --git a/p2pvr/daemon/maintenance/network.cpp b/p2pvr/daemon/maintenance/network.cpp
index 283e6fe..4ecb7d1 100644
--- a/p2pvr/daemon/maintenance/network.cpp
+++ b/p2pvr/daemon/maintenance/network.cpp
@@ -4,7 +4,6 @@
#include <sqlMergeTask.h>
#include <Ice/Communicator.h>
#include <p2Helpers.h>
-#include <dvbsiHelpers.h>
#include <containerIterator.h>
#include <singleIterator.h>
#include <temporaryIceAdapterObject.h>
@@ -19,7 +18,7 @@ class SiNetworkInformationMerger : public SiNetworkInformationParser {
for (const auto & ts : n->TransportStreams) {
Logger()->messagebf(LOG_DEBUG, "\tTransport Stream Id: %d Original Network Id: %d", ts->TransportStreamId, ts->OriginalNetworkId);
for (const auto & s : ts->Services) {
- Logger()->messagebf(LOG_DEBUG, "\t\tService Id: %d Service Type: %d", s.ServiceId, s.ServiceType);
+ Logger()->messagebf(LOG_DEBUG, "\t\tService Id: %d Service Type: %d", s.ServiceId, s.Type);
}
if (ts->Terrestrial) {
Logger()->messagebf(LOG_DEBUG, "\t\tDVB-T: Frequency: %d", ts->Terrestrial->Frequency);
diff --git a/p2pvr/daemon/maintenance/services.cpp b/p2pvr/daemon/maintenance/services.cpp
index 2030cf8..8824571 100644
--- a/p2pvr/daemon/maintenance/services.cpp
+++ b/p2pvr/daemon/maintenance/services.cpp
@@ -4,7 +4,6 @@
#include <sqlMergeTask.h>
#include <Ice/Communicator.h>
#include <p2Helpers.h>
-#include <dvbsiHelpers.h>
#include <containerIterator.h>
#include <singleIterator.h>
#include <temporaryIceAdapterObject.h>
diff --git a/p2pvr/daemon/schedules.cpp b/p2pvr/daemon/schedules.cpp
index f5aaad1..4ced9a7 100644
--- a/p2pvr/daemon/schedules.cpp
+++ b/p2pvr/daemon/schedules.cpp
@@ -55,43 +55,6 @@ typedef std::vector<RecordPtr> Records;
template<>
void
-CreateColumns<P2PVR::ScheduledToRecordPtr>(const ColumnCreator & cc)
-{
- cc("eventuid", true);
- cc("scheduleid", true);
-}
-
-template<>
-void
-CreateColumns<P2PVR::ScheduleCandidatePtr>(const ColumnCreator & cc)
-{
- cc("what", true);
- cc("serviceid", false);
- cc("eventuid", false);
- cc("transportstreamid", false);
- cc("starttime", false);
- cc("stoptime", false);
- cc("priority", false);
- cc("scheduleid", false);
-}
-
-template<>
-void
-CreateColumns<P2PVR::SchedulePtr>(const ColumnCreator & cc)
-{
- cc("scheduleid", true);
- cc("serviceid", false);
- cc("eventuid", false);
- cc("title", false);
- cc("search", false);
- cc("priority", false);
- cc("early", false);
- cc("late", false);
- cc("repeats", false);
-}
-
-template<>
-void
CreateColumns<RecordPtr>(const ColumnCreator & cc)
{
cc("eventuid", true);
diff --git a/p2pvr/daemon/si.cpp b/p2pvr/daemon/si.cpp
index fc58f8e..0b93bc4 100644
--- a/p2pvr/daemon/si.cpp
+++ b/p2pvr/daemon/si.cpp
@@ -1,7 +1,6 @@
#include <pch.hpp>
#include "si.h"
#include "resources.h"
-#include "dvbsiHelpers.h"
#include "sqlSelectDeserializer.h"
#include "commonHelpers.h"
#include <slicer/slicer.h>
diff --git a/p2pvr/ice/dvbsi.ice b/p2pvr/ice/dvbsi.ice
index 29e5396..bfe1015 100644
--- a/p2pvr/ice/dvbsi.ice
+++ b/p2pvr/ice/dvbsi.ice
@@ -12,6 +12,7 @@
module DVBSI {
// Descriptors
class Delivery {
+ [ "slicer:merge:key" ]
int TransportStreamId;
long Frequency;
};
@@ -49,45 +50,59 @@ module DVBSI {
};
struct NetworkService {
+ [ "slicer:merge:key" ]
int ServiceId;
int TransportStreamId;
- short ServiceType;
+ short Type;
};
sequence<NetworkService> NetworkServiceList;
class NetworkTransportStream {
int NetworkId;
+ [ "slicer:merge:key" ]
int TransportStreamId;
int OriginalNetworkId;
+ [ "slicer:merge:omit" ]
SatelliteDelivery Satellite;
+ [ "slicer:merge:omit" ]
CableDelivery Cable;
+ [ "slicer:merge:omit" ]
TerrestrialDelivery Terrestrial;
+ [ "slicer:merge:omit" ]
NetworkServiceList Services;
};
sequence<NetworkTransportStream> NetworkTransportStreams;
class Network {
+ [ "slicer:merge:key" ]
int NetworkId;
optional(1) string Name;
+ [ "slicer:merge:omit" ]
NetworkTransportStreams TransportStreams;
};
class BouquetTransportStream {
+ [ "slicer:merge:key" ]
int TransportStreamId;
+ [ "slicer:merge:key" ]
int OriginalNetworkId;
};
sequence <BouquetTransportStream> BouquetTransportStreamList;
class Bouquet {
+ [ "slicer:merge:key" ]
int BouquetId;
optional(1) string Name;
optional(2) string DefaultAuthority;
+ [ "slicer:merge:omit" ]
BouquetTransportStreamList Streams;
};
["project2:type"]
class Service {
+ [ "slicer:merge:key" ]
int ServiceId;
+ [ "slicer:merge:key" ]
int TransportStreamId;
bool EitSchedule;
bool EitPresentFollowing;
@@ -101,8 +116,10 @@ module DVBSI {
sequence<Service> ServiceList;
class TransportStream {
+ [ "slicer:merge:key" ]
int TransportStreamId;
int OriginalNetworkId;
+ [ "slicer:merge:omit" ]
ServiceList Services;
};
@@ -126,7 +143,9 @@ module DVBSI {
["project2:type"]
class Event {
+ [ "slicer:merge:key" ]
int ServiceId;
+ [ "slicer:merge:key" ]
int EventId;
string Title;
string TitleLang;
diff --git a/p2pvr/lib/Jamfile.jam b/p2pvr/lib/Jamfile.jam
index a7ce426..2083c30 100644
--- a/p2pvr/lib/Jamfile.jam
+++ b/p2pvr/lib/Jamfile.jam
@@ -1,3 +1,4 @@
+lib slicer : : <name>slicer : : <include>/usr/include/slicer ;
lib boost_system ;
lib boost_filesystem ;
@@ -20,6 +21,7 @@ lib p2pvrlib :
<library>..//p2common
<library>..//p2lib
<implicit-dependency>../ice//p2pvrice
+ <library>slicer
: :
<library>boost_filesystem
<implicit-dependency>../ice//p2pvrice
diff --git a/p2pvr/lib/dvbsiHelpers.h b/p2pvr/lib/dvbsiHelpers.h
deleted file mode 100644
index 949014c..0000000
--- a/p2pvr/lib/dvbsiHelpers.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef ICE_DVBSI_HELPERS_H
-#define ICE_DVBSI_HELPERS_H
-
-#include <dvbsi.h>
-#include "objectRowState.h"
-
-#define ColumnHelper(T) \
- template<> void CreateColumns<T>(const ColumnCreator & cc); \
- template<> void BindColumns(RowState & rs, const T & obj);
-
-ColumnHelper(DVBSI::NetworkPtr);
-ColumnHelper(DVBSI::NetworkTransportStreamPtr);
-ColumnHelper(DVBSI::NetworkService);
-ColumnHelper(DVBSI::TerrestrialDeliveryPtr);
-ColumnHelper(DVBSI::CableDeliveryPtr);
-ColumnHelper(DVBSI::SatelliteDeliveryPtr);
-ColumnHelper(DVBSI::ServicePtr);
-ColumnHelper(DVBSI::StreamPtr);
-ColumnHelper(DVBSI::EventPtr);
-
-#endif
-
diff --git a/p2pvr/lib/dvbsiHelpers/cableDelivery.cpp b/p2pvr/lib/dvbsiHelpers/cableDelivery.cpp
deleted file mode 100644
index c4b82e7..0000000
--- a/p2pvr/lib/dvbsiHelpers/cableDelivery.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <pch.hpp>
-#include "../dvbsiHelpers.h"
-#include "../p2Helpers.h"
-
-template<>
-void
-CreateColumns<DVBSI::CableDeliveryPtr>(const ColumnCreator & cc)
-{
- cc("frequency", false);
- cc("transportStreamId", true);
- cc("fecOuter", false);
- cc("modulation", false);
- cc("symbolRate", false);
- cc("fecInner", false);
-}
-
-template<>
-void
-BindColumns(RowState & rs, const DVBSI::CableDeliveryPtr & s)
-{
- rs.fields[0] << s->Frequency;
- rs.fields[1] << s->TransportStreamId;
- rs.fields[2] << s->FecOuter;
- rs.fields[3] << s->Modulation;
- rs.fields[4] << s->SymbolRate;
- rs.fields[5] << s->FecInner;
-}
-
diff --git a/p2pvr/lib/dvbsiHelpers/event.cpp b/p2pvr/lib/dvbsiHelpers/event.cpp
deleted file mode 100644
index f3daab3..0000000
--- a/p2pvr/lib/dvbsiHelpers/event.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <pch.hpp>
-#include "../dvbsiHelpers.h"
-#include "../p2Helpers.h"
-
-template<>
-void
-CreateColumns<DVBSI::EventPtr>(const ColumnCreator & cc)
-{
- cc("serviceId", true);
- cc("eventId", true);
- cc("title", false);
- cc("titleLang", false);
- cc("subtitle", false);
- cc("description", false);
- cc("descriptionLang", false);
- cc("videoAspect", false);
- cc("videoFrameRate", false);
- cc("videoHd", false);
- cc("audioChannels", false);
- cc("audioLanguage", false);
- cc("subtitleLanguage", false);
- cc("category", false);
- cc("subCategory", false);
- cc("userCategory", false);
- cc("dvbRating", false);
- cc("startTime", false);
- cc("stopTime", false);
- cc("episode", false);
- cc("episodes", false);
- cc("year", false);
- cc("flags", false);
- cc("season", false);
-}
-
-template<>
-void
-BindColumns(RowState & rs, const DVBSI::EventPtr & e)
-{
- rs.fields[0] << e->ServiceId;
- rs.fields[1] << e->EventId;
- rs.fields[2] << e->Title;
- rs.fields[3] << e->TitleLang;
- rs.fields[4] << e->Subtitle;
- rs.fields[5] << e->Description;
- rs.fields[6] << e->DescriptionLang;
- rs.fields[7] << e->VideoAspect;
- rs.fields[8] << e->VideoFrameRate;
- rs.fields[9] << e->VideoHD;
- rs.fields[10] << e->AudioChannels;
- rs.fields[11] << e->AudioLanguage;
- rs.fields[12] << e->SubtitleLanguage;
- rs.fields[13] << e->Category;
- rs.fields[14] << e->SubCategory;
- rs.fields[15] << e->UserCategory;
- rs.fields[16] << e->DvbRating;
- rs.fields[17] << e->StartTime;
- rs.fields[18] << e->StopTime;
- rs.fields[19] << e->Episode;
- rs.fields[20] << e->Episodes;
- rs.fields[21] << e->Year;
- rs.fields[22] << e->Flags;
- rs.fields[23] << e->Season;
-}
-
diff --git a/p2pvr/lib/dvbsiHelpers/network.cpp b/p2pvr/lib/dvbsiHelpers/network.cpp
deleted file mode 100644
index 3b117f1..0000000
--- a/p2pvr/lib/dvbsiHelpers/network.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <pch.hpp>
-#include "../dvbsiHelpers.h"
-#include "../p2Helpers.h"
-
-template<>
-void
-CreateColumns<DVBSI::NetworkPtr>(const ColumnCreator & cc)
-{
- cc("networkId", true);
- cc("name", false);
-}
-
-template<>
-void
-BindColumns(RowState & rs, const DVBSI::NetworkPtr & network)
-{
- rs.fields[0] << network->NetworkId;
- rs.fields[1] << network->Name;
-}
-
-
diff --git a/p2pvr/lib/dvbsiHelpers/networkService.cpp b/p2pvr/lib/dvbsiHelpers/networkService.cpp
deleted file mode 100644
index a4a47d5..0000000
--- a/p2pvr/lib/dvbsiHelpers/networkService.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <pch.hpp>
-#include "../dvbsiHelpers.h"
-#include "../p2Helpers.h"
-
-template<>
-void
-CreateColumns<DVBSI::NetworkService>(const ColumnCreator & cc)
-{
- cc("serviceId", true);
- cc("type", false);
- cc("transportStreamId", false);
-}
-
-template<>
-void
-BindColumns(RowState & rs, const DVBSI::NetworkService & s)
-{
- rs.fields[0] << s.ServiceId;
- rs.fields[1] << s.ServiceType;
- rs.fields[2] << s.TransportStreamId;
-}
-
diff --git a/p2pvr/lib/dvbsiHelpers/networkTransportStream.cpp b/p2pvr/lib/dvbsiHelpers/networkTransportStream.cpp
deleted file mode 100644
index bdc7c4f..0000000
--- a/p2pvr/lib/dvbsiHelpers/networkTransportStream.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <pch.hpp>
-#include "../dvbsiHelpers.h"
-#include "../p2Helpers.h"
-
-template<>
-void
-CreateColumns<DVBSI::NetworkTransportStreamPtr>(const ColumnCreator & cc)
-{
- cc("transportStreamId", true);
- cc("networkId", false);
- cc("originalNetworkId", false);
-}
-
-template<>
-void
-BindColumns(RowState & rs, const DVBSI::NetworkTransportStreamPtr & ts)
-{
- rs.fields[0] << ts->TransportStreamId;
- rs.fields[1] << ts->NetworkId;
- rs.fields[2] << ts->OriginalNetworkId;
-}
-
-
diff --git a/p2pvr/lib/dvbsiHelpers/programMap.cpp b/p2pvr/lib/dvbsiHelpers/programMap.cpp
deleted file mode 100644
index d8cf400..0000000
--- a/p2pvr/lib/dvbsiHelpers/programMap.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <pch.hpp>
-#include "../dvbsiHelpers.h"
-#include "../p2Helpers.h"
-
-template<>
-void
-CreateColumns<DVBSI::StreamPtr>(const ColumnCreator & cc)
-{
- cc("serviceId", true);
- cc("id", true);
- cc("type", false);
-}
-
-template<>
-void
-BindColumns(RowState & rs, const DVBSI::StreamPtr & stream)
-{
- rs.fields[0] << stream->ServiceId;
- rs.fields[1] << stream->Id;
- rs.fields[2] << stream->Type;
-}
-
-
-
diff --git a/p2pvr/lib/dvbsiHelpers/satelliteDelivery.cpp b/p2pvr/lib/dvbsiHelpers/satelliteDelivery.cpp
deleted file mode 100644
index 02f4d42..0000000
--- a/p2pvr/lib/dvbsiHelpers/satelliteDelivery.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <pch.hpp>
-#include "../dvbsiHelpers.h"
-#include "../p2Helpers.h"
-
-template<>
-void
-CreateColumns<DVBSI::SatelliteDeliveryPtr>(const ColumnCreator & cc)
-{
- cc("frequency", false);
- cc("transportStreamId", true);
- cc("orbitalPosition", false);
- cc("westEastFlag", false);
- cc("polarization", false);
- cc("rollOff", false);
- cc("modulationSystem", false);
- cc("modulationType", false);
- cc("symbolRate", false);
- cc("fecInner", false);
-}
-
-template<>
-void
-BindColumns(RowState & rs, const DVBSI::SatelliteDeliveryPtr & s)
-{
- rs.fields[0] << s->Frequency;
- rs.fields[1] << s->TransportStreamId;
- rs.fields[2] << s->OrbitalPosition;
- rs.fields[3] << s->WestEastFlag;
- rs.fields[4] << s->Polarization;
- rs.fields[5] << s->RollOff;
- rs.fields[6] << s->ModulationSystem;
- rs.fields[7] << s->ModulationType;
- rs.fields[8] << s->SymbolRate;
- rs.fields[9] << s->FecInner;
-}
-
diff --git a/p2pvr/lib/dvbsiHelpers/service.cpp b/p2pvr/lib/dvbsiHelpers/service.cpp
deleted file mode 100644
index 45c1fa0..0000000
--- a/p2pvr/lib/dvbsiHelpers/service.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <pch.hpp>
-#include "../dvbsiHelpers.h"
-#include "../p2Helpers.h"
-
-template<>
-void
-CreateColumns<DVBSI::ServicePtr>(const ColumnCreator & cc)
-{
- cc("serviceId", true);
- cc("transportStreamId", true);
- cc("name", false);
- cc("providerName", false);
- cc("defaultAuthority", false);
- cc("runningStatus", false);
- cc("eitSchedule", false);
- cc("eitPresentFollowing", false);
- cc("freeCAMode", false);
-}
-
-template<>
-void
-BindColumns(RowState & rs, const DVBSI::ServicePtr & s)
-{
- rs.fields[0] << s->ServiceId;
- rs.fields[1] << s->TransportStreamId;
- rs.fields[2] << s->Name;
- rs.fields[3] << s->ProviderName;
- rs.fields[4] << s->DefaultAuthority;
- rs.fields[5] << s->RunningStatus;
- rs.fields[6] << s->EitSchedule;
- rs.fields[7] << s->EitPresentFollowing;
- rs.fields[8] << s->FreeCaMode;
-}
-
diff --git a/p2pvr/lib/dvbsiHelpers/terrestrialDelivery.cpp b/p2pvr/lib/dvbsiHelpers/terrestrialDelivery.cpp
deleted file mode 100644
index 28ca855..0000000
--- a/p2pvr/lib/dvbsiHelpers/terrestrialDelivery.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-#include <pch.hpp>
-#include "../dvbsiHelpers.h"
-#include "../p2Helpers.h"
-
-template<>
-void
-CreateColumns<DVBSI::TerrestrialDeliveryPtr>(const ColumnCreator & cc)
-{
- cc("frequency", false);
- cc("transportStreamId", true);
- cc("bandwidth", false);
- cc("priority", false);
- cc("timeSlicing", false);
- cc("mpeFec", false);
- cc("constellation", false);
- cc("hierarchy", false);
- cc("codeRateHP", false);
- cc("codeRateLP", false);
- cc("guardInterval", false);
- cc("transmissionMode", false);
- cc("otherFrequencyFlag", false);
-}
-
-template<>
-void
-BindColumns(RowState & rs, const DVBSI::TerrestrialDeliveryPtr & s)
-{
- rs.fields[0] << s->Frequency;
- rs.fields[1] << s->TransportStreamId;
- rs.fields[2] << s->Bandwidth;
- rs.fields[3] << s->Priority;
- rs.fields[4] << s->TimeSlicing;
- rs.fields[5] << s->MpeFec;
- rs.fields[6] << s->Constellation;
- rs.fields[7] << s->Hierarchy;
- rs.fields[8] << s->CodeRateHP;
- rs.fields[9] << s->CodeRateLP;
- rs.fields[10] << s->GuardInterval;
- rs.fields[11] << s->TransmissionMode;
- rs.fields[12] << s->OtherFrequencyFlag;
-}
-
diff --git a/p2pvr/lib/objectRowState.cpp b/p2pvr/lib/objectRowState.cpp
new file mode 100644
index 0000000..c882405
--- /dev/null
+++ b/p2pvr/lib/objectRowState.cpp
@@ -0,0 +1,63 @@
+#include "objectRowState.h"
+#include <logger.h>
+
+const std::string md_mergeKey("merge:key");
+const std::string md_mergeOmit("merge:omit");
+
+bool
+mdHasFlag(const std::list<std::string> & md, const std::string & flag)
+{
+ return std::find(md.begin(), md.end(), flag) != md.end();
+}
+
+void
+CreateColumns(Slicer::ModelPartPtr mp, const ColumnCreator & cc)
+{
+ mp->OnEachChild([cc](const std::string & name, Slicer::ModelPartPtr, Slicer::HookCommonPtr h) {
+ auto & md = h->GetMetadata();
+ if (mdHasFlag(md, md_mergeOmit)) return;
+ cc(name, mdHasFlag(md, md_mergeKey));
+ });
+}
+
+class SqlTarget : public Slicer::ValueTarget,
+ public Slicer::TValueTarget<boost::posix_time::time_duration>,
+ public Slicer::TValueTarget<boost::posix_time::ptime> {
+ public:
+ SqlTarget(VariableType & v) : vt(v) {}
+
+#define BIND(Type) \
+ virtual void get(const Type & t) const override { vt = t; }
+ BIND(bool);
+ BIND(::Ice::Byte);
+ BIND(::Ice::Short);
+ BIND(::Ice::Int);
+ BIND(::Ice::Long);
+ BIND(::Ice::Float);
+ BIND(::Ice::Double);
+ BIND(::std::string);
+ BIND(boost::posix_time::ptime);
+ BIND(boost::posix_time::time_duration);
+
+ private:
+ VariableType & vt;
+};
+typedef IceUtil::Handle<SqlTarget> SqlTargetPtr;
+
+void
+BindColumns(Slicer::ModelPartPtr mp, RowState & rs)
+{
+ unsigned int field = 0;
+ mp->OnEachChild([&rs,&field](const std::string &, Slicer::ModelPartPtr mp, Slicer::HookCommonPtr h) {
+ auto & md = h->GetMetadata();
+ if (mdHasFlag(md, md_mergeOmit)) return;
+ if (mp && mp->HasValue()) {
+ SqlTargetPtr st = new SqlTarget(rs.fields[field++]);
+ mp->GetValue(st);
+ }
+ else {
+ rs.fields[field++] = Null();
+ }
+ });
+}
+
diff --git a/p2pvr/lib/objectRowState.h b/p2pvr/lib/objectRowState.h
index f305469..d98380b 100644
--- a/p2pvr/lib/objectRowState.h
+++ b/p2pvr/lib/objectRowState.h
@@ -4,15 +4,27 @@
#include <boost/function.hpp>
#include <string>
#include <rowSet.h>
+#include <slicer/modelParts.h>
typedef boost::function<void(const std::string &, bool)> ColumnCreator;
typedef boost::function<void(const ColumnCreator &)> ColumnSpecifier;
+void BindColumns(Slicer::ModelPartPtr, RowState &);
+
template <typename V>
-void BindColumns(RowState &, const V &);
+void BindColumns(RowState & rs, const V & v)
+{
+ BindColumns(Slicer::ModelPartFor(const_cast<V &>(v)), rs);
+}
+
+void CreateColumns(Slicer::ModelPartPtr, const ColumnCreator &);
template <typename V>
-void CreateColumns(const ColumnCreator &);
+void CreateColumns(const ColumnCreator & cc)
+{
+ V v;
+ CreateColumns(Slicer::ModelPartFor(v), cc);
+}
template <typename T>
class ObjectRowState : public RowState {
diff --git a/p2pvr/lib/p2pvrHelpers/schedule.cpp b/p2pvr/lib/p2pvrHelpers/schedule.cpp
deleted file mode 100644
index e0ec214..0000000
--- a/p2pvr/lib/p2pvrHelpers/schedule.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <pch.hpp>
-#include <p2pvr.h>
-#include "../dvbsiHelpers.h"
-#include "../p2Helpers.h"
-
-template<>
-void
-CreateColumns<P2PVR::SchedulePtr>(const ColumnCreator & cc)
-{
- cc("scheduleid", true);
- cc("serviceid", true);
- cc("eventuid", false);
- cc("title", false);
- cc("search", false);
- cc("priority", false);
- cc("early", false);
- cc("late", false);
- cc("repeats", false);
-}
-
-template<>
-void
-BindColumns(RowState & rs, const P2PVR::SchedulePtr & s)
-{
- rs.fields[0] << s->ScheduleId;
- rs.fields[1] << s->ServiceId;
- rs.fields[2] << s->EventUid;
- rs.fields[3] << s->Title;
- rs.fields[4] << s->Search;
- rs.fields[5] << s->Priority;
- rs.fields[6] << s->Early;
- rs.fields[7] << s->Late;
- rs.fields[8] << s->Repeats;
-}
-