00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef SAGA_COMM_STREAM_STREAMSERVICE_HPP
00010 #define SAGA_COMM_STREAM_STREAMSERVICE_HPP
00011
00012
00013 #include <string>
00014
00015
00016 #include <saga/saga/util.hpp>
00017 #include <saga/saga/call.hpp>
00018 #include <saga/saga/base.hpp>
00019 #include <saga/saga/task.hpp>
00020 #include <saga/saga/session.hpp>
00021 #include <saga/saga/detail/monitorable.hpp>
00022 #include <saga/saga/detail/permissions.hpp>
00023
00024
00025 #include <saga/saga/packages/stream/config.hpp>
00026
00027
00028 #include <saga/saga/stream.hpp>
00029
00030
00031 #if defined(BOOST_MSVC)
00032 #pragma warning(push)
00033 #pragma warning(disable: 4251 4231 4660)
00034 #endif
00035
00037 namespace saga
00038 {
00039
00040 namespace stream {
00041
00042 namespace metrics
00043 {
00044 char const* const server_clientconnect = "server.ClientConnect";
00045 }
00046
00053 class SAGA_STREAM_PACKAGE_EXPORT server
00054 : public saga::object,
00055 public saga::detail::monitorable<server>,
00056 public saga::detail::permissions<server>
00057 {
00059
00060 friend struct saga::detail::monitorable<server>;
00061 friend struct saga::detail::permissions<server>;
00062 typedef saga::detail::monitorable<server> monitorable_base_type;
00064
00065 protected:
00067
00068 TR1::shared_ptr <saga::impl::server> get_impl (void) const;
00070
00071 private:
00072
00073 SAGA_CALL_CONST_PRIV_0(get_url)
00074 SAGA_CALL_PRIV_1(serve, double)
00075 SAGA_CALL_PRIV_1(close, double)
00076
00077 void init_metrics();
00078
00079 public:
00084 explicit server (session const& s, saga::url url = saga::url());
00085
00090 explicit server (saga::url url);
00091
00096 server ();
00097
00102 explicit server (saga::object const& o);
00103
00108 ~server (void);
00109
00114 server &operator= (saga::object const& o);
00115
00121 saga::url get_url() const
00122 {
00123 saga::task t = get_urlpriv(saga::task_base::Sync());
00124 return t.get_result<saga::url>();
00125 }
00126 SAGA_CALL_CONST_PUB_0_DEF_0(get_url)
00127
00128
00134 saga::stream::stream serve(double timeout = 0.0)
00135 {
00136 saga::task t = servepriv(timeout, saga::task_base::Sync());
00137 return t.get_result<saga::stream::stream>();
00138 }
00139 SAGA_CALL_PUB_1_DEF_1(serve, double, -1.0)
00140
00141
00145 void close(double timeout = 0.0)
00146 {
00147 closepriv(timeout, saga::task_base::Sync());
00148 }
00149 SAGA_CALL_PUB_1_DEF_1(close, double, 0.0)
00150 };
00151
00152 }}
00153
00154
00155 #if defined(BOOST_MSVC)
00156 #pragma warning(pop)
00157 #endif
00158
00159 #endif // SAGA_COMM_STREAM_STREAMSERVICE_HPP
00160