]> granicus.if.org Git - icinga2/commitdiff
Revert 78215843 as it requires Boost version 1.43.
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 17 Jul 2012 17:19:03 +0000 (19:19 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 17 Jul 2012 17:19:03 +0000 (19:19 +0200)
base/application.cpp
base/i2-base.h
base/process.cpp
cib/host.cpp
cib/service.cpp
components/compat/compatcomponent.cpp
components/convenience/conveniencecomponent.cpp
components/delegation/delegationcomponent.cpp
components/discovery/discoverycomponent.cpp
icinga/endpointmanager.cpp

index 6ee53623ee66b9843acc08ad28dae3b3ecc2ae0a..fe17a1ddaa3557b8fb4f94b6baef87eec08424eb 100644 (file)
@@ -61,7 +61,8 @@ Application::~Application(void)
        m_ShuttingDown = true;
 
        /* stop all components */
-       BOOST_FOREACH(const Component::Ptr& component, m_Components | map_values) {
+       Component::Ptr component;
+       BOOST_FOREACH(tie(tuples::ignore, component), m_Components) {
                component->Stop();
        }
 
index 8483754429da9ce32e30dd3015e83c246b1a6a49..94db9f57ad6274767840cbf1772a4aec9b55bfdf 100644 (file)
@@ -124,8 +124,6 @@ using std::type_info;
 #include <boost/lexical_cast.hpp>
 #include <boost/foreach.hpp>
 #include <boost/tuple/tuple.hpp>
-#include <boost/range.hpp>
-#include <boost/range/adaptor/map.hpp>
 
 using boost::shared_ptr;
 using boost::weak_ptr;
@@ -139,8 +137,8 @@ using boost::mutex;
 using boost::condition_variable;
 using boost::system_time;
 using boost::tie;
-using boost::adaptors::map_keys;
-using boost::adaptors::map_values;
+
+namespace tuples = boost::tuples;
 
 #if defined(__APPLE__) && defined(__MACH__)
 #      pragma GCC diagnostic ignored "-Wdeprecated-declarations" 
index 2000ed0f3c944a943ed8a8388d7c200bb382c0ad..38990a89fd849b5f8f4dd26538e5d7ea445ea74d 100644 (file)
@@ -66,7 +66,8 @@ void Process::WorkerThreadProc(void)
                        
                        FD_ZERO(&readfds);
 
-                       BOOST_FOREACH(int fd, tasks | map_keys) {
+                       int fd;
+                       BOOST_FOREACH(tie(fd, tuples::ignore), tasks) {
                                if (fd > nfds)
                                        nfds = fd;
 
index d0614d04a6d00cc1283f0a051996da1df6a3cbae..90cfdcb39f7c6382c211666e68b611214f8b0bff 100644 (file)
@@ -69,7 +69,8 @@ set<string> Host::GetParents(void) const
        if (GetProperty("dependencies", &dependencies)) {
                dependencies = Service::ResolveDependencies(*this, dependencies);
 
-               BOOST_FOREACH(const Variant& dependency, dependencies | map_values) {
+               Variant dependency;
+               BOOST_FOREACH(tie(tuples::ignore, dependency), dependencies) {
                        Service service = Service::GetByName(dependency);
 
                        string parent = service.GetHost().GetName();
@@ -98,7 +99,8 @@ bool Host::IsReachable(void) const
        if (GetProperty("dependencies", &dependencies)) {
                dependencies = Service::ResolveDependencies(*this, dependencies);
 
-               BOOST_FOREACH(const Variant& dependency, dependencies | map_values) {
+               Variant dependency;
+               BOOST_FOREACH(tie(tuples::ignore, dependency), dependencies) {
                        Service service = Service::GetByName(dependency);
 
                        if (!service.IsReachable() ||
@@ -117,7 +119,8 @@ bool Host::IsUp(void) const
        if (GetProperty("hostchecks", &hostchecks)) {
                hostchecks = Service::ResolveDependencies(*this, hostchecks);
 
-               BOOST_FOREACH(const Variant& hostcheck, hostchecks | map_values) {
+               Variant hostcheck;
+               BOOST_FOREACH(tie(tuples::ignore, hostcheck), hostchecks) {
                        Service service = Service::GetByName(hostcheck);
 
                        if (service.GetState() != StateOK && service.GetState() != StateWarning) {
index 0a015112db7c1180bcce704c79a7921f8226e36a..3a16334a658fe3352a737a471c17eb2bea6919a4 100644 (file)
@@ -117,7 +117,8 @@ void Service::GetDependenciesRecursive(const Dictionary::Ptr& result) const {
        if (!dependencies)
                return;
 
-       BOOST_FOREACH(const Variant& dependency, dependencies | map_values) {
+       Variant dependency;
+       BOOST_FOREACH(tie(tuples::ignore, dependency), dependencies) {
                if (result->Contains(dependency))
                        continue;
 
@@ -147,7 +148,8 @@ bool Service::IsReachable(void) const
        Dictionary::Ptr dependencies = boost::make_shared<Dictionary>();
        GetDependenciesRecursive(dependencies);
 
-       BOOST_FOREACH(const Variant& dependency, dependencies | map_values) {
+       Variant dependency;
+       BOOST_FOREACH(tie(tuples::ignore, dependency), dependencies) {
                Service service = Service::GetByName(dependency);
 
                /* ignore ourselves */
@@ -382,7 +384,8 @@ bool Service::IsAllowedChecker(const string& checker) const
        if (!checkers)
                return true;
 
-       BOOST_FOREACH(const Variant& pattern, checkers | map_values) {
+       Variant pattern;
+       BOOST_FOREACH(tie(tuples::ignore, pattern), checkers) {
                if (Utility::Match(pattern, checker))
                        return true;
        }
@@ -397,7 +400,8 @@ Dictionary::Ptr Service::ResolveDependencies(Host host, const Dictionary::Ptr& d
 
        Dictionary::Ptr result = boost::make_shared<Dictionary>();
 
-       BOOST_FOREACH(const Variant& dependency, dependencies | map_values) {
+       Variant dependency;
+       BOOST_FOREACH(tie(tuples::ignore, dependency), dependencies) {
                string name;
 
                if (services && services->Contains(dependency))
index 0895dcf0279cdefb6a0783e66e9062f959b0666d..8e7403205256fda5da46adf9efedffb5aded6bb0 100644 (file)
@@ -233,14 +233,16 @@ void CompatComponent::StatusTimerHandler(void)
        ConfigObject::TMap::Range range;
        range = ConfigObject::GetObjects("host");
 
-       BOOST_FOREACH(const ConfigObject::Ptr& object, range | map_values) {
+       ConfigObject::Ptr object;
+       BOOST_FOREACH(tie(tuples::ignore, object), range) {
                Host host = object;
 
                Dictionary::Ptr dict;
                dict = host.GetGroups();
 
                if (dict) {
-                       BOOST_FOREACH(const Variant& hostgroup, dict | map_values) {
+                       Variant hostgroup;
+                       BOOST_FOREACH(tie(tuples::ignore, hostgroup), dict) {
                                hostgroups[hostgroup].push_back(host.GetName());
                        }
                }
@@ -276,7 +278,7 @@ void CompatComponent::StatusTimerHandler(void)
 
        map<string, vector<Service> > servicegroups;
 
-       BOOST_FOREACH(const ConfigObject::Ptr& object, range | map_values) {
+       BOOST_FOREACH(tie(tuples::ignore, object), range) {
                Service service = object;
 
                Dictionary::Ptr dict;
@@ -284,7 +286,8 @@ void CompatComponent::StatusTimerHandler(void)
                dict = service.GetGroups();
 
                if (dict) {
-                       BOOST_FOREACH(const Variant& servicegroup, dict | map_values) {
+                       Variant servicegroup;
+                       BOOST_FOREACH(tie(tuples::ignore, servicegroup), dict) {
                                servicegroups[servicegroup].push_back(service);
                        }
                }
index cb56b1205014c81cbf24537388f5ab2871071912..afcfcea925827b309b7873ac2ff30a86820ef716 100644 (file)
@@ -150,7 +150,8 @@ void ConvenienceComponent::HostCommittedHandler(const ConfigItem::Ptr& item)
        }
 
        if (oldServices) {
-               BOOST_FOREACH(const ConfigItem::Ptr& service, oldServices | map_values) {
+               ConfigItem::Ptr service;
+               BOOST_FOREACH(tie(tuples::ignore, service), oldServices) {
                        if (!newServices->Contains(service->GetName()))
                                service->Unregister();
                }
@@ -175,7 +176,8 @@ void ConvenienceComponent::HostRemovedHandler(const ConfigItem::Ptr& item)
        if (!services)
                return;
 
-       BOOST_FOREACH(const ConfigItem::Ptr& service, services | map_values) {
+       ConfigItem::Ptr service;
+       BOOST_FOREACH(tie(tuples::ignore, service), services) {
                service->Unregister();
        }
 }
index 591560b22adb18133f0e502494d601454040652a..64d0e20210cffe5310029f48f82184c8b5e30c3d 100644 (file)
@@ -275,12 +275,13 @@ void DelegationComponent::DelegationTimerHandler(void)
 
        if (delegated > 0) {
                if (need_clear) {
-                       BOOST_FOREACH(const Endpoint::Ptr& endpoint, histogram | map_keys) {
+                       Endpoint::Ptr endpoint;
+                       BOOST_FOREACH(tie(endpoint, tuples::ignore), histogram) {
                                ClearServices(endpoint);
                        }
                }
 
-               BOOST_FOREACH(const Service& service, services) {
+               BOOST_FOREACH(Service& service, services) {
                        string checker = service.GetChecker();
                        Endpoint::Ptr endpoint = EndpointManager::GetInstance()->GetEndpointByIdentity(checker);
 
index a975b2843f2b21887b45e1b9630439bf2f7d842d..3e2adc0f3eeef235ada9a76cd4765d47580e48df 100644 (file)
@@ -168,11 +168,11 @@ void DiscoveryComponent::NewEndpointHandler(const Endpoint::Ptr& endpoint)
 
        // register published/subscribed topics for this endpoint
        ComponentDiscoveryInfo::Ptr info = ic->second;
-       BOOST_FOREACH(const string& publication, info->Publications) {
+       BOOST_FOREACH(string publication, info->Publications) {
                endpoint->RegisterPublication(publication);
        }
 
-       BOOST_FOREACH(const string& subscription, info->Subscriptions) {
+       BOOST_FOREACH(string subscription, info->Subscriptions) {
                endpoint->RegisterSubscription(subscription);
        }
 
@@ -301,14 +301,14 @@ void DiscoveryComponent::SendDiscoveryMessage(const string& method, const string
 
        set<string>::iterator i;
        Dictionary::Ptr subscriptions = boost::make_shared<Dictionary>();
-       BOOST_FOREACH(const string &subscription, info->Subscriptions) {
+       BOOST_FOREACH(string subscription, info->Subscriptions) {
                subscriptions->Add(subscription);
        }
 
        params.SetSubscriptions(subscriptions);
 
        Dictionary::Ptr publications = boost::make_shared<Dictionary>();
-       BOOST_FOREACH(const string& publication, info->Publications) {
+       BOOST_FOREACH(string publication, info->Publications) {
                publications->Add(publication);
        }
 
@@ -327,12 +327,14 @@ bool DiscoveryComponent::HasMessagePermission(const Dictionary::Ptr& roles, cons
 
        ConfigObject::TMap::Range range = ConfigObject::GetObjects("role");
 
-       BOOST_FOREACH(const ConfigObject::Ptr& role, range | map_values) {
+       ConfigObject::Ptr role;
+       BOOST_FOREACH(tie(tuples::ignore, role), range) {
                Dictionary::Ptr permissions;
                if (!role->GetProperty(messageType, &permissions))
                        continue;
 
-               BOOST_FOREACH(const Variant& permission, permissions | map_values) {
+               Variant permission;
+               BOOST_FOREACH(tie(tuples::ignore, permission), permissions) {
                        if (Utility::Match(permission, message))
                                return true;
                }
@@ -376,7 +378,8 @@ void DiscoveryComponent::ProcessDiscoveryMessage(const string& identity, const D
 
        Dictionary::Ptr publications;
        if (message.GetPublications(&publications)) {
-               BOOST_FOREACH(const Variant& publication, publications | map_values) {
+               Variant publication;
+               BOOST_FOREACH(tie(tuples::ignore, publication), publications) {
                        if (trusted || HasMessagePermission(roles, "publications", publication)) {
                                info->Publications.insert(publication);
                                if (endpoint)
@@ -387,7 +390,8 @@ void DiscoveryComponent::ProcessDiscoveryMessage(const string& identity, const D
 
        Dictionary::Ptr subscriptions;
        if (message.GetSubscriptions(&subscriptions)) {
-               BOOST_FOREACH(const Variant& subscription, subscriptions | map_values) {
+               Variant subscription;
+               BOOST_FOREACH(tie(tuples::ignore, subscription), subscriptions) {
                        if (trusted || HasMessagePermission(roles, "subscriptions", subscription)) {
                                info->Subscriptions.insert(subscription);
                                if (endpoint)
@@ -455,7 +459,8 @@ void DiscoveryComponent::DiscoveryTimerHandler(void)
        /* check whether we have to reconnect to one of our upstream endpoints */
        ConfigObject::TMap::Range range = ConfigObject::GetObjects("endpoint");
 
-       BOOST_FOREACH(const ConfigObject::Ptr& object, range | map_values) {
+       ConfigObject::Ptr object;
+       BOOST_FOREACH(tie(tuples::ignore, object), range) {
                /* Check if we're already connected to this endpoint. */
                if (endpointManager->GetEndpointByIdentity(object->GetName()))
                        continue;
index 0d56ca466d3ca9906c977c3ed9d64ebd63f5f103..272819e3535dd7962445e270cc699bf82a1bdb22 100644 (file)
@@ -240,7 +240,8 @@ void EndpointManager::SendAnycastMessage(Endpoint::Ptr sender,
                throw invalid_argument("Message is missing the 'method' property.");
 
        vector<Endpoint::Ptr> candidates;
-       BOOST_FOREACH(const Endpoint::Ptr& endpoint, m_Endpoints | map_values) {
+       Endpoint::Ptr endpoint;
+       BOOST_FOREACH(tie(tuples::ignore, endpoint), m_Endpoints) {
                /* don't forward messages between non-local endpoints */
                if (!sender->IsLocal() && !endpoint->IsLocal())
                        continue;
@@ -274,7 +275,8 @@ void EndpointManager::SendMulticastMessage(Endpoint::Ptr sender,
        if (!message.GetMethod(&method))
                throw invalid_argument("Message is missing the 'method' property.");
 
-       BOOST_FOREACH(const Endpoint::Ptr& recipient, m_Endpoints | map_values) {
+       Endpoint::Ptr recipient;
+       BOOST_FOREACH(tie(tuples::ignore, recipient), m_Endpoints) {
                /* don't forward messages back to the sender */
                if (sender == recipient)
                        continue;