SAGA C++ API 1.6
namespace_entry.cpp
Go to the documentation of this file.
00001 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00002 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/namespace_entry.cpp")
00003 #endif
00004 //  Copyright (c) 2005-2009 Hartmut Kaiser
00005 //  Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net)
00006 // 
00007 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
00008 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00009 
00010 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00011 #pragma wave option(preserve: 0, output: null)
00012 #endif
00013 
00014 //  this is needed in every file including detail/monitorable_impl.hpp and not 
00015 //  belonging to the engine
00016 #define SAGA_NO_IMPORT_MONITORABLE
00017 #define SAGA_NO_IMPORT_PERMISSIONS
00018 #define SAGA_PERMISSIONS_EXPORTS
00019 
00020 // include the package and implementation
00021 #include <saga/saga/util.hpp>
00022 #include <saga/saga/namespace.hpp>
00023 #include <saga/impl/namespace.hpp>
00024 
00025 #include <saga/saga/detail/monitorable_impl.hpp>
00026 #include <saga/saga/detail/permissions_impl.hpp>
00027 #include <saga/saga/detail/call.hpp>
00028 
00029 #include <string>
00030 #include <vector>
00031 
00032 #ifdef SAGA_DEBUG
00033 #include <saga/saga/packages/namespace/preprocessed/namespace_entry.cpp>
00034 #else
00035 
00036 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
00037 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/namespace_entry.cpp")
00038 #endif
00039 
00040 namespace saga 
00041 {
00042   namespace name_space 
00043   {
00044     entry::entry (saga::impl::namespace_entry * init)
00045       : saga::object (init)
00046     {
00047     }
00048 
00049     entry::entry (session const & session, saga::url url, int mode, 
00050             saga::object::type t)
00051       : saga::object (new saga::impl::namespace_entry (
00052           session, url, mode, t))
00053     {
00054       saga::impl::object* obj (this->saga::object::get_impl());
00055       obj->init();
00056       if (t == saga::object::NSEntry)
00057         obj->set_type((saga::object::type)obj->get_cpitype());
00058     }
00059 
00060     entry::entry (saga::url url, int mode, saga::object::type t)
00061       : saga::object (new saga::impl::namespace_entry (
00062             saga::detail::get_the_session(), url, mode, t))
00063     {
00064       saga::impl::object* obj (this->saga::object::get_impl());
00065       obj->init();
00066       if (t == saga::object::NSEntry)
00067         obj->set_type((saga::object::type)obj->get_cpitype());
00068     }
00069 
00070     entry::entry (saga::object const& o)
00071       : saga::object (o)
00072     {
00073     }
00074 
00075     entry::entry ()
00076     {
00077     }
00078 
00079     entry::~entry (void)
00080     {
00081     }
00082 
00083     entry &entry::operator= (saga::object const& o)
00084     {
00085         return saga::object::operator=(o), *this;
00086     }
00087 
00088     saga::impl::namespace_entry* entry::get_impl() const
00089     { 
00090         typedef saga::object base_type;
00091         return static_cast<saga::impl::namespace_entry*>(this->base_type::get_impl()); 
00092     }
00093 
00094     TR1::shared_ptr <saga::impl::namespace_entry> entry::get_impl_sp(void) const
00095     { 
00096       // FIXME: this needs documentation
00097       typedef saga::object base_type;
00098       return TR1::static_pointer_cast<saga::impl::namespace_entry>( 
00099           this->base_type::get_impl_sp());
00100     }
00101 
00103     SAGA_CALL_CREATE_IMP_3(entry, impl::namespace_entry, session const&, saga::url, int)
00104 
00105     // basic properties
00106     SAGA_CALL_CONST_IMP_0(entry, get_url)
00107     SAGA_CALL_CONST_IMP_0(entry, get_cwd)
00108     SAGA_CALL_CONST_IMP_0(entry, get_name)
00109 
00110     // navigation/query methods
00111     SAGA_CALL_CONST_IMP_0(entry, read_link)
00112     SAGA_CALL_CONST_IMP_0(entry, is_dir)
00113     SAGA_CALL_CONST_IMP_0(entry, is_entry)
00114     SAGA_CALL_CONST_IMP_0(entry, is_link)
00115 
00116     // entry management methods
00117     SAGA_CALL_IMP_2(entry, copy, saga::url, int)
00118     SAGA_CALL_IMP_2(entry, link, saga::url, int)
00119     SAGA_CALL_IMP_2(entry, move, saga::url, int)
00120     SAGA_CALL_IMP_1(entry, remove, int)
00121     SAGA_CALL_IMP_1(entry, close, double)
00122 
00123     // permissions with flags
00124     SAGA_CALL_IMP_3(entry, permissions_allow, std::string, int, int)
00125     SAGA_CALL_IMP_3(entry, permissions_deny, std::string, int, int)
00126 
00127   }
00128 
00129   namespace detail
00130   {
00132     //  implement the monitorable functions (we need to explicitly specialize 
00133     //  the template because the functions are not implemented inline)
00134     template struct SAGA_NAMESPACE_PACKAGE_EXPORT monitorable<name_space::entry>;
00135 
00137     //  implement the permissions functions (we need to explicitly specialize 
00138     //  the template because the functions are not implemented inline)
00139     template struct SAGA_NAMESPACE_PACKAGE_EXPORT permissions<name_space::entry>;
00140 
00141     template struct SAGA_NAMESPACE_PACKAGE_EXPORT permissions_priv<name_space::entry, task_base::Sync>;
00142     template struct SAGA_NAMESPACE_PACKAGE_EXPORT permissions_priv<name_space::entry, task_base::Async>;
00143     template struct SAGA_NAMESPACE_PACKAGE_EXPORT permissions_priv<name_space::entry, task_base::Task>;
00144   }
00145 
00147 } // namespace saga
00148 
00149 #endif // SAGA_DEBUG
00150 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines