SAGA C++ API 1.6
logical_file.hpp
Go to the documentation of this file.
00001 #ifndef SAGA_PACKAGES_DATA_REPLICA_LOGICAL_FILE_HPP
00002 #define SAGA_PACKAGES_DATA_REPLICA_LOGICAL_FILE_HPP
00003 
00004 #if defined(__WAVE__)
00005 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/logical_file.hpp")
00006 #endif
00007 //  Copyright (c) 2005-2009 Hartmut Kaiser
00008 //  Copyright (c) 2007 Ole Weidner (oweidner@cct.lsu.edu)
00009 // 
00010 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
00011 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00012 
00013 #if defined(__WAVE__)
00014 #pragma wave option(preserve: 0, output: null)
00015 #endif
00016 
00017 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
00018 #pragma once
00019 #endif 
00020 
00021 #include <string>
00022 #include <vector>
00023 
00024 // include dependent spec sections
00025 #include <saga/saga/util.hpp>
00026 #include <saga/saga/base.hpp>
00027 #include <saga/saga/types.hpp>
00028 #include <saga/saga/session.hpp>
00029 #include <saga/saga/call.hpp>
00030 #include <saga/saga/detail/attribute.hpp>
00031 
00032 #include <saga/saga/packages/namespace/namespace_entry.hpp>
00033 #include <saga/saga/packages/replica/config.hpp>
00034 
00035 // suppress warnings about dependent classes not being exported from the dll
00036 #if defined(BOOST_MSVC)
00037 #pragma warning(push)
00038 #pragma warning(disable: 4251 4231 4275 4660)
00039 #endif
00040 
00041 #ifdef SAGA_DEBUG
00042 #include <saga/saga/packages/replica/preprocessed/logical_file.hpp>
00043 #else
00044 
00045 #if defined(__WAVE__)
00046 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/logical_file.hpp")
00047 #endif
00048 
00049 namespace saga
00050 {    
00055     namespace replica 
00056     {
00057         
00059 
00062         namespace metrics 
00063         {
00064             char const* const logical_file_modified = "logical_file.Modified";
00065             char const* const logical_file_deleted = "logical_file.Deleted";
00066         }
00067         
00075         enum flags 
00076         {
00077             Unknown         = /*  -1, */  saga::name_space::Unknown       ,
00078             None            = /*   0, */  saga::name_space::None          ,
00079             Overwrite       = /*   1, */  saga::name_space::Overwrite     ,
00080             Recursive       = /*   2, */  saga::name_space::Recursive     ,
00081             Dereference     = /*   4, */  saga::name_space::Dereference,
00082             Create          = /*   8, */  saga::name_space::Create        ,
00083             Exclusive       = /*  16, */  saga::name_space::Exclusive     ,
00084             Lock            = /*  32, */  saga::name_space::Lock          ,
00085             CreateParents   = /*  64, */  saga::name_space::CreateParents ,
00086             // 128, reserved for Truncate
00087             // 256,  reserved for Append 
00088             Read            =    512,
00089             Write           =   1024,
00090             ReadWrite       =   Read | Write
00091             // 2048, reserved for Binary
00092         };             
00093         
00102         class SAGA_REPLICA_PACKAGE_EXPORT logical_file 
00103           : public saga::name_space::entry,
00104             public saga::detail::attribute<logical_file>
00105         {
00106         protected:
00108 
00109             friend class saga::impl::logical_file;
00110             friend struct saga::detail::attribute<logical_file>;  // needs to access get_impl()
00111             typedef saga::detail::attribute<logical_file> attribute_base;
00112             typedef saga::name_space::entry::monitorable_base monitorable_base;
00114             
00115         private:
00117             // factory
00118             SAGA_CALL_CREATE_PRIV_3(session const&, saga::url, int)
00119 
00120             
00121             SAGA_CALL_PRIV_1(add_location, saga::url)
00122             SAGA_CALL_PRIV_1(remove_location, saga::url)
00123             SAGA_CALL_PRIV_2(update_location, saga::url, saga::url)
00124             SAGA_CALL_PRIV_0(list_locations)
00125             SAGA_CALL_PRIV_2(replicate, saga::url, int)
00127 
00128         protected:
00130 
00131             TR1::shared_ptr <saga::impl::logical_file> get_impl_sp(void) const;
00132             saga::impl::logical_file* get_impl (void) const;
00133             explicit logical_file(saga::impl::logical_file *impl);
00135 
00136         public:
00141             logical_file (session const& s, saga::url url, int mode = Read);
00142 
00147             explicit logical_file (saga::url url, int mode = Read);
00148 
00153             explicit logical_file (saga::object const& o);
00154 
00159             logical_file (void);
00160 
00165             ~logical_file (void);
00166 
00170             static logical_file create(session const& s, saga::url url, 
00171                 int mode = Read)
00172             {
00173                 return logical_file(s, url, mode);
00174             }
00175             SAGA_CALL_CREATE_3_DEF_1(session const&, saga::url, int, Read)
00176 
00177             
00179             static logical_file create(saga::url url, int mode = Read)
00180             {
00181                 return logical_file(url, mode);
00182             }
00183             template <typename Tag>
00184             static saga::task create(saga::url url, int mode = Read)
00185             {
00186                 return create<Tag>(detail::get_the_session(), url, mode);
00187             }
00188 
00193             logical_file& operator=(saga::object const& o);
00194 
00201             void add_location(saga::url url) 
00202             {
00203                 saga::task t = add_locationpriv(url, saga::task_base::Sync()); 
00204                 t.get_result ();
00205             }
00206             SAGA_CALL_PUB_1_DEF_0(add_location, saga::url)
00207 
00208             
00214             void remove_location(saga::url url) 
00215             {
00216                 saga::task t = remove_locationpriv(url, saga::task_base::Sync()); 
00217                 t.get_result ();
00218             }
00219             SAGA_CALL_PUB_1_DEF_0(remove_location, saga::url)
00220 
00221             
00228             void update_location(saga::url old_url, saga::url new_url) 
00229             {
00230                 saga::task t = update_locationpriv(old_url, new_url, saga::task_base::Sync()); 
00231                 t.get_result ();
00232             }
00233             SAGA_CALL_PUB_2_DEF_0(update_location, saga::url, saga::url)
00234 
00235             
00241             std::vector<saga::url> list_locations(void) 
00242             {
00243                 saga::task t = list_locationspriv(saga::task_base::Sync()); 
00244                 return t.get_result<std::vector<saga::url> >();
00245             }
00246             SAGA_CALL_PUB_0_DEF_0(list_locations)
00247 
00248             
00256             void replicate(saga::url url, 
00257                            int flags = saga::replica::None) 
00258             {
00259                 saga::task t = replicatepriv(url, flags, saga::task_base::Sync()); 
00260                 t.get_result ();
00261             }
00262             SAGA_CALL_PUB_2_DEF_1(replicate, saga::url, int, None)
00263         }; 
00264 
00265     }}
00266 
00267 #if defined(__WAVE__)
00268 #pragma wave option(output: null)
00269 #endif
00270 
00271 #endif // !defined(SAGA_DEBUG)
00272 
00273 // re-enable warnings about dependent classes not being exported from the dll
00274 #if defined(BOOST_MSVC)
00275 #pragma warning(pop)
00276 #endif
00277 
00278 #endif // !defined(SAGA_PACKAGES_DATA_REPLICA_LOGICAL_FILE_HPP)
00279 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines