[hydra-commits] hydra/servicediscovery.git branch "master" updated.

Commits to the Hydra project code repositories hydra-commits at lists.digium.com
Fri Jul 30 07:43:08 CDT 2010


branch "master" has been updated
       via  877c67575cfda35230b40dfd2faec60101c8d1f9 (commit)
       via  be999366adba05d59fa5d5024798a5acce50ba06 (commit)
       via  0df5ddf4648ae61abd8f2b3f2c5025c138ee4909 (commit)
      from  222043ce497a3bbb7521f25643dc6bda5e150bd8 (commit)

Summary of changes:
 src/ServiceDiscoveryManagement.cpp |   20 +++++++++-----------
 src/ServiceDiscoveryManagement.h   |   12 ++++++------
 src/ServiceManagement.h            |   10 +++++-----
 3 files changed, 20 insertions(+), 22 deletions(-)


- Log -----------------------------------------------------------------
commit 877c67575cfda35230b40dfd2faec60101c8d1f9
Author: Joshua Colp <jcolp at digium.com>
Date:   Fri Jul 30 09:43:58 2010 -0300

    Use the return value of erase to know if something existed or not instead of doing a find.

diff --git a/src/ServiceDiscoveryManagement.cpp b/src/ServiceDiscoveryManagement.cpp
index 59bae59..8784812 100644
--- a/src/ServiceDiscoveryManagement.cpp
+++ b/src/ServiceDiscoveryManagement.cpp
@@ -66,15 +66,13 @@ void ServiceDiscoveryManagementImpl::addCompare(const string& guid, const Servic
 
 void ServiceDiscoveryManagementImpl::removeCompare(const string& guid, const Ice::Current&)
 {
-	map<string, ServiceDiscoveryComparator>::iterator comparator = compares.find(guid);
+	int erased = compares.erase(guid);
 
-	if (comparator == compares.end()) {
+	if (!erased) {
 		throw CompareNotFound();
+	} else {
+		_service_discovery_topic->ComparisonUnregistered(guid);
 	}
-
-	compares.erase(guid);
-
-	_service_discovery_topic->ComparisonUnregistered(guid);
 };
 
 bool ServiceDiscoveryManagementImpl::isSupported(const string& compare_guid, const ServiceDiscoveryParamsPtr& params)

commit be999366adba05d59fa5d5024798a5acce50ba06
Author: Joshua Colp <jcolp at digium.com>
Date:   Fri Jul 30 09:41:38 2010 -0300

    Use map.insert so we can do the exists check and insertion in one swoop.

diff --git a/src/ServiceDiscoveryManagement.cpp b/src/ServiceDiscoveryManagement.cpp
index 8b8977c..59bae59 100644
--- a/src/ServiceDiscoveryManagement.cpp
+++ b/src/ServiceDiscoveryManagement.cpp
@@ -52,15 +52,15 @@ ServiceManagementPrx ServiceDiscoveryManagementImpl::addService(const Ice::Objec
 
 void ServiceDiscoveryManagementImpl::addCompare(const string& guid, const ServiceDiscoveryParamsComparePrx& service, const Ice::Current&)
 {
-	map<string, ServiceDiscoveryComparator>::iterator comparator = compares.find(guid);
+	ServiceDiscoveryComparator new_comparator(service);
+
+	pair<map<string, ServiceDiscoveryComparator>::iterator, bool> insert_pair;
+	insert_pair = compares.insert(pair<string, ServiceDiscoveryComparator>(guid, new_comparator));
 
-	if (comparator != compares.end()) {
+	if (insert_pair.second == false) {
 		throw DuplicateCompare();
 	}
 
-	ServiceDiscoveryComparator new_comparator(service);
-	compares[guid] = new_comparator;
-
 	_service_discovery_topic->ComparisonRegistered(guid);
 };
 

commit 0df5ddf4648ae61abd8f2b3f2c5025c138ee4909
Author: Joshua Colp <jcolp at digium.com>
Date:   Fri Jul 30 09:30:45 2010 -0300

    Specify std:: before standard library stuff.

diff --git a/src/ServiceDiscoveryManagement.h b/src/ServiceDiscoveryManagement.h
index 1a0fcda..4cc7947 100644
--- a/src/ServiceDiscoveryManagement.h
+++ b/src/ServiceDiscoveryManagement.h
@@ -18,14 +18,14 @@ public:
 		: _adapter(adapter), _service_discovery_topic(service_discovery_topic) { };
 	Ice::ObjectPrx locate(const ServiceDiscoveryParamsPtr&);
 	Ice::ObjectProxySeq locateAll(const ServiceDiscoveryParamsPtr&);
-	ServiceManagementPrx addService(const Ice::ObjectPrx&, const string&, const Ice::Current&);
-	void addCompare(const string&, const ServiceDiscoveryParamsComparePrx&, const Ice::Current&);
-	void removeCompare(const string&, const Ice::Current&);
-	bool isSupported(const string&, const ServiceDiscoveryParamsPtr&);
+	ServiceManagementPrx addService(const Ice::ObjectPrx&, const std::string&, const Ice::Current&);
+	void addCompare(const std::string&, const ServiceDiscoveryParamsComparePrx&, const Ice::Current&);
+	void removeCompare(const std::string&, const Ice::Current&);
+	bool isSupported(const std::string&, const ServiceDiscoveryParamsPtr&);
 	void removeService(ServiceManagementImpl*);
 private:
 	Ice::ObjectAdapterPtr _adapter;
-	map<string, ServiceDiscoveryComparator> compares;
-	vector<ServiceManagementImpl*> services;
+	std::map<std::string, ServiceDiscoveryComparator> compares;
+	std::vector<ServiceManagementImpl*> services;
 	EventsPrx _service_discovery_topic;
 };
diff --git a/src/ServiceManagement.h b/src/ServiceManagement.h
index edcf1dc..e8f41e4 100644
--- a/src/ServiceManagement.h
+++ b/src/ServiceManagement.h
@@ -1,18 +1,18 @@
 class ServiceDiscoveryParamsSpec {
 public:
-        ServiceDiscoveryParamsSpec(const ServiceDiscoveryParamsPtr& params, const string& compare_guid, ServiceDiscoveryManagementImpl* management)
+ServiceDiscoveryParamsSpec(const ServiceDiscoveryParamsPtr& params, const std::string& compare_guid, ServiceDiscoveryManagementImpl* management)
 		: _params(params), _compare_guid(compare_guid), _management(management) { };
 	bool isSupported(const ServiceDiscoveryParamsPtr&);
 private:
 	ServiceDiscoveryParamsPtr _params;
-	string _compare_guid;
+	std::string _compare_guid;
 	ServiceDiscoveryManagementImpl* _management;
 };
 
 class ServiceManagementImpl : public ServiceManagement
 {
 public:
-        ServiceManagementImpl(ServiceDiscoveryManagementImpl*, Ice::ObjectPrx, Ice::ObjectAdapterPtr, EventsPrx, const string&);
+        ServiceManagementImpl(ServiceDiscoveryManagementImpl*, Ice::ObjectPrx, Ice::ObjectAdapterPtr, EventsPrx, const std::string&);
 	void addDiscoveryParams(const ServiceDiscoveryParamsPtr&, const std::string&, const Ice::Current&);
 	void suspend(const Ice::Current&);
 	void unsuspend(const Ice::Current&);
@@ -26,7 +26,7 @@ private:
 	Ice::ObjectPrx _service;
 	Ice::ObjectAdapterPtr _adapter;
 	ServiceManagementPrx managementprx;
-	vector<ServiceDiscoveryParamsSpec> supported_discovery_params;
+	std::vector<ServiceDiscoveryParamsSpec> supported_discovery_params;
 	EventsPrx _service_discovery_topic;
-	string _guid;
+	std::string _guid;
 };

-----------------------------------------------------------------------


-- 
hydra/servicediscovery.git




More information about the asterisk-scf-commits mailing list