[Saga-devel] saga SVN commit 3400: /trunk/saga/

paul.livesey at stfc.ac.uk paul.livesey at stfc.ac.uk
Thu Jan 29 06:54:10 CST 2009


User: svn_plivesey
Date: 2009/01/29 06:54 AM

Modified:
 /trunk/saga/impl/packages/sd/
  discoverer.cpp, discoverer.hpp, discoverer_serialization.cpp
 /trunk/saga/saga/adaptors/packages/
  discoverer_cpi_instance_data.hpp
 /trunk/saga/saga/packages/sd/
  discoverer.cpp, discoverer.hpp

Log:
 Service Discovery class can now take an optional saga::url in its constructors.
 This can be used as the location for the information provider.
 
 Added this saga::url to discoverer_cpi_instance_data.hpp and
 updated serialize/deserialize to suit.

File Changes:

Directory: /trunk/saga/saga/adaptors/packages/
==============================================

File [modified]: discoverer_cpi_instance_data.hpp
Delta lines: +10 -5
===================================================================
--- trunk/saga/saga/adaptors/packages/discoverer_cpi_instance_data.hpp	2009-01-28 23:36:56 UTC (rev 3399)
+++ trunk/saga/saga/adaptors/packages/discoverer_cpi_instance_data.hpp	2009-01-29 12:53:50 UTC (rev 3400)
@@ -13,14 +13,19 @@
 namespace saga { namespace adaptors { namespace v1_0
 {
 
-    struct discoverer_cpi_instance_data 
+   struct discoverer_cpi_instance_data 
       : public adaptors::instance_data_base
-    {
-        // TODO: decide what instance data for discoverer
-        discoverer_cpi_instance_data ()
+   {
+      //Location of information provider
+      saga::url location_;
+
+        // TODO: decide what other instance data
+        // is required for discoverer
+        discoverer_cpi_instance_data (saga::url location)
+           : location_(location)
         {
         }
-    };
+   };
 
 }}}   // namespace saga::adaptors::v1_0
       

Directory: /trunk/saga/impl/packages/sd/
========================================

File [modified]: discoverer.cpp
Delta lines: +7 -5
===================================================================
--- trunk/saga/impl/packages/sd/discoverer.cpp	2009-01-28 23:36:56 UTC (rev 3399)
+++ trunk/saga/impl/packages/sd/discoverer.cpp	2009-01-29 12:53:50 UTC (rev 3400)
@@ -7,7 +7,7 @@
 {
   namespace impl
   {
-    discoverer::discoverer (saga::session const& s)
+    discoverer::discoverer (saga::session const& s, saga::url loc)
        : proxy (saga::object::ServiceDiscoverer, s)
     {
        // initialize the instance data
@@ -16,8 +16,9 @@
        
        {
            discoverer_instance_data data;
-           data.init_data (this, TR1::shared_ptr <instance_data_type> (
-              new instance_data_type () )); // anything to pass to instance_data_type ?
+           // anything to pass to instance_data_type ?
+           data.init_data(this, TR1::shared_ptr <instance_data_type>
+                                (new instance_data_type(loc)));
        }  
     }
 
@@ -45,9 +46,10 @@
         retval = saga::sd::discoverer(this);
     }
 
-    saga::task discoverer::create_impl_async(saga::session const& s)
+    saga::task discoverer::create_impl_async(saga::session const& s,
+                                             saga::url const& loc)
     {
-        TR1::shared_ptr<discoverer> impl(new discoverer(s));
+        TR1::shared_ptr<discoverer> impl(new discoverer(s, loc));
 
         bool (discoverer::*prep)(saga::sd::discoverer&, saga::uuid) = NULL;
         return saga::adaptors::task("__init__", TR1::shared_ptr<v1_0::cpi>(), 

File [modified]: discoverer.hpp
Delta lines: +3 -2
===================================================================
--- trunk/saga/impl/packages/sd/discoverer.hpp	2009-01-28 23:36:56 UTC (rev 3399)
+++ trunk/saga/impl/packages/sd/discoverer.hpp	2009-01-29 12:53:50 UTC (rev 3400)
@@ -24,12 +24,13 @@
       void init();
 
       public:
-       discoverer (saga::session const & s);
+       discoverer (saga::session const & s, saga::url loc);
        ~discoverer (void);
 
       // factory support
       void create_impl_sync(saga::sd::discoverer& retval);
-      static saga::task create_impl_async(saga::session const& s);
+      static saga::task create_impl_async(saga::session const& s,
+                                          saga::url const& loc);
 
        SAGA_CALL_IMPL_DECL_2 (list_services2,
                               std::string, std::string)

File [modified]: discoverer_serialization.cpp
Delta lines: +6 -2
===================================================================
--- trunk/saga/impl/packages/sd/discoverer_serialization.cpp	2009-01-28 23:36:56 UTC (rev 3399)
+++ trunk/saga/impl/packages/sd/discoverer_serialization.cpp	2009-01-29 12:53:50 UTC (rev 3400)
@@ -132,7 +132,9 @@
                     instance_data;
 
                 saga::adaptors::instance_data<instance_data> data(proxy);
-                // nothing to serialize
+                std::string loc(data->location_.get_url());
+                //Serialize the location
+                oa << make_nvp("location", loc);
             }
             else if (saga::object::ServiceDescription == type) {
             // saga::object::ServiceDescription == type: serialize the attributes
@@ -179,9 +181,11 @@
         if (saga::object::ServiceDiscoverer == type) {
         // saga::object::ServiceDiscoverer == type: deserialize the 
         // discoverer_cpi_instance_data data
+           std::string loc;
 
+           ia >> make_nvp("location", loc);
             // nothing to deserialize 
-            impl.reset(new saga::impl::discoverer(s));
+            impl.reset(new saga::impl::discoverer(s, loc));
         }
         else if (saga::object::ServiceDescription == type) {
         // saga::object::ServiceDescription == type: deserialize the attributes

Directory: /trunk/saga/saga/packages/sd/
========================================

File [modified]: discoverer.cpp
Delta lines: +9 -4
===================================================================
--- trunk/saga/saga/packages/sd/discoverer.cpp	2009-01-28 23:36:56 UTC (rev 3399)
+++ trunk/saga/saga/packages/sd/discoverer.cpp	2009-01-29 12:53:50 UTC (rev 3400)
@@ -11,10 +11,10 @@
 namespace saga
 {
   namespace sd {
-    discoverer::discoverer (session const &s)
+    discoverer::discoverer (session const &s, saga::url loc)
        throw(saga::not_implemented,
              saga::no_success)
-       : saga::object(new saga::impl::discoverer (s))
+       : saga::object(new saga::impl::discoverer(s, loc))
     {
          this->saga::object::get_impl()->init();
     }
@@ -26,10 +26,12 @@
     {
     }
 
-    discoverer::discoverer(void)
+    discoverer::discoverer(saga::url loc)
        throw(saga::not_implemented,
              saga::no_success)
+       : saga::object(new saga::impl::discoverer(saga::detail::get_the_session(), loc))
     {
+       this->saga::object::get_impl()->init();
     }
 
     discoverer::~discoverer(void) throw()
@@ -51,7 +53,10 @@
     }
 
     // factory
-    SAGA_CALL_CREATE_IMP_1(discoverer, impl::discoverer, session const&)
+    SAGA_CALL_CREATE_IMP_2(discoverer,
+                           impl::discoverer,
+                           session const&,
+                           saga::url)
 
     // methods for service discoverer
     SAGA_CALL_IMP_2_EX (discoverer, list_services, list_services2, std::string, std::string)

File [modified]: discoverer.hpp
Delta lines: +45 -12
===================================================================
--- trunk/saga/saga/packages/sd/discoverer.hpp	2009-01-28 23:36:56 UTC (rev 3399)
+++ trunk/saga/saga/packages/sd/discoverer.hpp	2009-01-29 12:53:50 UTC (rev 3400)
@@ -9,6 +9,7 @@
 #include <saga/saga/session.hpp>
 #include <saga/saga/call.hpp> 
 #include <saga/saga/exception.hpp>
+#include <saga/saga/url.hpp>
 
 #include <saga/saga/packages/sd/config.hpp>
 #include <saga/saga/packages/sd/service_description.hpp>
@@ -182,7 +183,7 @@
 
    private:
       // factory
-      SAGA_CALL_CREATE_PRIV_1(session const&);
+      SAGA_CALL_CREATE_PRIV_2(session const&, saga::url);
 
       SAGA_CALL_PRIV_2 (list_services, std::string, std::string);
       SAGA_CALL_PRIV_3 (list_services, std::string, std::string, std::string);
@@ -198,6 +199,8 @@
     /**
      * Default constructor.  Constructs a discoverer object using a default
      * session.
+     *
+     * @param loc      URL to use.
      * 
      * @throws not_implemented
      *                 if the discoverer class is not implemented
@@ -206,16 +209,18 @@
      *                 if no result can be returned because of
      *                 information system or other internal problems.
      */
-      discoverer() throw(saga::not_implemented,
-                         saga::no_success);
+      discoverer(saga::url loc = saga::url())
+         throw(saga::not_implemented,
+               saga::no_success);
 
     /**
      * Constructor.  Constructs a discoverer object using the given
      * session.
      * 
-     * @param s
-     *                Session to use.
+     * @param s        Session to use.
      *
+     * @param loc      URL to use.
+     *
      * @throws not_implemented
      *                 if the discoverer class is not implemented
      *                 by the SAGA implementation at all.
@@ -223,8 +228,9 @@
      *                 if no result can be returned because of
      *                 information system or other internal problems.
      */
-      explicit discoverer(session const& s) throw(saga::not_implemented,
-                                                  saga::no_success);
+      explicit discoverer(session const& s, saga::url loc = saga::url())
+         throw(saga::not_implemented,
+               saga::no_success);
 
       // explicit discoverer(saga::object const& o); // is this ctor necessary?
     /**
@@ -236,9 +242,10 @@
      * discoverer factory.  Constructs a discoverer object using
      * the given session.
      * 
-     * @param s
-     *                Session to use.
+     * @param s        Session to use.
      *
+     * @param loc      URL to use.
+     *
      * @throws not_implemented
      *                 if the discoverer class is not implemented
      *                 by the SAGA implementation at all.
@@ -246,14 +253,40 @@
      *                 if no result can be returned because of
      *                 information system or other internal problems.
      */
-      static discoverer create(session const& s)
+      static discoverer create(session const& s, saga::url loc = saga::url())
          throw(saga::not_implemented,
                saga::no_success)
       {
-          return discoverer(s);
+          return discoverer(s, loc);
       }
-      SAGA_CALL_CREATE_1_DEF_0(session const&);
+      SAGA_CALL_CREATE_2_DEF_1(session const&, saga::url, saga::url());
 
+    /*saga*
+     * discoverer factory.  Constructs a discoverer object using
+     * a default session and the given URL.
+     * 
+     * @param loc      URL to use.
+     *
+     * @throws not_implemented
+     *                 if the discoverer class is not implemented
+     *                 by the SAGA implementation at all.
+     * @throws no_success
+     *                 if no result can be returned because of
+     *                 information system or other internal problems.
+     */
+      static discoverer create(saga::url loc = saga::url())
+         throw(saga::not_implemented,
+               saga::no_success)
+      {
+          return discoverer(loc);
+      }
+
+      template <typename Tag>
+      static saga::task create(saga::url loc = saga::url())
+      {
+         return create<Tag>(saga::detail::get_the_session(), loc);
+      }
+
       // default operator=() and copy ctor
       discoverer& operator= (saga::object const& o) throw();
 



More information about the saga-devel mailing list