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
00008
00009
00010
00011
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
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
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
00049 namespace saga
00050 {
00055 namespace replica
00056 {
00057
00059
00062 namespace metrics {
00063 char const* const logical_file_modified = "logical_file.Modified";
00064 char const* const logical_file_deleted = "logical_file.Deleted";
00065 }
00066
00074 enum flags
00075 {
00076 Unknown = saga::name_space::Unknown ,
00077 None = saga::name_space::None ,
00078 Overwrite = saga::name_space::Overwrite ,
00079 Recursive = saga::name_space::Recursive ,
00080 Dereference = saga::name_space::Dereference,
00081 Create = saga::name_space::Create ,
00082 Exclusive = saga::name_space::Exclusive ,
00083 Lock = saga::name_space::Lock ,
00084 CreateParents = saga::name_space::CreateParents ,
00085
00086
00087 Read = 512,
00088 Write = 1024,
00089 ReadWrite = Read | Write
00090
00091 };
00092
00101 class SAGA_REPLICA_PACKAGE_EXPORT logical_file
00102 : public saga::name_space::entry,
00103 public saga::detail::attribute<logical_file>
00104 {
00105 protected:
00107
00108 friend class saga::impl::logical_file;
00109 friend struct saga::detail::attribute<logical_file>;
00110 typedef saga::detail::attribute<logical_file> attribute_base;
00111 typedef saga::name_space::entry::monitorable_base monitorable_base;
00113
00114 private:
00116
00117 SAGA_CALL_PRIV_1(add_location, saga::url)
00118 SAGA_CALL_PRIV_1(remove_location, saga::url)
00119 SAGA_CALL_PRIV_2(update_location, saga::url, saga::url)
00120 SAGA_CALL_PRIV_0(list_locations)
00121 SAGA_CALL_PRIV_2(replicate, saga::url, int)
00123
00124 protected:
00126
00127 TR1::shared_ptr <saga::impl::logical_file> get_impl (void) const;
00128 explicit logical_file(saga::impl::logical_file *impl);
00130
00131 public:
00136 logical_file (session const& s, saga::url url, int mode = Read);
00137
00142 explicit logical_file (saga::url url, int mode = Read);
00143
00148 explicit logical_file (saga::object const& o);
00149
00154 logical_file (void);
00155
00160 ~logical_file (void);
00161
00166 logical_file& operator=(saga::object const& o);
00167
00173 void add_location(saga::url url)
00174 {
00175 add_locationpriv(url, saga::task_base::Sync());
00176 }
00177 SAGA_CALL_PUB_1_DEF_0(add_location, saga::url)
00178
00179
00184 void remove_location(saga::url url)
00185 {
00186 remove_locationpriv(url, saga::task_base::Sync());
00187 }
00188 SAGA_CALL_PUB_1_DEF_0(remove_location, saga::url)
00189
00190
00196 void update_location(saga::url old_url, saga::url new_url)
00197 {
00198 update_locationpriv(old_url, new_url, saga::task_base::Sync());
00199 }
00200 SAGA_CALL_PUB_2_DEF_0(update_location, saga::url, saga::url)
00201
00202
00207 std::vector<saga::url> list_locations(void)
00208 {
00209 saga::task t = list_locationspriv(saga::task_base::Sync());
00210 return t.get_result<std::vector<saga::url> >();
00211 }
00212 SAGA_CALL_PUB_0_DEF_0(list_locations)
00213
00214
00221 void replicate(saga::url url,
00222 int flags = saga::replica::None)
00223 {
00224 replicatepriv(url, flags, saga::task_base::Sync());
00225 }
00226 SAGA_CALL_PUB_2_DEF_1(replicate, saga::url, int, None)
00227 };
00228
00229 }}
00230
00231 #if defined(__WAVE__)
00232 #pragma wave option(output: null)
00233 #endif
00234
00235 #endif // !defined(SAGA_DEBUG)
00236
00237
00238 #if defined(BOOST_MSVC)
00239 #pragma warning(pop)
00240 #endif
00241
00242 #endif // !defined(SAGA_PACKAGES_DATA_REPLICA_LOGICAL_FILE_HPP)
00243