SAGA C++ API 1.6
file.cpp
Go to the documentation of this file.
00001 #if defined(__WAVE__)
00002 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/file.cpp")
00003 #endif
00004 //  Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net)
00005 //  Copyright (c) 2005-2009 Hartmut Kaiser
00006 // 
00007 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
00008 //  job LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00009 
00010 #if defined(__WAVE__)
00011 #pragma wave option(output: null)
00012 #endif
00013 
00014 // include file API and implementation
00015 #include <saga/saga/filesystem.hpp>
00016 #include <saga/impl/filesystem.hpp>
00017 #include <saga/saga/detail/call.hpp>
00018 
00019 #ifdef SAGA_DEBUG
00020 #include <saga/saga/packages/filesystem/preprocessed/file.cpp>
00021 #else
00022 
00023 #if defined(__WAVE__)
00024 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/file.cpp")
00025 #endif
00026 
00027 namespace saga { namespace filesystem 
00028 {
00029   file::file (saga::impl::file * init)
00030     : entry (init)
00031   {
00032   }
00033 
00034   file::file (session const& s, saga::url url, int mode)
00035     : entry (new saga::impl::file (s, url, mode))
00036   {
00037     this->saga::object::get_impl()->init();
00038   }
00039 
00040   file::file (session const& s, saga::url url, int mode, saga::off_t pointer)
00041     : entry (new saga::impl::file (s, url, mode, pointer))
00042   {
00043     this->saga::object::get_impl()->init();
00044   }
00045 
00046   file::file (saga::url url, int mode)
00047     : entry (new saga::impl::file (detail::get_the_session (), url, mode))
00048   {
00049     this->saga::object::get_impl()->init();
00050   }
00051 
00052   file::file (saga::object const& o)
00053     : entry(o)
00054   {
00055       if (this->get_type() != saga::object::File)
00056       {
00057           SAGA_THROW("Bad type conversion.", saga::BadParameter);
00058       }
00059   }
00060 
00061   file::file (void) 
00062   {
00063   }
00064   
00065   file::~file (void)
00066   {
00067   }
00068 
00069   file &file::operator= (saga::object const& o)
00070   {
00071       return this->saga::name_space::entry::operator=(o), *this;
00072   }
00073 
00074   saga::impl::file* file::get_impl (void) const
00075   { 
00076     typedef saga::object base_type;
00077     return static_cast <saga::impl::file*> (this->base_type::get_impl ());
00078   }
00079 
00080   TR1::shared_ptr <saga::impl::file> file::get_impl_sp (void) const
00081   { 
00082     // FIXME: this needs documentation
00083     typedef saga::object base_type;
00084     return TR1::static_pointer_cast <saga::impl::file> (
00085         this->base_type::get_impl_sp());
00086   }
00087 
00088   // factory
00089   SAGA_CALL_CREATE_IMP_3(file, impl::file, session const&, saga::url, int)
00090 
00091   // methods not covered by the namespace_entry
00092   SAGA_CALL_IMP_0 (file, get_size)
00093   SAGA_CALL_IMP_2 (file, read, saga::mutable_buffer, saga::ssize_t)
00094   SAGA_CALL_IMP_2 (file, write, saga::const_buffer, saga::ssize_t)
00095   SAGA_CALL_IMP_2 (file, seek, saga::off_t, saga::filesystem::seek_mode)
00096 
00097   // scattered I/O
00098   SAGA_CALL_IMP_1 (file, read_v, std::vector<saga::filesystem::iovec>)
00099   SAGA_CALL_IMP_1 (file, write_v, std::vector<saga::filesystem::const_iovec>)
00100 
00101   // pattern based I/O
00102   SAGA_CALL_IMP_1 (file, size_p, std::string)
00103   SAGA_CALL_IMP_2 (file, read_p, std::string, saga::mutable_buffer)
00104   SAGA_CALL_IMP_2 (file, write_p, std::string, saga::const_buffer)
00105 
00106   // extended based I/O
00107   SAGA_CALL_IMP_0 (file, modes_e)
00108   SAGA_CALL_IMP_2 (file, size_e, std::string, std::string)
00109   SAGA_CALL_IMP_3 (file, read_e, std::string, std::string, saga::mutable_buffer)
00110   SAGA_CALL_IMP_3 (file, write_e, std::string, std::string, saga::const_buffer)
00111   
00113 }} // namespace saga
00114 
00115 #endif
00116 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines