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 {
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 = saga::name_space::Unknown ,
00078 None = saga::name_space::None ,
00079 Overwrite = saga::name_space::Overwrite ,
00080 Recursive = saga::name_space::Recursive ,
00081 Dereference = saga::name_space::Dereference,
00082 Create = saga::name_space::Create ,
00083 Exclusive = saga::name_space::Exclusive ,
00084 Lock = saga::name_space::Lock ,
00085 CreateParents = saga::name_space::CreateParents ,
00086
00087
00088 Read = 512,
00089 Write = 1024,
00090 ReadWrite = Read | Write
00091
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>;
00111 typedef saga::detail::attribute<logical_file> attribute_base;
00112 typedef saga::name_space::entry::monitorable_base monitorable_base;
00114
00115 private:
00117
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 (void) const;
00132 explicit logical_file(saga::impl::logical_file *impl);
00134
00135 public:
00140 logical_file (session const& s, saga::url url, int mode = Read);
00141
00146 explicit logical_file (saga::url url, int mode = Read);
00147
00152 explicit logical_file (saga::object const& o);
00153
00158 logical_file (void);
00159
00164 ~logical_file (void);
00165
00169 static logical_file create(session const& s, saga::url url,
00170 int mode = Read)
00171 {
00172 return logical_file(s, url, mode);
00173 }
00174 SAGA_CALL_CREATE_3_DEF_1(session const&, saga::url, int, Read)
00175
00176
00178 static logical_file create(saga::url url, int mode = Read)
00179 {
00180 return logical_file(url, mode);
00181 }
00182 template <typename Tag>
00183 static saga::task create(saga::url url, int mode = Read)
00184 {
00185 return create<Tag>(detail::get_the_session(), url, mode);
00186 }
00187
00192 logical_file& operator=(saga::object const& o);
00193
00199 void add_location(saga::url url)
00200 {
00201 saga::task t = add_locationpriv(url, saga::task_base::Sync());
00202 t.get_result ();
00203 }
00204 SAGA_CALL_PUB_1_DEF_0(add_location, saga::url)
00205
00206
00211 void remove_location(saga::url url)
00212 {
00213 saga::task t = remove_locationpriv(url, saga::task_base::Sync());
00214 t.get_result ();
00215 }
00216 SAGA_CALL_PUB_1_DEF_0(remove_location, saga::url)
00217
00218
00224 void update_location(saga::url old_url, saga::url new_url)
00225 {
00226 saga::task t = update_locationpriv(old_url, new_url, saga::task_base::Sync());
00227 t.get_result ();
00228 }
00229 SAGA_CALL_PUB_2_DEF_0(update_location, saga::url, saga::url)
00230
00231
00236 std::vector<saga::url> list_locations(void)
00237 {
00238 saga::task t = list_locationspriv(saga::task_base::Sync());
00239 return t.get_result<std::vector<saga::url> >();
00240 }
00241 SAGA_CALL_PUB_0_DEF_0(list_locations)
00242
00243
00250 void replicate(saga::url url,
00251 int flags = saga::replica::None)
00252 {
00253 saga::task t = replicatepriv(url, flags, saga::task_base::Sync());
00254 t.get_result ();
00255 }
00256 SAGA_CALL_PUB_2_DEF_1(replicate, saga::url, int, None)
00257 };
00258
00259 }}
00260
00261 #if defined(__WAVE__)
00262 #pragma wave option(output: null)
00263 #endif
00264
00265 #endif // !defined(SAGA_DEBUG)
00266
00267
00268 #if defined(BOOST_MSVC)
00269 #pragma warning(pop)
00270 #endif
00271
00272 #endif // !defined(SAGA_PACKAGES_DATA_REPLICA_LOGICAL_FILE_HPP)
00273