#ifndef SAGA_IMPL_PACKAGES_COMM_STREAM_STREAM_HPP #define SAGA_IMPL_PACKAGES_COMM_STREAM_STREAM_HPP #if defined(__WAVE__) #pragma wave option(preserve: 2, line: 0, output: "preprocessed/stream.hpp") #endif // Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net) // Copyright (c) 2005-2007 Hartmut Kaiser (hartmut.kaiser@gmail.com) // // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #if defined(__WAVE__) #pragma wave option(output: null) #endif #include #include #include #include #include #include #include #ifdef SAGA_DEBUG #include #else #if defined(__WAVE__) #pragma wave option(output: "preprocessed/stream.hpp") #endif /////////////////////////////////////////////////////////////////////////////// namespace saga { namespace impl { /** * This class acts as a proxy class, hiding all the nasty Saga stuff * (like creating and using adaptors) for the user. Users just call * the functions of this class like to would on every local object, * and don't have to worry about adaptors. It extends saga::stream_cpi. */ class SAGA_STREAM_PACKAGE_EXPORT stream : public proxy { public: typedef stream_base::state state; private: typedef v1_0::stream_cpi stream_cpi; typedef v1_0::preference_type preference_type; // initialize newly attached CPI instance void init(); public: /** * Constructor of stream, sets the location of the stream, and gets * an instance of the Saga engine * * @param loc the full path and name of the stream * @param s the session handle */ stream (saga::session const & s, std::string const & loc); /*! destructor of stream, destroys stream and the adaptor it is * bound to */ ~stream (void); /** * @return location */ SAGA_CALL_IMPL_DECL_0 (std::string, get_url); SAGA_CALL_IMPL_DECL_0 (saga::context, get_context); SAGA_CALL_IMPL_DECL_0 (saga::void_t, connect); SAGA_CALL_IMPL_DECL_2 (std::vector, wait, saga::stream_base::activity, double); SAGA_CALL_IMPL_DECL_1 (saga::void_t, close, double); SAGA_CALL_IMPL_DECL_2 (saga::ssize_t, read, saga::char_t*, saga::size_t); SAGA_CALL_IMPL_DECL_2 (saga::ssize_t, write, const saga::char_t*, saga::size_t); }; } // namespace saga } // namespace impl /////////////////////////////////////////////////////////////////////////////// #if defined(__WAVE__) #pragma wave option(output: null) #endif #endif // SAGA_DEBUG #endif // SAGA_IMPL_PACKAGES_COMM_STREAM_STREAM_HPP