00001 #ifndef SAGA_PACKAGES_DATA_CPR_CHECKPOINT_HPP
00002 #define SAGA_PACKAGES_DATA_CPR_CHECKPOINT_HPP
00003
00004 #if defined(__WAVE__)
00005 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/cpr_checkpoint.hpp")
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014 #if defined(__WAVE__)
00015 #pragma wave option(preserve: 0, output: null)
00016 #endif
00017
00018 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
00019 #pragma once
00020 #endif
00021
00022 #include <string>
00023 #include <vector>
00024
00025
00026 #include <saga/saga/util.hpp>
00027 #include <saga/saga/base.hpp>
00028 #include <saga/saga/types.hpp>
00029 #include <saga/saga/session.hpp>
00030 #include <saga/saga/call.hpp>
00031 #include <saga/saga/file.hpp>
00032 #include <saga/saga/detail/attribute.hpp>
00033
00034 #include <saga/saga/packages/namespace/namespace_entry.hpp>
00035 #include <saga/saga/packages/cpr/config.hpp>
00036
00037
00038 #if defined(BOOST_MSVC)
00039 #pragma warning(push)
00040 #pragma warning(disable: 4251 4231 4275 4660 4244)
00041 #endif
00042
00043 #ifdef SAGA_DEBUG
00044 #include <saga/saga/packages/cpr/preprocessed/cpr_checkpoint.hpp>
00045 #else
00046
00047 #if defined(__WAVE__)
00048 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/cpr_checkpoint.hpp")
00049 #endif
00051 namespace saga
00052 {
00057 namespace cpr
00058 {
00059
00060 namespace metrics
00061 {
00062
00063 char const* const checkpoint_modified = "checkpoint.Modified";
00064 char const* const checkpoint_deleted = "checkpoint.Deleted";
00065 }
00066
00067
00075 enum flags
00076 {
00077
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 Truncate = 128,
00087 Append = 256,
00088 Read = 512,
00089 Write = 1024,
00090 ReadWrite = Read | Write
00091
00092 };
00093
00094 namespace attributes
00095 {
00098 char const* const cpr_time = "Time";
00099
00102 char const* const cpr_nfliles = "NFiles";
00103
00106 char const* const cpr_mode = "Mode";
00107
00110 char const* const cpr_mode_full = "Full";
00111 char const* const cpr_mode_incremental = "Incremental";
00112
00116 char const* const cpr_parent = "Parent";
00117
00120 char const* const cpr_children = "Children";
00121 }
00122
00131 class SAGA_CPR_PACKAGE_EXPORT checkpoint
00132 : public saga::name_space::entry,
00133 public saga::detail::attribute<checkpoint>
00134 {
00135 protected:
00137
00138 friend class saga::impl::cpr_checkpoint;
00139 friend struct saga::detail::attribute<checkpoint>;
00140 typedef saga::detail::attribute<checkpoint> attribute_base;
00141 typedef saga::name_space::entry::monitorable_base monitorable_base;
00143
00144 private:
00146
00147 SAGA_CALL_PRIV_2 (set_parent, saga::url, int);
00148 SAGA_CALL_PRIV_1 (get_parent, int);
00149 SAGA_CALL_PRIV_0 (get_file_num);
00150 SAGA_CALL_PRIV_0 (list_files);
00151 SAGA_CALL_PRIV_1 (add_file, saga::url);
00152 SAGA_CALL_PRIV_1 (get_file, int);
00153 SAGA_CALL_PRIV_2 (open_file, int, int);
00154 SAGA_CALL_PRIV_2 (open_file, saga::url, int);
00155 SAGA_CALL_PRIV_1 (remove_file, int);
00156 SAGA_CALL_PRIV_1 (remove_file, saga::url);
00157 SAGA_CALL_PRIV_2 (update_file, int, saga::url);
00158 SAGA_CALL_PRIV_2 (update_file, saga::url, saga::url);
00159 SAGA_CALL_PRIV_2 (stage_file, int, saga::url);
00160 SAGA_CALL_PRIV_2 (stage_file, saga::url, saga::url);
00161 SAGA_CALL_PRIV_1 (stage_file, saga::url);
00163
00164 protected:
00166
00167 TR1::shared_ptr <saga::impl::cpr_checkpoint> get_impl (void) const;
00168 explicit checkpoint(saga::impl::cpr_checkpoint *impl);
00170
00171 public:
00176 checkpoint (session const& s, saga::url url, int mode = Read);
00177
00182 explicit checkpoint (saga::url url, int mode = Read);
00183
00188 explicit checkpoint (saga::object const& o);
00189
00194 checkpoint (void);
00195
00200 ~checkpoint (void);
00201
00206 checkpoint& operator=(saga::object const& o);
00207
00213 void set_parent (saga::url url, int generation = 1)
00214 {
00215 set_parentpriv(url, generation, saga::task_base::Sync());
00216 }
00218 SAGA_CALL_PUB_2_DEF_1 (set_parent, saga::url, int, 1);
00220
00226 saga::url get_parent (int generation = 1)
00227 {
00228 saga::task t = get_parentpriv(generation, saga::task_base::Sync());
00229 return t.get_result <saga::url> ();
00230 }
00232 SAGA_CALL_PUB_1_DEF_1 (get_parent, int, 1);
00234
00235
00240 std::vector <saga::url> list_files (void)
00241 {
00242 saga::task t = list_filespriv (saga::task_base::Sync());
00243 return t.get_result <std::vector <saga::url> > ();
00244 }
00246 SAGA_CALL_PUB_0_DEF_0 (list_files);
00248
00254 int add_file (saga::url url)
00255 {
00256 saga::task t = add_filepriv(url, saga::task_base::Sync());
00257 return t.get_result <int> ();
00258 }
00260 SAGA_CALL_PUB_1_DEF_0 (add_file, saga::url);
00262
00263
00269 saga::url get_file (int id)
00270 {
00271 saga::task t = get_filepriv(id, saga::task_base::Sync());
00272 return t.get_result <saga::url> ();
00273 }
00275 SAGA_CALL_PUB_1_DEF_0 (get_file, int);
00277
00278
00285 saga::filesystem::file open_file (int id,
00286 int flags = CreateParents | Lock | ReadWrite)
00287 {
00288 saga::task t = open_filepriv(id, flags, saga::task_base::Sync());
00289 return t.get_result <saga::filesystem::file> ();
00290 }
00292 SAGA_CALL_PUB_2_DEF_1 (open_file, int, int, CreateParents | Lock | ReadWrite );
00294
00301 saga::filesystem::file open_file (saga::url url,
00302 int flags = CreateParents | Lock | ReadWrite)
00303 {
00304 saga::task t = open_filepriv(url, flags, saga::task_base::Sync());
00305 return t.get_result <saga::filesystem::file> ();
00306 }
00308 SAGA_CALL_PUB_2_DEF_1 (open_file, saga::url, int, CreateParents | Lock | ReadWrite);
00310
00311
00318 void remove_file (int id)
00319 {
00320 remove_filepriv(id, saga::task_base::Sync());
00321 }
00323 SAGA_CALL_PUB_1_DEF_0 (remove_file, int);
00325
00331 void remove_file (saga::url url)
00332 {
00333 remove_filepriv(url, saga::task_base::Sync());
00334 }
00336 SAGA_CALL_PUB_1_DEF_0 (remove_file, saga::url);
00338
00339
00346 void update_file (int id, saga::url new_url)
00347 {
00348 update_filepriv(id, new_url, saga::task_base::Sync());
00349 }
00351 SAGA_CALL_PUB_2_DEF_0 (update_file, int, saga::url);
00353
00360 void update_file (saga::url old_url, saga::url new_url)
00361 {
00362 update_filepriv(old_url, new_url, saga::task_base::Sync());
00363 }
00365 SAGA_CALL_PUB_2_DEF_0 (update_file, saga::url, saga::url);
00367
00368
00375 void stage_file (int id, saga::url new_url)
00376 {
00377 stage_filepriv(id, new_url, saga::task_base::Sync());
00378 }
00380 SAGA_CALL_PUB_2_DEF_0 (stage_file, int, saga::url);
00382
00389 void stage_file (saga::url old_url, saga::url new_url)
00390 {
00391 stage_filepriv(old_url, new_url, saga::task_base::Sync());
00392 }
00394 SAGA_CALL_PUB_2_DEF_0 (stage_file, saga::url, saga::url);
00396
00402 void stage_file (saga::url new_url)
00403 {
00404 stage_filepriv(new_url, saga::task_base::Sync());
00405 }
00407 SAGA_CALL_PUB_1_DEF_0 (stage_file, saga::url);
00409 };
00410
00411 }}
00412
00413 #if defined(__WAVE__)
00414 #pragma wave option(output: null)
00415 #endif
00416
00417 #endif // !defined(SAGA_DEBUG)
00418
00419
00420 #if defined(BOOST_MSVC)
00421 #pragma warning(pop)
00422 #endif
00423
00424 #endif // !defined(SAGA_PACKAGES_DATA_CPR_CHECKPOINT_HPP)
00425