Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include <boost/config.hpp>
00009 #include <boost/lexical_cast.hpp>
00010
00011 #include <saga/saga/exception.hpp>
00012 #include <saga/saga/context.hpp>
00013
00014 #include <saga/impl/context.hpp>
00015 #include <saga/impl/engine/object.hpp>
00016 #include <saga/impl/engine/proxy.hpp>
00017 #include <saga/impl/engine/metric.hpp>
00018
00019 #include <saga/saga/detail/attribute_impl.hpp>
00020
00021 #include <boost/assign/std/vector.hpp>
00022
00024 namespace saga
00025 {
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00044 context::context (std::string const& ctxtype)
00045 : saga::object (new impl::context())
00046 {
00047 using namespace boost::assign;
00048
00049 std::vector<std::string> valid_keys;
00050 valid_keys +=
00051 attributes::context_type,
00052 attributes::context_server,
00053 attributes::context_certrepository,
00054 attributes::context_userproxy,
00055 attributes::context_usercert,
00056 attributes::context_userkey,
00057 attributes::context_userid,
00058 attributes::context_userpass,
00059 attributes::context_uservo,
00060 attributes::context_lifetime,
00061 attributes::context_remoteid,
00062 attributes::context_remotehost,
00063 attributes::context_remoteport;
00064 this->init_keynames(valid_keys);
00065
00066
00067 strmap_type attributes_scalar_rw;
00068 insert(attributes_scalar_rw)
00069 (attributes::context_type, ctxtype)
00070 (attributes::context_server, "")
00071 (attributes::context_certrepository, "")
00072 (attributes::context_userproxy, "")
00073 (attributes::context_usercert, "")
00074 (attributes::context_userkey, "")
00075 (attributes::context_userid, "")
00076 (attributes::context_userpass, "")
00077 (attributes::context_uservo, "")
00078 (attributes::context_lifetime, "")
00079 (attributes::context_remoteid, "")
00080 (attributes::context_remotehost, "")
00081 (attributes::context_remoteport, "")
00082 ;
00083
00084
00085 this->init(strmap_type(), attributes_scalar_rw);
00086
00087
00088
00089
00090 this->init(true, true);
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 if (!ctxtype.empty())
00101 this->saga::object::get_impl()->init();
00102 }
00103
00104 context::context(saga::impl::context *impl)
00105 : saga::object(impl)
00106 {
00107 }
00108 context::context (TR1::shared_ptr<saga::impl::context> init)
00109 : saga::object(init)
00110 {
00111 }
00112
00113 context::context(saga::object const& obj)
00114 : saga::object (obj)
00115 {
00116 if (this->get_type() != saga::object::Context)
00117 {
00118 SAGA_THROW("Bad type conversion.", saga::BadParameter);
00119 }
00120 }
00121 context& context::operator=(saga::object const& obj)
00122 {
00123 saga::object::operator=(obj);
00124 if (this->get_type() != saga::object::Context)
00125 {
00126 SAGA_THROW("Bad type conversion.", saga::BadParameter);
00127 }
00128 return *this;
00129 }
00130
00131 context::~context (void)
00132 {
00133 }
00134
00135 saga::impl::context* context::get_impl (void) const
00136 {
00137 typedef saga::object base_type;
00138 return static_cast<saga::impl::context*>(this->base_type::get_impl());
00139 }
00140
00141 TR1::shared_ptr <saga::impl::context> context::get_impl_sp(void) const
00142 {
00143 typedef saga::object base_type;
00144 return TR1::static_pointer_cast<saga::impl::context>(
00145 this->base_type::get_impl_sp());
00146 }
00147
00148
00149
00150
00151
00152
00153
00155
00156 bool operator== (context const & lhs, context const & rhs)
00157 {
00158 return lhs.get_impl()->is_equal(rhs.get_impl());
00159 }
00161
00162 namespace detail
00163 {
00165
00166
00167 template struct SAGA_EXPORT_REPEAT attribute<context>;
00168
00169 template struct SAGA_EXPORT attribute_priv<context, task_base::Sync>;
00170 template struct SAGA_EXPORT attribute_priv<context, task_base::Async>;
00171 template struct SAGA_EXPORT attribute_priv<context, task_base::Task>;
00172
00173 template struct SAGA_EXPORT attribute_sync<context>;
00174 }
00175
00177 }
00178