[Saga-devel] saga SVN commit 3296: /trunk/saga/saga/packages/sd/

paul.livesey at stfc.ac.uk paul.livesey at stfc.ac.uk
Thu Jan 15 07:03:54 CST 2009


User: svn_plivesey
Date: 2009/01/15 07:03 AM

Modified:
 /trunk/saga/saga/packages/sd/
  discoverer.cpp, discoverer.hpp, service_description.cpp, service_description.hpp

Log:
 Added exception specification to most methods.

File Changes:

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

File [modified]: discoverer.cpp
Delta lines: +27 -5
===================================================================
--- trunk/saga/saga/packages/sd/discoverer.cpp	2009-01-15 12:54:46 UTC (rev 3295)
+++ trunk/saga/saga/packages/sd/discoverer.cpp	2009-01-15 13:03:44 UTC (rev 3296)
@@ -5,31 +5,53 @@
 #include <saga/saga/sd.hpp>
 #include <saga/impl/sd.hpp>
 #include <saga/saga/detail/call.hpp>
+#include <saga/saga/exception.hpp>
 
 ///@cond
 namespace saga
 {
   namespace sd {
-    discoverer::discoverer (session const &s) 
-      : saga::object(new saga::impl::discoverer (s))
+    discoverer::discoverer (session const &s)
+       throw(saga::not_implemented,
+             saga::incorrect_url,
+             saga::does_not_exist,
+             saga::authorization_failed,
+             saga::authentication_failed,
+             saga::timeout,
+             saga::no_success)
+       : saga::object(new saga::impl::discoverer (s))
     {
          this->saga::object::get_impl()->init();
     }
 
     discoverer::discoverer (saga::impl::discoverer* impl) 
-      : saga::object(impl)
+       throw(saga::not_implemented,
+             saga::incorrect_url,
+             saga::does_not_exist,
+             saga::authorization_failed,
+             saga::authentication_failed,
+             saga::timeout,
+             saga::no_success)
+       : saga::object(impl)
     {
     }
 
     discoverer::discoverer(void)
+       throw(saga::not_implemented,
+             saga::incorrect_url,
+             saga::does_not_exist,
+             saga::authorization_failed,
+             saga::authentication_failed,
+             saga::timeout,
+             saga::no_success)
     {
     }
 
-    discoverer::~discoverer(void)
+    discoverer::~discoverer(void) throw()
     {
     }
 
-    discoverer &discoverer::operator= (saga::object const& o)
+    discoverer &discoverer::operator= (saga::object const& o) throw()
     {
         if (this != &o)
            this->saga::object::operator=(o);

File [modified]: discoverer.hpp
Delta lines: +43 -7
===================================================================
--- trunk/saga/saga/packages/sd/discoverer.hpp	2009-01-15 12:54:46 UTC (rev 3295)
+++ trunk/saga/saga/packages/sd/discoverer.hpp	2009-01-15 13:03:44 UTC (rev 3296)
@@ -8,6 +8,7 @@
 #include <saga/saga/types.hpp>
 #include <saga/saga/session.hpp>
 #include <saga/saga/call.hpp> 
+#include <saga/saga/exception.hpp>
 
 #include <saga/saga/packages/sd/config.hpp>
 #include <saga/saga/packages/sd/service_description.hpp>
@@ -34,25 +35,53 @@
    protected:
       TR1::shared_ptr <saga::impl::discoverer> get_impl (void) const;
       friend class saga::impl::discoverer;
-      explicit discoverer(saga::impl::discoverer* impl);
+      explicit discoverer(saga::impl::discoverer* impl)
+         throw(saga::not_implemented,
+               saga::incorrect_url,
+               saga::does_not_exist,
+               saga::authorization_failed,
+               saga::authentication_failed,
+               saga::timeout,
+               saga::no_success);
 
    public:
-      discoverer();
-      explicit discoverer(session const& s);
+      discoverer() throw(saga::not_implemented,
+                         saga::incorrect_url,
+                         saga::does_not_exist,
+                         saga::authorization_failed,
+                         saga::authentication_failed,
+                         saga::timeout,
+                         saga::no_success);
+
+      explicit discoverer(session const& s) throw(saga::not_implemented,
+                                                  saga::incorrect_url,
+                                                  saga::does_not_exist,
+                                                  saga::authorization_failed,
+                                                  saga::authentication_failed,
+                                                  saga::timeout,
+                                                  saga::no_success);
+
       // explicit discoverer(saga::object const& o); // is this ctor necessary?
-      ~discoverer (void);
+      ~discoverer (void) throw();
 
       /*! \brief Factory function resembling discoverer(session) 
        *         constructor
        */
       static discoverer create(session const& s)
+         throw(saga::not_implemented,
+               saga::incorrect_url,
+               saga::does_not_exist,
+               saga::authorization_failed,
+               saga::authentication_failed,
+               saga::timeout,
+               saga::no_success)
       {
           return discoverer(s);
       }
       SAGA_CALL_CREATE_1_DEF_0(session const&);
 
       // default operator=() and copy ctor
-      discoverer& operator= (saga::object const& o);
+      discoverer& operator= (saga::object const& o) throw();
 
       // public methods for the service discoverer
 
@@ -62,8 +91,15 @@
         * \param data_filter SQL expression using service data key/value pairs
         *
       */
-      std::vector<saga::sd::service_description> list_services(std::string svc_filter, 
-                       std::string vo_filter, std::string data_filter)
+      std::vector<saga::sd::service_description>
+         list_services(std::string svc_filter, 
+                       std::string vo_filter,
+                       std::string data_filter)
+            throw(saga::bad_parameter,
+                  saga::authorization_failed,
+                  saga::authentication_failed,
+                  saga::timeout,
+                  saga::no_success)
       {
          saga::task t = list_servicespriv(svc_filter, vo_filter, data_filter, 
                                                     saga::task_base::Sync());

File [modified]: service_description.cpp
Delta lines: +29 -8
===================================================================
--- trunk/saga/saga/packages/sd/service_description.cpp	2009-01-15 12:54:46 UTC (rev 3295)
+++ trunk/saga/saga/packages/sd/service_description.cpp	2009-01-15 13:03:44 UTC (rev 3296)
@@ -10,6 +10,7 @@
 
 #include <saga/saga/sd.hpp>
 #include <saga/impl/sd.hpp>
+#include <saga/saga/exception.hpp>
 
 #include <saga/saga/detail/attribute_impl.hpp>
 
@@ -46,12 +47,15 @@
               (attributes::service_description_uid, "")
               (attributes::service_description_site, "")
               (attributes::service_description_name, "")
-              (attributes::service_description_relatedservices, "")
-              (attributes::service_description_vo, "")
           ;
 
+      strmap_type attributes_vector_rw;
+      insert(attributes_vector_rw)
+              (attributes::service_description_relatedservices, "")
+              (attributes::service_description_vo, "");
+
       //initialize attribute implementation
-      this->init(strmap_type(), attributes_scalar_rw);
+      this->init(strmap_type(), attributes_scalar_rw, strmap_type(), attributes_vector_rw);
       this->init(false, true); // not extensible and cache only implementation
 
       data_flag = false; // the data is not populated, initially;
@@ -66,7 +70,7 @@
      //std::cout << "SC2: Uid = " << this->get_id().string() << " Type = " << this->get_type() << std::endl;
   }
 
-  service_description::~service_description (void)
+  service_description::~service_description (void) throw()
   {
      //std::cout << "Just before dereferencing:" << this->get_impl() << std::endl;
      //std::cout << this->get_id().string() << " Destructor" << std::endl;
@@ -83,12 +87,13 @@
   }
 
   service_description &service_description::operator= (saga::object const& o)
+     throw()
   {
       return saga::object::operator=(o), *this;
   }
 
   /////////////////////////////////////////////////////////////////////////////
-  std::string service_description::get_url()
+  std::string service_description::get_url() throw()
   {
      if (!this->attribute_exists(attributes::service_description_url)) 
      {
@@ -97,7 +102,7 @@
      return this->get_attribute(attributes::service_description_url);
   }
 
-  saga::sd::service_data &service_description::get_data()
+  saga::sd::service_data &service_description::get_data() throw()
   {
      if (!data_flag) // if the data is not already read
      {
@@ -108,7 +113,12 @@
      return data;
   }
 
-  std::vector<saga::sd::service_description> service_description::get_related_services()
+  std::vector<saga::sd::service_description>
+     service_description::get_related_services()
+        throw(saga::authorization_failed,
+              saga::authentication_failed,
+              saga::timeout,
+              saga::no_success)
   {
      std::vector<saga::sd::service_description> rsvc_list;
      
@@ -148,7 +158,18 @@
 
   void service_description::set_data(std::string data_key, std::string data_value)
   {
-      data.set_attribute(data_key, data_value);
+      std::vector<std::string> attVec;
+
+      //All data attributes are stored as vector attributes
+      //so if the one we're trying to set exists
+      //just append to the end of it
+      if ( data.attribute_exists(data_key) )
+      {
+         attVec = data.get_vector_attribute(data_key);
+      }
+
+      attVec.push_back(data_value);
+      data.set_vector_attribute(data_key, attVec);
   }
 
   void service_description::set_data_flag(bool df)

File [modified]: service_description.hpp
Delta lines: +10 -5
===================================================================
--- trunk/saga/saga/packages/sd/service_description.hpp	2009-01-15 12:54:46 UTC (rev 3295)
+++ trunk/saga/saga/packages/sd/service_description.hpp	2009-01-15 13:03:44 UTC (rev 3296)
@@ -8,6 +8,7 @@
 #include <saga/saga/session.hpp>
 #include <saga/saga/call.hpp>
 #include <saga/saga/detail/attribute.hpp>
+#include <saga/saga/exception.hpp>
 
 #include <saga/saga/packages/sd/config.hpp>
 
@@ -79,17 +80,21 @@
        service_description (void); 
        explicit service_description (saga::object const& o);
 
-      ~service_description (void);
+      ~service_description (void) throw();
 
       // default operator=() and copy ctor are ok
-      service_description &operator= (saga::object const& o);
+      service_description &operator= (saga::object const& o) throw();
 
       // special getters 
-      std::string get_url();
+      std::string get_url() throw();
 
-      std::vector<saga::sd::service_description> get_related_services();
+      std::vector<saga::sd::service_description> get_related_services()
+         throw(saga::authorization_failed,
+               saga::authentication_failed,
+               saga::timeout,
+               saga::no_success);
 
-      saga::sd::service_data &get_data();
+      saga::sd::service_data &get_data() throw();
   }; // service_description
  } // namespace sd
 } // namespace saga



More information about the saga-devel mailing list