diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-01-03 22:21:05 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-06-13 17:29:37 +0100 |
commit | 6e4f84448e49f7a69eb57ca2a54a474fd9da8632 (patch) | |
tree | 763c69ca099299887055e2aa2b7aaa44bc7bdc83 /p2pvr/daemon | |
parent | Remove all the mess around symlinks and fancy structure in storage and add so... (diff) | |
download | p2pvr-6e4f84448e49f7a69eb57ca2a54a474fd9da8632.tar.bz2 p2pvr-6e4f84448e49f7a69eb57ca2a54a474fd9da8632.tar.xz p2pvr-6e4f84448e49f7a69eb57ca2a54a474fd9da8632.zip |
Use native for instead BOOST_FOREACH
Diffstat (limited to 'p2pvr/daemon')
-rw-r--r-- | p2pvr/daemon/dbClient.cpp | 2 | ||||
-rw-r--r-- | p2pvr/daemon/globalDevices.cpp | 10 | ||||
-rw-r--r-- | p2pvr/daemon/maintenance/events.cpp | 2 | ||||
-rw-r--r-- | p2pvr/daemon/maintenance/network.cpp | 8 | ||||
-rw-r--r-- | p2pvr/daemon/maintenance/services.cpp | 2 | ||||
-rw-r--r-- | p2pvr/daemon/muxedFileSink.cpp | 4 | ||||
-rw-r--r-- | p2pvr/daemon/pch.hpp | 1 | ||||
-rw-r--r-- | p2pvr/daemon/recorder.cpp | 4 | ||||
-rw-r--r-- | p2pvr/daemon/schedulers/bitDumbScheduler.cpp | 4 | ||||
-rw-r--r-- | p2pvr/daemon/schedules.cpp | 32 | ||||
-rw-r--r-- | p2pvr/daemon/si.cpp | 2 | ||||
-rw-r--r-- | p2pvr/daemon/unittests/testMaint.cpp | 4 |
12 files changed, 37 insertions, 38 deletions
diff --git a/p2pvr/daemon/dbClient.cpp b/p2pvr/daemon/dbClient.cpp index 8267584..de4b926 100644 --- a/p2pvr/daemon/dbClient.cpp +++ b/p2pvr/daemon/dbClient.cpp @@ -14,7 +14,7 @@ DatabaseClient::SqlMergeColumnsInserter(SqlMergeTask * merge, const std::string void DatabaseClient::onAllDatasources(const DataSourceCall & call) const { - BOOST_FOREACH(const CommonObjects::DataSources::value_type & ds, CommonObjects::datasources) { + for (const CommonObjects::DataSources::value_type & ds : CommonObjects::datasources) { call(ds.second); } } diff --git a/p2pvr/daemon/globalDevices.cpp b/p2pvr/daemon/globalDevices.cpp index 4368cea..79fa36a 100644 --- a/p2pvr/daemon/globalDevices.cpp +++ b/p2pvr/daemon/globalDevices.cpp @@ -16,7 +16,7 @@ P2PVR::TunerPrx GlobalDevices::GetTunerSpecific(const DVBSI::DeliveryPtr & delivery, const Ice::Current & ice) { auto ic = ice.adapter->getCommunicator(); - BOOST_FOREACH(const auto & pool, Devices) { + for (const auto & pool : Devices) { try { auto poolprx = P2PVR::DevicesPrx::checkedCast(ic->stringToProxy(pool)); return poolprx->GetTunerSpecific(delivery); @@ -31,7 +31,7 @@ P2PVR::TunerPrx GlobalDevices::GetTunerAny(short type, const DVBSI::DeliveryPtr & delivery, const Ice::Current & ice) { auto ic = ice.adapter->getCommunicator(); - BOOST_FOREACH(const auto & pool, Devices) { + for (const auto & pool : Devices) { try { auto poolprx = P2PVR::DevicesPrx::checkedCast(ic->stringToProxy(pool)); return poolprx->GetTunerAny(type, delivery); @@ -46,7 +46,7 @@ P2PVR::PrivateTunerPrx GlobalDevices::GetPrivateTuner(short type, const Ice::Current & ice) { auto ic = ice.adapter->getCommunicator(); - BOOST_FOREACH(const auto & pool, Devices) { + for (const auto & pool : Devices) { try { auto poolprx = P2PVR::DevicesPrx::checkedCast(ic->stringToProxy(pool)); return poolprx->GetPrivateTuner(type); @@ -61,7 +61,7 @@ void GlobalDevices::ReleaseTuner(const P2PVR::TunerPrx & tuner, const Ice::Current & ice) { auto ic = ice.adapter->getCommunicator(); - BOOST_FOREACH(const auto & pool, Devices) { + for (const auto & pool : Devices) { auto poolprx = P2PVR::DevicesPrx::checkedCast(ic->stringToProxy(pool)); poolprx->ReleaseTuner(tuner); } @@ -72,7 +72,7 @@ GlobalDevices::TunerCount(const Ice::Current & ice) { int total = 0; auto ic = ice.adapter->getCommunicator(); - BOOST_FOREACH(const auto & pool, Devices) { + for (const auto & pool : Devices) { try { auto poolprx = P2PVR::DevicesPrx::checkedCast(ic->stringToProxy(pool)); total += poolprx->TunerCount(); diff --git a/p2pvr/daemon/maintenance/events.cpp b/p2pvr/daemon/maintenance/events.cpp index f075a32..e309f39 100644 --- a/p2pvr/daemon/maintenance/events.cpp +++ b/p2pvr/daemon/maintenance/events.cpp @@ -71,7 +71,7 @@ class SiEventsMerger : public IHaveSubTasks { void executeChildren(ExecContext * ec) const { - BOOST_FOREACH(const Tasks::value_type & sq, normal) { + for (const Tasks::value_type & sq : normal) { sq->execute(ec); } } diff --git a/p2pvr/daemon/maintenance/network.cpp b/p2pvr/daemon/maintenance/network.cpp index d9ce0ec..283e6fe 100644 --- a/p2pvr/daemon/maintenance/network.cpp +++ b/p2pvr/daemon/maintenance/network.cpp @@ -16,9 +16,9 @@ class SiNetworkInformationMerger : public SiNetworkInformationParser { bool HandleTable(DVBSI::NetworkPtr n) { Logger()->messagebf(LOG_DEBUG, "Network Id: %d Name: %s", n->NetworkId, *n->Name); - BOOST_FOREACH(const auto & ts, n->TransportStreams) { + for (const auto & ts : n->TransportStreams) { Logger()->messagebf(LOG_DEBUG, "\tTransport Stream Id: %d Original Network Id: %d", ts->TransportStreamId, ts->OriginalNetworkId); - BOOST_FOREACH(const auto & s, ts->Services) { + for (const auto & s : ts->Services) { Logger()->messagebf(LOG_DEBUG, "\t\tService Id: %d Service Type: %d", s.ServiceId, s.ServiceType); } if (ts->Terrestrial) { @@ -42,7 +42,7 @@ class SiNetworkInformationMerger : public SiNetworkInformationParser { SqlMergeTask mergeDvbt("postgres", "delivery_dvbt"); CreateColumns<DVBSI::TerrestrialDeliveryPtr>(boost::bind(&DatabaseClient::SqlMergeColumnsInserter, &mergeDvbt, _1, _2)); - BOOST_FOREACH(const auto & s, n->TransportStreams) { + for (const auto & s : n->TransportStreams) { if (s->Terrestrial) { mergeDvbt.sources.insert(new SingleIterator<DVBSI::TerrestrialDeliveryPtr>(&s->Terrestrial)); } @@ -52,7 +52,7 @@ class SiNetworkInformationMerger : public SiNetworkInformationParser { SqlMergeTask mergeServices("postgres", "services"); CreateColumns<DVBSI::NetworkService>(boost::bind(&DatabaseClient::SqlMergeColumnsInserter, &mergeServices, _1, _2)); - BOOST_FOREACH(const auto & s, n->TransportStreams) { + for (const auto & s : n->TransportStreams) { mergeServices.sources.insert(new ContainerIterator<DVBSI::NetworkServiceList>(&s->Services)); } mergeServices.loadComplete(commonObjects); diff --git a/p2pvr/daemon/maintenance/services.cpp b/p2pvr/daemon/maintenance/services.cpp index 55409c2..2030cf8 100644 --- a/p2pvr/daemon/maintenance/services.cpp +++ b/p2pvr/daemon/maintenance/services.cpp @@ -16,7 +16,7 @@ class SiServicesMerger : public SiServicesParser { bool HandleTable(DVBSI::TransportStreamPtr ts) { Logger()->messagebf(LOG_DEBUG, "Transport Stream Id: %d Original Network Id: %s", ts->TransportStreamId, ts->OriginalNetworkId); - BOOST_FOREACH(const auto & s, ts->Services) { + for (const auto & s : ts->Services) { Logger()->messagebf(LOG_DEBUG, "\tService Id: %d Name: %s Type: %d, Provider: %s, DefaultAuthority: %s, RunningStatus %d FreeCaMode %d", s->ServiceId, (s->Name ? *s->Name : "?"), (s->Type ? *s->Type : -1), (s->ProviderName ? *s->ProviderName : "?"), (s->DefaultAuthority ? *s->DefaultAuthority : "?"), diff --git a/p2pvr/daemon/muxedFileSink.cpp b/p2pvr/daemon/muxedFileSink.cpp index 4245873..3008aa7 100644 --- a/p2pvr/daemon/muxedFileSink.cpp +++ b/p2pvr/daemon/muxedFileSink.cpp @@ -14,7 +14,7 @@ MuxedFileSink::MuxedFileSink(const boost::filesystem::path & t, const std::strin { std::vector<std::string> params; boost::algorithm::split(params, cmd, isspace, boost::algorithm::token_compress_on); - BOOST_FOREACH(auto & c, params) { + for (auto & c : params) { if (c == "${TARGET}") { c = t.string(); } @@ -116,7 +116,7 @@ MuxedFileSink::ReadMuxer(int waitTime) const buf.resize(len); std::vector<std::string> lines; boost::algorithm::split(lines, buf, boost::algorithm::is_any_of("\r\n\f"), boost::algorithm::token_compress_on); - BOOST_FOREACH(const auto & line, lines) { + for (const auto & line : lines) { if (line.empty()) continue; Logger()->messagebf(LOG_INFO, "Muxer::%p > %s", this, line); } diff --git a/p2pvr/daemon/pch.hpp b/p2pvr/daemon/pch.hpp index bf16cef..f34156e 100644 --- a/p2pvr/daemon/pch.hpp +++ b/p2pvr/daemon/pch.hpp @@ -5,7 +5,6 @@ #include <Ice/Ice.h> #include <glibmm.h> #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include <boost/function.hpp> #include <boost/intrusive_ptr.hpp> #include <boost/shared_ptr.hpp> diff --git a/p2pvr/daemon/recorder.cpp b/p2pvr/daemon/recorder.cpp index 2580e84..3c97fc6 100644 --- a/p2pvr/daemon/recorder.cpp +++ b/p2pvr/daemon/recorder.cpp @@ -33,13 +33,13 @@ void Recorder::RefreshSchedules(const Ice::Current &) { std::lock_guard<std::mutex> g(lock); - BOOST_FOREACH(auto & t, pendingRecordings) { + for (auto & t : pendingRecordings) { timer->cancel(t); } pendingRecordings.clear(); auto schedules = P2PVR::SchedulesPrx::checkedCast(adapter->createProxy(adapter->getCommunicator()->stringToIdentity("Schedules"))); auto si = P2PVR::SIPrx::checkedCast(adapter->createProxy(adapter->getCommunicator()->stringToIdentity("SI"))); - BOOST_FOREACH(const auto & s, schedules->GetScheduledToRecord()) { + for (const auto & s : schedules->GetScheduledToRecord()) { if (std::find_if(currentRecordings.begin(), currentRecordings.end(), [&s](const CurrentPtr & c) { return s->ScheduleId == c->schedule->ScheduleId && s->EventUid == c->event->EventUid; }) != currentRecordings.end()) { diff --git a/p2pvr/daemon/schedulers/bitDumbScheduler.cpp b/p2pvr/daemon/schedulers/bitDumbScheduler.cpp index f3cf5fb..eb40431 100644 --- a/p2pvr/daemon/schedulers/bitDumbScheduler.cpp +++ b/p2pvr/daemon/schedulers/bitDumbScheduler.cpp @@ -22,7 +22,7 @@ class TheBitDumbScheduler : public EpisodeGroup { if (complexityLevel > 2 << 16) { auto current = showings.size(); for (EpisodesIter ne = e; ne != episodes.end(); ne++) { - BOOST_FOREACH(const auto & s, (*ne)->showings) { + for (const auto & s : (*ne)->showings) { showings.push_back(s); if (SuggestWithFeedback(showings) & 0x1) { break; @@ -35,7 +35,7 @@ class TheBitDumbScheduler : public EpisodeGroup { else { EpisodesIter ne = e; ne++; - BOOST_FOREACH(const auto & s, (*e)->showings) { + for (const auto & s : (*e)->showings) { showings.push_back(s); SelectShowings(ne, complexityLevel); showings.pop_back(); diff --git a/p2pvr/daemon/schedules.cpp b/p2pvr/daemon/schedules.cpp index abb3b46..f70d44d 100644 --- a/p2pvr/daemon/schedules.cpp +++ b/p2pvr/daemon/schedules.cpp @@ -9,7 +9,7 @@ #include "p2Helpers.h" #include "containerIterator.h" #include "resources.h" -#include <boost/date_time/posix_time/posix_time.hpp> +#include <boost/date_time/posix_time/posix_time.hpp> #include <instanceStore.impl.h> ResourceString(Schedules_getCandidates, sql_Schedules_getCandidates); @@ -193,14 +193,14 @@ EpisodeGroup::IsShowingListValid(const Showings & showings) const Periods periods; Usage usage; - BOOST_FOREACH(const auto & s, showings) { + for (const auto & s : showings) { if (s) { periods.insert(Periods::value_type(s->startTime, {s->transportStreamId, 1})); periods.insert(Periods::value_type(s->stopTime, {s->transportStreamId, -1})); } } bool result = true; - BOOST_FOREACH(const auto & p, periods) { + for (const auto & p : periods) { auto & u = usage[p.second.trans]; u += p.second.offset; if (std::count_if(usage.begin(), usage.end(), [](const Usage::value_type & uv) { return uv.second > 0;}) > tuners) { @@ -292,9 +292,9 @@ Schedules::GetEpisodeIntersects(Episodes & all, Episodes & grouped) { for (Episodes::iterator aei = all.begin(); aei != all.end(); aei++) { const auto & ae = *aei; - BOOST_FOREACH(const auto & ge, grouped) { - BOOST_FOREACH(const auto & gs, ge->showings) { - BOOST_FOREACH(const auto & as, ae->showings) { + for (const auto & ge : grouped) { + for (const auto & gs : ge->showings) { + for (const auto & as : ae->showings) { if (gs->period.intersects(as->period)) { Logger()->messagebf(LOG_DEBUG, " added %s", ae->what); grouped.push_back(ae); @@ -324,7 +324,7 @@ Schedules::DoReschedule(const Ice::Current & ice) Showings allShowings; EpisodePtr cur; int minPriority = 0; - BOOST_FOREACH(const auto & c, episodes) { + for (const auto & c : episodes) { if (!cur || cur->what != c->What) { cur = new Episode(c->What); scheduleList.push_back(cur); @@ -336,9 +336,9 @@ Schedules::DoReschedule(const Ice::Current & ice) allShowings.push_back(s); } Logger()->messagebf(LOG_DEBUG, "%d episodes created, %s showings", scheduleList.size(), allShowings.size()); - BOOST_FOREACH(const auto & e, scheduleList) { + for (const auto & e : scheduleList) { Logger()->messagebf(LOG_DEBUG, " %s", e->what); - BOOST_FOREACH(const auto & s, e->showings) { + for (const auto & s : e->showings) { s->priority += 1 - minPriority; e->priority += s->priority; } @@ -363,7 +363,7 @@ Schedules::DoReschedule(const Ice::Current & ice) Logger()->messagebf(LOG_DEBUG, "group created with %d episodes", group.size()); double total = 1; // Measure and add the optional to not record - BOOST_FOREACH(const auto & e, group) { + for (const auto & e : group) { Logger()->messagebf(LOG_DEBUG, " %d * %d:%s", e->showings.size(), e->priority, e->what); e->showings.push_back(NULL); total *= e->showings.size(); @@ -373,13 +373,13 @@ Schedules::DoReschedule(const Ice::Current & ice) EpisodeGroupPtr sched = EpisodeGroupPtr(EpisodeGroupLoader::createNew(SchedulerAlgorithm, group)); sched->tuners = tunerCount; std::set<ShowingPtr> selected; - BOOST_FOREACH(const auto & s, sched->Solve()) { + for (const auto & s : sched->Solve()) { if (s) selected.insert(s); } - BOOST_FOREACH(const auto & c, group) { + for (const auto & c : group) { Logger()->messagebf(LOG_DEBUG, "Episode %s, %d options", c->what, c->showings.size()); - BOOST_FOREACH(const auto & i, c->showings) { + for (const auto & i : c->showings) { if (selected.find(i) != selected.end()) { Logger()->messagebf(LOG_DEBUG, " %s - %s (%d) <-", i->startTime, i->stopTime, i->transportStreamId); } @@ -389,15 +389,15 @@ Schedules::DoReschedule(const Ice::Current & ice) } } Logger()->message(LOG_DEBUG, "----------"); - BOOST_FOREACH(const auto & c, group) { + for (const auto & c : group) { bool found = false; - BOOST_FOREACH(const auto & i, c->showings) { + for (const auto & i : c->showings) { if (i && selected.find(i) != selected.end()) { found = true; break; } } - BOOST_FOREACH(const auto & i, c->showings) { + for (const auto & i : c->showings) { if (i) { records.push_back(RecordPtr(new Record(i->eventUid, found ? diff --git a/p2pvr/daemon/si.cpp b/p2pvr/daemon/si.cpp index 0c5162e..ad33109 100644 --- a/p2pvr/daemon/si.cpp +++ b/p2pvr/daemon/si.cpp @@ -106,7 +106,7 @@ SI::GetEvents(const P2PVR::IntSequence & eventUids, const Ice::Current &) { P2PVR::Events rtn; SqlContainerCreator<P2PVR::Events, P2PVR::Event> cc(rtn); - BOOST_FOREACH(const auto & uid, eventUids){ + for (const auto & uid : eventUids){ cc.populate(Select(SI_eventByUid, uid).second); } if (rtn.size() != eventUids.size()) throw P2PVR::NotFound(); diff --git a/p2pvr/daemon/unittests/testMaint.cpp b/p2pvr/daemon/unittests/testMaint.cpp index 10f365e..b064d5b 100644 --- a/p2pvr/daemon/unittests/testMaint.cpp +++ b/p2pvr/daemon/unittests/testMaint.cpp @@ -38,7 +38,7 @@ class Core { s = P2PVR::SIPrx::checkedCast(ic->stringToProxy("SI")); BOOST_REQUIRE(s); s->ice_ping(); - + m = P2PVR::MaintenancePrx::checkedCast(ic->stringToProxy("Maintenance")); BOOST_REQUIRE(m); m->ice_ping(); @@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE( update_events ) auto recs = r->GetRecordings(); BOOST_CHECKPOINT("Delete existing recordings"); - BOOST_FOREACH(const auto & rec, recs) { + for (const auto & rec : recs) { r->DeleteRecording(rec->RecordingId); } |