SAGA C++ API 1.6
navigator.hpp
Go to the documentation of this file.
00001 //  Copyright (c) 2009 STFC
00002 // 
00003 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
00004 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00005 #ifndef SAGA_PACKAGES_ISN_NAVIGATOR_HPP
00006 #define SAGA_PACKAGES_ISN_NAVIGATOR_HPP
00007 
00008 // include dependent spec sections
00009 #include <saga/saga/util.hpp>
00010 #include <saga/saga/base.hpp>
00011 #include <saga/saga/types.hpp>
00012 #include <saga/saga/session.hpp>
00013 #include <saga/saga/call.hpp> 
00014 #include <saga/saga/exception.hpp>
00015 #include <saga/saga/url.hpp>
00016 
00017 #include <saga/saga/packages/isn/config.hpp>
00018 
00019 #include "entity_types.hpp"
00020 
00021 namespace saga { namespace impl { class navigator; class entity_data_set;} }
00023 namespace saga
00024 {
00025   namespace isn {
00026 
00027   class SAGA_ISN_PACKAGE_EXPORT navigator 
00028        : public saga::object
00029   {
00030 
00031    public:
00032 
00033    private:
00034       // factory
00035       SAGA_CALL_CREATE_PRIV_3(std::string const& model,
00036                               session const&,
00037                               saga::url)
00038 
00039       SAGA_CALL_PRIV_1 (list_related_entity_names, std::string)
00040 
00041       SAGA_CALL_PRIV_4 (get_related_entities,
00042                         std::string,
00043                         std::string,
00044                         std::string,
00045                         std::vector<saga::isn::entity_data>)
00046 
00047       SAGA_CALL_PRIV_2 (get_entities,
00048                         std::string,
00049                         std::string)
00050 
00051    protected:
00052       TR1::shared_ptr <saga::impl::navigator> get_impl_sp (void) const;
00053       saga::impl::navigator* get_impl (void) const;
00054       friend class saga::impl::navigator;
00055       explicit navigator(saga::impl::navigator* impl)
00056          SAGA_THROW_SPEC(throw(saga::not_implemented,
00057                                saga::incorrect_url,
00058                                saga::does_not_exist,
00059                                saga::authorization_failed,
00060                                saga::authentication_failed,
00061                                saga::timeout,
00062                                saga::no_success));
00063 
00064    public:
00065      explicit navigator(std::string const& model = std::string(),
00066                         saga::url loc = saga::url())
00067          SAGA_THROW_SPEC(throw(saga::not_implemented,
00068                                saga::incorrect_url,
00069                                saga::does_not_exist,
00070                                saga::authorization_failed,
00071                                saga::authentication_failed,
00072                                saga::timeout,
00073                                saga::no_success));
00074 
00075       explicit navigator(std::string const& model,
00076                          session const& s,
00077                          saga::url loc = saga::url())
00078          SAGA_THROW_SPEC(throw(saga::not_implemented,
00079                                saga::incorrect_url,
00080                                saga::does_not_exist,
00081                                saga::authorization_failed,
00082                                saga::authentication_failed,
00083                                saga::timeout,
00084                                saga::no_success));
00085 
00086       ~navigator (void) SAGA_THROW_SPEC(throw());
00087 
00088       static navigator create(std::string const& model,
00089                               session const& s,
00090                               saga::url loc = saga::url())
00091          SAGA_THROW_SPEC(throw(saga::not_implemented,
00092                                saga::incorrect_url,
00093                                saga::does_not_exist,
00094                                saga::authorization_failed,
00095                                saga::authentication_failed,
00096                                saga::timeout,
00097                                saga::no_success))
00098       {
00099           return navigator(model, s, loc);
00100       }
00101       SAGA_CALL_CREATE_3_DEF_1(std::string const&,
00102                                session const&,
00103                                saga::url,
00104                                saga::url())
00105 
00106       static navigator create(std::string const& model = std::string(),
00107                               saga::url loc = saga::url())
00108          SAGA_THROW_SPEC(throw(saga::not_implemented,
00109                                saga::incorrect_url,
00110                                saga::not_implemented,
00111                                saga::authorization_failed,
00112                                saga::authentication_failed,
00113                                saga::timeout,
00114                                saga::no_success))
00115       {
00116           return navigator(model, loc);
00117       }
00118 
00119       template <typename Tag>
00120       static saga::task create(std::string const& model = std::string(),
00121                                saga::url loc = saga::url())
00122       {
00123          return create<Tag>(model, saga::detail::get_the_session(), loc);
00124       }
00125 
00126       // default operator=() and copy ctor
00127       navigator& operator= (saga::object const& o) 
00128           SAGA_THROW_SPEC(throw());
00129 
00130       std::vector<std::string>
00131          list_related_entity_names(std::string entityName)
00132             SAGA_THROW_SPEC(throw(saga::bad_parameter,
00133                   saga::authorization_failed,
00134                   saga::authentication_failed,
00135                   saga::timeout,
00136                   saga::no_success))
00137       {
00138          saga::task t = list_related_entity_namespriv(entityName,
00139                                                       saga::task_base::Sync());
00140          return t.get_result<std::vector<std::string> >();
00141       }
00142       SAGA_CALL_PUB_1_DEF_0 (list_related_entity_names, std::string)
00143 
00144       std::vector<saga::isn::entity_data>
00145          get_related_entities(std::string entityName,
00146                               std::string related_entity_name,
00147                               std::string filter,
00148                               std::vector<saga::isn::entity_data> entities)
00149       {
00150          saga::task t = get_related_entitiespriv(entityName,
00151                                                  related_entity_name,
00152                                                  filter,
00153                                                  entities,
00154                                                  saga::task_base::Sync());
00155          return t.get_result<std::vector<saga::isn::entity_data> >();
00156       }
00157       SAGA_CALL_PUB_4_DEF_0 (get_related_entities,
00158                              std::string,
00159                              std::string,
00160                              std::string,
00161                              std::vector<saga::isn::entity_data>)
00162 
00163       std::vector<saga::isn::entity_data>
00164          get_entities(std::string entityName,
00165                       std::string filter)
00166       {
00167          saga::task t = get_entitiespriv(entityName,
00168                                          filter,
00169                                          saga::task_base::Sync());
00170          return t.get_result<std::vector<saga::isn::entity_data> >();
00171       }
00172       SAGA_CALL_PUB_2_DEF_0 (get_entities,
00173                              std::string,
00174                              std::string)
00175   }; // discoverer
00176  } // namespace isn
00177 }  // namespace saga
00179 #endif
00180 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines