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

Commits to the Hydra project code repositories hydra-commits at lists.digium.com
Sat Jul 31 17:31:04 CDT 2010


branch "master" has been updated
       via  a0441ce28e9f3a00f6b58e9ab7edc24fd9138d24 (commit)
       via  cd90308f808862eabe68c6563cd87589f43bb2fc (commit)
       via  c8b0748317338bd45c914a4aef1f39834602849d (commit)
       via  29e7aa8780a3cec4fd11c2545eccbbb88247d382 (commit)
       via  ff01bef696ddbb2d0a5b3a2cdecf21bdb6057f4f (commit)
       via  c0149991120e8d20e2a3ffc4eb80561898bdb334 (commit)
       via  04e9bf7bd8b5fe99c67e285a599f89589858cc47 (commit)
      from  a34e64abc1d608f1a8a71a6c08e91f8080321ae6 (commit)

Summary of changes:
 src/ServiceLocator.cpp           |   15 +++++++--------
 src/ServiceLocatorManagement.cpp |   20 ++++++++------------
 src/ServiceLocatorManagement.h   |   33 +++++++++++++++++++--------------
 src/ServiceManagement.cpp        |   12 +++++-------
 src/ServiceManagement.h          |   22 +++++++++++-----------
 5 files changed, 50 insertions(+), 52 deletions(-)


- Log -----------------------------------------------------------------
commit a0441ce28e9f3a00f6b58e9ab7edc24fd9138d24
Author: Joshua Colp <jcolp at digium.com>
Date:   Sat Jul 31 19:28:52 2010 -0300

    Use a smart pointer for ServiceManagementImpl.

diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index b83956d..7fe47f3 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -33,7 +33,7 @@ using namespace Hydra::Location;
  */
 Ice::ObjectPrx ServiceLocatorManagementImpl::locate(const ServiceLocatorParamsPtr& params)
 {
-	for (vector<ServiceManagementImpl*>::iterator service = mServices.begin(); service != mServices.end(); ++service) {
+	for (vector<ServiceManagementImplPtr>::iterator service = mServices.begin(); service != mServices.end(); ++service) {
 		if ((*service)->isSupported(params) == true) {
 			return (*service)->GetService();
 		}
@@ -49,7 +49,7 @@ Ice::ObjectProxySeq ServiceLocatorManagementImpl::locateAll(const ServiceLocator
 {
 	Ice::ObjectProxySeq applicable_services;
 
-	for (vector<ServiceManagementImpl*>::iterator service = mServices.begin(); service != mServices.end(); ++service) {
+	for (vector<ServiceManagementImplPtr>::iterator service = mServices.begin(); service != mServices.end(); ++service) {
 		if ((*service)->isSupported(params) == true) {
 			applicable_services.push_back((*service)->GetService());
 		}
@@ -67,7 +67,7 @@ Ice::ObjectProxySeq ServiceLocatorManagementImpl::locateAll(const ServiceLocator
  */
 ServiceManagementPrx ServiceLocatorManagementImpl::addService(const Ice::ObjectPrx& service, const string& guid, const Ice::Current&)
 {
-	ServiceManagementImpl* new_service = new ServiceManagementImpl(this, service, mAdapter, mLocatorTopic, guid);
+	ServiceManagementImplPtr new_service = new ServiceManagementImpl(this, service, mAdapter, mLocatorTopic, guid);
 
 	mServices.push_back(new_service);
 
@@ -122,9 +122,9 @@ bool ServiceLocatorManagementImpl::isSupported(const string& compare_guid, const
 /**
  * Implementation of the removeService method as defined in service_locator.ice
  */
-void ServiceLocatorManagementImpl::removeService(ServiceManagementImpl* service)
+void ServiceLocatorManagementImpl::removeService(ServiceManagementImplPtr service)
 {
-	for (vector<ServiceManagementImpl*>::iterator existing_service = mServices.begin(); existing_service != mServices.end(); ++existing_service) {
+	for (vector<ServiceManagementImplPtr>::iterator existing_service = mServices.begin(); existing_service != mServices.end(); ++existing_service) {
 		if ((*existing_service) == service) {
 			mServices.erase(existing_service);
 			return;
diff --git a/src/ServiceLocatorManagement.h b/src/ServiceLocatorManagement.h
index 8abe7ff..69fe736 100644
--- a/src/ServiceLocatorManagement.h
+++ b/src/ServiceLocatorManagement.h
@@ -54,6 +54,11 @@ private:
 };
 
 /**
+ * A typedef which creates a smart pointer type for ServiceManagementImpl.
+ */
+typedef IceUtil::Handle<ServiceManagementImpl> ServiceManagementImplPtr;
+
+/**
  * Implementation of the ServiceLocatorManagement interface as defined in service_locator.ice
  */
 class ServiceLocatorManagementImpl : public Hydra::Location::ServiceLocatorManagement
@@ -67,7 +72,7 @@ ServiceLocatorManagementImpl(Ice::ObjectAdapterPtr adapter, const Hydra::Locatio
 	void addCompare(const std::string&, const Hydra::Location::ServiceLocatorParamsComparePrx&, const Ice::Current&);
 	void removeCompare(const std::string&, const Ice::Current&);
 	bool isSupported(const std::string&, const Hydra::Location::ServiceLocatorParamsPtr&);
-	void removeService(ServiceManagementImpl*);
+	void removeService(ServiceManagementImplPtr);
 private:
 	/**
 	 * Object adapter that our service management proxies originate from, it is houses the
@@ -84,7 +89,7 @@ private:
 	/**
 	 * A vector of all the services that have been added.
 	 */
-	std::vector<ServiceManagementImpl*> mServices;
+	std::vector<ServiceManagementImplPtr> mServices;
 
 	/**
 	 * A proxy that can be used to publish locator events.

commit cd90308f808862eabe68c6563cd87589f43bb2fc
Author: Joshua Colp <jcolp at digium.com>
Date:   Sat Jul 31 19:15:39 2010 -0300

    Constify and pass by reference a few things.

diff --git a/src/ServiceLocatorManagement.h b/src/ServiceLocatorManagement.h
index 26882a8..8abe7ff 100644
--- a/src/ServiceLocatorManagement.h
+++ b/src/ServiceLocatorManagement.h
@@ -36,7 +36,7 @@ public:
 	 *
 	 * @param compare A proxy to the comparator service we are wrapping.
 	 */
-        ServiceLocatorComparator(Hydra::Location::ServiceLocatorParamsComparePrx compare) : mCompare(compare) { };
+        ServiceLocatorComparator(const Hydra::Location::ServiceLocatorParamsComparePrx& compare) : mCompare(compare) { };
 
 	/**
 	 * API call which forwards an isSupported over ICE to a remote comparator.
@@ -59,8 +59,8 @@ private:
 class ServiceLocatorManagementImpl : public Hydra::Location::ServiceLocatorManagement
 {
 public:
-ServiceLocatorManagementImpl(Ice::ObjectAdapterPtr adapter, Hydra::Location::EventsPrx service_discovery_topic)
-		: mAdapter(adapter), mLocatorTopic(service_discovery_topic) { };
+ServiceLocatorManagementImpl(Ice::ObjectAdapterPtr adapter, const Hydra::Location::EventsPrx& service_discovery_topic)
+	: mAdapter(adapter), mLocatorTopic(service_discovery_topic) { };
 	Ice::ObjectPrx locate(const Hydra::Location::ServiceLocatorParamsPtr&);
 	Ice::ObjectProxySeq locateAll(const Hydra::Location::ServiceLocatorParamsPtr&);
 	Hydra::Location::ServiceManagementPrx addService(const Ice::ObjectPrx&, const std::string&, const Ice::Current&);
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index 8f044cd..c6862d7 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -32,8 +32,8 @@ using namespace Hydra::Location;
  * Constructor for the ServiceManagementImpl class. This adds itself to the object adapter so the service can perform some management and
  * also sends out an event for those that are listening.
  */
-ServiceManagementImpl::ServiceManagementImpl(ServiceLocatorManagementImpl* management, Ice::ObjectPrx service, Ice::ObjectAdapterPtr adapter,
-					     EventsPrx service_discovery_topic, const string& guid)
+ServiceManagementImpl::ServiceManagementImpl(ServiceLocatorManagementImpl* management, const Ice::ObjectPrx& service, Ice::ObjectAdapterPtr adapter,
+					     const EventsPrx& service_discovery_topic, const string& guid)
 	: mSuspended(false), mManagement(management), mService(service), mAdapter(adapter), mLocatorTopic(service_discovery_topic), mGuid(guid)
 {
 	mManagementPrx = ServiceManagementPrx::uncheckedCast(mAdapter->addWithUUID(this));
diff --git a/src/ServiceManagement.h b/src/ServiceManagement.h
index ed6882f..237e5ec 100644
--- a/src/ServiceManagement.h
+++ b/src/ServiceManagement.h
@@ -52,7 +52,7 @@ private:
 class ServiceManagementImpl : public Hydra::Location::ServiceManagement
 {
 public:
-        ServiceManagementImpl(ServiceLocatorManagementImpl*, Ice::ObjectPrx, Ice::ObjectAdapterPtr, Hydra::Location::EventsPrx, const std::string&);
+        ServiceManagementImpl(ServiceLocatorManagementImpl*, const Ice::ObjectPrx&, Ice::ObjectAdapterPtr, const Hydra::Location::EventsPrx&, const std::string&);
 	void addLocatorParams(const Hydra::Location::ServiceLocatorParamsPtr&, const std::string&, const Ice::Current&);
 	void suspend(const Ice::Current&);
 	void unsuspend(const Ice::Current&);

commit c8b0748317338bd45c914a4aef1f39834602849d
Author: Joshua Colp <jcolp at digium.com>
Date:   Sat Jul 31 19:06:18 2010 -0300

    Use the default topic that is defined in the slice definition.

diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index 11b7c09..41925c1 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -104,7 +104,7 @@ int ServiceLocatorApp::run(int argc, char* argv[])
 	string topicName = props->getProperty("ServiceLocator.TopicName");
 
 	if (topicName.empty()) {
-		topicName = "::hydra::service::discovery";
+		topicName = TOPIC;
 	}
 
 	IceStorm::TopicPrx topic;

commit 29e7aa8780a3cec4fd11c2545eccbbb88247d382
Author: Joshua Colp <jcolp at digium.com>
Date:   Sat Jul 31 19:05:32 2010 -0300

    No need for this to be global!

diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index c1ac0a1..11b7c09 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -57,13 +57,12 @@ private:
 	ServiceLocatorManagementImpl* mLocatorServiceManagement;
 };
 
-static ServiceLocatorApp app;
-
 /**
  * Main entry point for our service locator application.
  */
 int main(int argc, char* argv[])
 {
+	ServiceLocatorApp app;
 	app.callbackOnInterrupt();
 	return app.main(argc, argv);
 }

commit ff01bef696ddbb2d0a5b3a2cdecf21bdb6057f4f
Author: Joshua Colp <jcolp at digium.com>
Date:   Sat Jul 31 19:02:38 2010 -0300

    Be gone voids!

diff --git a/src/ServiceManagement.h b/src/ServiceManagement.h
index b8e36f3..ed6882f 100644
--- a/src/ServiceManagement.h
+++ b/src/ServiceManagement.h
@@ -61,12 +61,12 @@ public:
 	/**
 	 * Function which returns the remote proxy to this service.
 	 */
-	Ice::ObjectPrx GetService(void) { return mService; };
+	Ice::ObjectPrx GetService() { return mService; };
 
 	/**
 	 * Function which returns a local proxy to this service's management interface.
 	 */
-	Hydra::Location::ServiceManagementPrx GetServiceManagementPrx(void) { return mManagementPrx; };
+	Hydra::Location::ServiceManagementPrx GetServiceManagementPrx() { return mManagementPrx; };
 
 	bool isSupported(const Hydra::Location::ServiceLocatorParamsPtr&);
 private:

commit c0149991120e8d20e2a3ffc4eb80561898bdb334
Author: Joshua Colp <jcolp at digium.com>
Date:   Sat Jul 31 19:01:19 2010 -0300

    Move the usage of using to after including headers.

diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index ac5aa2e..c1ac0a1 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -22,12 +22,12 @@
 #include "service_locator.h"
 #include "service_locator_events.h"
 
-using namespace std;
-using namespace Hydra::Location;
-
 #include "ServiceLocatorManagement.h"
 #include "ServiceManagement.h"
 
+using namespace std;
+using namespace Hydra::Location;
+
 /**
  * Implementation of the Ice::Application class
  */
diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index 757bdab..b83956d 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -22,12 +22,12 @@
 #include "service_locator.h"
 #include "service_locator_events.h"
 
-using namespace std;
-using namespace Hydra::Location;
-
 #include "ServiceLocatorManagement.h"
 #include "ServiceManagement.h"
 
+using namespace std;
+using namespace Hydra::Location;
+
 /**
  * Implementation of the locate method as defined in service_locator.ice
  */
diff --git a/src/ServiceLocatorManagement.h b/src/ServiceLocatorManagement.h
index bf5f57d..26882a8 100644
--- a/src/ServiceLocatorManagement.h
+++ b/src/ServiceLocatorManagement.h
@@ -36,7 +36,7 @@ public:
 	 *
 	 * @param compare A proxy to the comparator service we are wrapping.
 	 */
-        ServiceLocatorComparator(ServiceLocatorParamsComparePrx compare) : mCompare(compare) { };
+        ServiceLocatorComparator(Hydra::Location::ServiceLocatorParamsComparePrx compare) : mCompare(compare) { };
 
 	/**
 	 * API call which forwards an isSupported over ICE to a remote comparator.
@@ -45,28 +45,28 @@ public:
 	 *
 	 * @return A boolean value with true indicating the parameters are supported while false indicates otherwise.
 	 */
-	bool isSupported(const ServiceLocatorParamsPtr& params) { return mCompare->isSupported(params); };
+	bool isSupported(const Hydra::Location::ServiceLocatorParamsPtr& params) { return mCompare->isSupported(params); };
 private:
 	/**
 	 * A proxy to the comparator service that we are wrapping.
 	 */
-	ServiceLocatorParamsComparePrx mCompare;
+	Hydra::Location::ServiceLocatorParamsComparePrx mCompare;
 };
 
 /**
  * Implementation of the ServiceLocatorManagement interface as defined in service_locator.ice
  */
-class ServiceLocatorManagementImpl : public ServiceLocatorManagement
+class ServiceLocatorManagementImpl : public Hydra::Location::ServiceLocatorManagement
 {
 public:
-        ServiceLocatorManagementImpl(Ice::ObjectAdapterPtr adapter, EventsPrx service_discovery_topic)
+ServiceLocatorManagementImpl(Ice::ObjectAdapterPtr adapter, Hydra::Location::EventsPrx service_discovery_topic)
 		: mAdapter(adapter), mLocatorTopic(service_discovery_topic) { };
-	Ice::ObjectPrx locate(const ServiceLocatorParamsPtr&);
-	Ice::ObjectProxySeq locateAll(const ServiceLocatorParamsPtr&);
-	ServiceManagementPrx addService(const Ice::ObjectPrx&, const std::string&, const Ice::Current&);
-	void addCompare(const std::string&, const ServiceLocatorParamsComparePrx&, const Ice::Current&);
+	Ice::ObjectPrx locate(const Hydra::Location::ServiceLocatorParamsPtr&);
+	Ice::ObjectProxySeq locateAll(const Hydra::Location::ServiceLocatorParamsPtr&);
+	Hydra::Location::ServiceManagementPrx addService(const Ice::ObjectPrx&, const std::string&, const Ice::Current&);
+	void addCompare(const std::string&, const Hydra::Location::ServiceLocatorParamsComparePrx&, const Ice::Current&);
 	void removeCompare(const std::string&, const Ice::Current&);
-	bool isSupported(const std::string&, const ServiceLocatorParamsPtr&);
+	bool isSupported(const std::string&, const Hydra::Location::ServiceLocatorParamsPtr&);
 	void removeService(ServiceManagementImpl*);
 private:
 	/**
@@ -89,7 +89,7 @@ private:
 	/**
 	 * A proxy that can be used to publish locator events.
 	 */
-	EventsPrx mLocatorTopic;
+	Hydra::Location::EventsPrx mLocatorTopic;
 };
 
 #endif
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index a940069..8f044cd 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -22,12 +22,12 @@
 #include "service_locator.h"
 #include "service_locator_events.h"
 
-using namespace std;
-using namespace Hydra::Location;
-
 #include "ServiceLocatorManagement.h"
 #include "ServiceManagement.h"
 
+using namespace std;
+using namespace Hydra::Location;
+
 /**
  * Constructor for the ServiceManagementImpl class. This adds itself to the object adapter so the service can perform some management and
  * also sends out an event for those that are listening.
diff --git a/src/ServiceManagement.h b/src/ServiceManagement.h
index baa8402..b8e36f3 100644
--- a/src/ServiceManagement.h
+++ b/src/ServiceManagement.h
@@ -25,14 +25,14 @@
  */
 class ServiceLocatorParamsSpec {
 public:
-ServiceLocatorParamsSpec(const ServiceLocatorParamsPtr& params, const std::string& compare_guid, ServiceLocatorManagementImpl* management)
+ServiceLocatorParamsSpec(const Hydra::Location::ServiceLocatorParamsPtr& params, const std::string& compare_guid, ServiceLocatorManagementImpl* management)
 		: mParams(params), mCompareGuid(compare_guid), mManagement(management) { };
-	bool isSupported(const ServiceLocatorParamsPtr&);
+	bool isSupported(const Hydra::Location::ServiceLocatorParamsPtr&);
 private:
 	/**
 	 * A pointer to a parameters structure which describes what is supported.
 	 */
-	ServiceLocatorParamsPtr mParams;
+	Hydra::Location::ServiceLocatorParamsPtr mParams;
 
 	/**
 	 * A string containing the comparator uuid that should be used when comparing the parameters
@@ -49,11 +49,11 @@ private:
 /**
  * An implementation of the ServiceManagement interface as defined in service_locator.ice
  */
-class ServiceManagementImpl : public ServiceManagement
+class ServiceManagementImpl : public Hydra::Location::ServiceManagement
 {
 public:
-        ServiceManagementImpl(ServiceLocatorManagementImpl*, Ice::ObjectPrx, Ice::ObjectAdapterPtr, EventsPrx, const std::string&);
-	void addLocatorParams(const ServiceLocatorParamsPtr&, const std::string&, const Ice::Current&);
+        ServiceManagementImpl(ServiceLocatorManagementImpl*, Ice::ObjectPrx, Ice::ObjectAdapterPtr, Hydra::Location::EventsPrx, const std::string&);
+	void addLocatorParams(const Hydra::Location::ServiceLocatorParamsPtr&, const std::string&, const Ice::Current&);
 	void suspend(const Ice::Current&);
 	void unsuspend(const Ice::Current&);
 	void unregister(const Ice::Current&);
@@ -66,9 +66,9 @@ public:
 	/**
 	 * Function which returns a local proxy to this service's management interface.
 	 */
-	ServiceManagementPrx GetServiceManagementPrx(void) { return mManagementPrx; };
+	Hydra::Location::ServiceManagementPrx GetServiceManagementPrx(void) { return mManagementPrx; };
 
-	bool isSupported(const ServiceLocatorParamsPtr&);
+	bool isSupported(const Hydra::Location::ServiceLocatorParamsPtr&);
 private:
 	/**
 	 * A boolean value which is used to store the suspended state of this service.
@@ -93,7 +93,7 @@ private:
 	/**
 	 * A local proxy to this management service.
 	 */
-	ServiceManagementPrx mManagementPrx;
+	Hydra::Location::ServiceManagementPrx mManagementPrx;
 
 	/**
 	 * A vector of locator parameters that this service supports.
@@ -103,7 +103,7 @@ private:
 	/**
 	 * A proxy that can be used to publish events to the service locator topic.
 	 */
-	EventsPrx mLocatorTopic;
+	Hydra::Location::EventsPrx mLocatorTopic;
 
 	/**
 	 * A string which contains a unique identifier for this service. This is used

commit 04e9bf7bd8b5fe99c67e285a599f89589858cc47
Author: Joshua Colp <jcolp at digium.com>
Date:   Sat Jul 31 18:53:55 2010 -0300

    Remove redundant declarations.

diff --git a/src/ServiceLocator.cpp b/src/ServiceLocator.cpp
index cef6971..ac5aa2e 100644
--- a/src/ServiceLocator.cpp
+++ b/src/ServiceLocator.cpp
@@ -34,8 +34,8 @@ using namespace Hydra::Location;
 class ServiceLocatorApp : public Ice::Application
 {
 public:
-	virtual int run(int, char*[]);
-	virtual void interruptCallback(int);
+	int run(int, char*[]);
+	void interruptCallback(int);
 
 private:
 };
diff --git a/src/ServiceLocatorManagement.cpp b/src/ServiceLocatorManagement.cpp
index bab5edb..757bdab 100644
--- a/src/ServiceLocatorManagement.cpp
+++ b/src/ServiceLocatorManagement.cpp
@@ -33,8 +33,6 @@ using namespace Hydra::Location;
  */
 Ice::ObjectPrx ServiceLocatorManagementImpl::locate(const ServiceLocatorParamsPtr& params)
 {
-	vector<ServiceManagementImpl*>::iterator service;
-
 	for (vector<ServiceManagementImpl*>::iterator service = mServices.begin(); service != mServices.end(); ++service) {
 		if ((*service)->isSupported(params) == true) {
 			return (*service)->GetService();
@@ -50,7 +48,6 @@ Ice::ObjectPrx ServiceLocatorManagementImpl::locate(const ServiceLocatorParamsPt
 Ice::ObjectProxySeq ServiceLocatorManagementImpl::locateAll(const ServiceLocatorParamsPtr& params)
 {
 	Ice::ObjectProxySeq applicable_services;
-	vector<ServiceManagementImpl*>::iterator service;
 
 	for (vector<ServiceManagementImpl*>::iterator service = mServices.begin(); service != mServices.end(); ++service) {
 		if ((*service)->isSupported(params) == true) {
@@ -127,7 +124,6 @@ bool ServiceLocatorManagementImpl::isSupported(const string& compare_guid, const
  */
 void ServiceLocatorManagementImpl::removeService(ServiceManagementImpl* service)
 {
-	vector<ServiceManagementImpl*>::iterator existing_service;
 	for (vector<ServiceManagementImpl*>::iterator existing_service = mServices.begin(); existing_service != mServices.end(); ++existing_service) {
 		if ((*existing_service) == service) {
 			mServices.erase(existing_service);
diff --git a/src/ServiceManagement.cpp b/src/ServiceManagement.cpp
index 7e92651..a940069 100644
--- a/src/ServiceManagement.cpp
+++ b/src/ServiceManagement.cpp
@@ -57,8 +57,6 @@ bool ServiceManagementImpl::isSupported(const ServiceLocatorParamsPtr& params)
 		return false;
 	}
 
-	vector<ServiceLocatorParamsSpec>::iterator spec;
-
 	for (vector<ServiceLocatorParamsSpec>::iterator spec = mSupportedLocatorParams.begin(); spec != mSupportedLocatorParams.end(); ++spec) {
 		if ((*spec).isSupported(params) == true) {
 			return true;

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


-- 
hydra/servicediscovery.git




More information about the asterisk-scf-commits mailing list