SAGA C++ API 1.6
permissions_impl.hpp
Go to the documentation of this file.
00001 //  Copyright (c) 2005-2009 Hartmut Kaiser
00002 // 
00003 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
00004 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00005 
00006 #ifndef SAGA_SAGA_DETAIL_PERMISSIONS_IMPL_HPP
00007 #define SAGA_SAGA_DETAIL_PERMISSIONS_IMPL_HPP
00008 
00009 #include <saga/impl/exception.hpp>
00010 #include <saga/saga/detail/permissions.hpp>
00011 #include <saga/saga/detail/dispatch_priv.hpp>
00012 
00014 namespace saga { namespace detail
00015 {
00016     template <typename Derived>
00017     inline impl::permissions_interface* 
00018     permissions<Derived>::get_perm (void) 
00019     { 
00020         if (!derived().is_impl_valid()) {
00021             SAGA_THROW("The object has not been properly initialized.",
00022                 saga::IncorrectState);
00023         }
00024         return derived().get_impl()->get_permissions(); 
00025     }
00026     
00027     template <typename Derived>
00028     inline impl::permissions_interface* 
00029     permissions<Derived>::get_perm (void) const 
00030     { 
00031         if (!derived().is_impl_valid()) {
00032             SAGA_THROW("The object has not been properly initialized.",
00033                 saga::IncorrectState);
00034         }
00035         return derived().get_impl()->get_permissions(); 
00036     }
00037 
00040     /* setters/getters */
00041     struct permissions_allow_priv 
00042     {
00043         template <typename Derived>
00044         static saga::task 
00045         call (Derived& this_, std::string id, int p, bool sync) 
00046         {
00047             return this_.get_perm()->permissions_allow(id, p, sync);
00048         }
00049     };
00050 
00051     template <typename Derived, typename Tag>
00052     inline saga::task
00053     permissions_priv<Derived, Tag>::permissions_allow (Derived const& this_, 
00054             std::string id, int p) 
00055     {
00056         return dispatch_priv<Tag>::
00057             template call<permissions_allow_priv>(this_, id, p);
00058     }
00059 
00061     struct permissions_deny_priv 
00062     {
00063         template <typename Derived>
00064         static saga::task 
00065         call (Derived& this_, std::string id, int p, bool sync) 
00066         {
00067             return this_.get_perm()->permissions_deny(id, p, sync);
00068         }
00069     };
00070 
00071     template <typename Derived, typename Tag>
00072     inline saga::task
00073     permissions_priv<Derived, Tag>::permissions_deny (Derived const& this_, 
00074             std::string id, int p) 
00075     {
00076         return dispatch_priv<Tag>::
00077             template call<permissions_deny_priv>(this_, id, p);
00078     }
00079 
00081     struct permissions_check_priv 
00082     {
00083         template <typename Derived>
00084         static saga::task 
00085         call (Derived& this_, std::string id, int p, bool sync) 
00086         {
00087             return this_.get_perm()->permissions_check(id, p, sync);
00088         }
00089     };
00090 
00091     template <typename Derived, typename Tag>
00092     inline saga::task
00093     permissions_priv<Derived, Tag>::permissions_check (Derived const& this_, 
00094             std::string id, int p) 
00095     {
00096         return dispatch_priv<Tag>::
00097             template call<permissions_check_priv>(this_, id, p);
00098     }
00099 
00101     struct get_owner_priv 
00102     {
00103         template <typename Derived>
00104         static saga::task 
00105         call (Derived& this_, bool sync) 
00106         {
00107             return this_.get_perm()->get_owner(sync);
00108         }
00109     };
00110 
00111     template <typename Derived, typename Tag>
00112     inline saga::task
00113     permissions_priv<Derived, Tag>::get_owner (Derived const& this_) 
00114     {
00115         return dispatch_priv<Tag>::template call<get_owner_priv>(this_);
00116     }
00117 
00119     struct get_group_priv 
00120     {
00121         template <typename Derived>
00122         static saga::task 
00123         call (Derived& this_, bool sync) 
00124         {
00125             return this_.get_perm()->get_group(sync);
00126         }
00127     };
00128 
00129     template <typename Derived, typename Tag>
00130     inline saga::task
00131     permissions_priv<Derived, Tag>::get_group (Derived const& this_) 
00132     {
00133         return dispatch_priv<Tag>::template call<get_group_priv>(this_);
00134     }
00136     
00138 }}
00139 
00140 #endif
00141 
00142 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines