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_CREATE_PRIV_3(session const&, saga::url, int)
00148
00149
00150 SAGA_CALL_PRIV_2 (set_parent, saga::url, int)
00151 SAGA_CALL_PRIV_1 (get_parent, int)
00152 SAGA_CALL_PRIV_0 (get_file_num)
00153 SAGA_CALL_PRIV_0 (list_files)
00154 SAGA_CALL_PRIV_1 (add_file, saga::url)
00155 SAGA_CALL_PRIV_1 (get_file, int)
00156 SAGA_CALL_PRIV_2 (open_file, int, int)
00157 SAGA_CALL_PRIV_2 (open_file, saga::url, int)
00158 SAGA_CALL_PRIV_1 (remove_file, int)
00159 SAGA_CALL_PRIV_1 (remove_file, saga::url)
00160 SAGA_CALL_PRIV_2 (update_file, int, saga::url)
00161 SAGA_CALL_PRIV_2 (update_file, saga::url, saga::url)
00162 SAGA_CALL_PRIV_2 (stage_file, int, saga::url)
00163 SAGA_CALL_PRIV_2 (stage_file, saga::url, saga::url)
00164 SAGA_CALL_PRIV_1 (stage_file, saga::url)
00166
00167 protected:
00169
00170 TR1::shared_ptr <saga::impl::cpr_checkpoint> get_impl (void) const;
00171 explicit checkpoint(saga::impl::cpr_checkpoint *impl);
00173
00174 public:
00179 checkpoint (session const& s, saga::url url, int mode = Read);
00180
00185 explicit checkpoint (saga::url url, int mode = Read);
00186
00191 explicit checkpoint (saga::object const& o);
00192
00197 checkpoint (void);
00198
00203 ~checkpoint (void);
00204
00208 static checkpoint create(session const& s, saga::url url,
00209 int mode = Read)
00210 {
00211 return checkpoint(s, url, mode);
00212 }
00213 SAGA_CALL_CREATE_3_DEF_1(session const&, saga::url, int, Read)
00214
00215
00217 static checkpoint create(saga::url url, int mode = Read)
00218 {
00219 return checkpoint(url, mode);
00220 }
00221 template <typename Tag>
00222 static saga::task create(saga::url url, int mode = Read)
00223 {
00224 return create<Tag>(detail::get_the_session(), url, mode);
00225 }
00226
00231 checkpoint& operator=(saga::object const& o);
00232
00238 void set_parent (saga::url url, int generation = 1)
00239 {
00240 saga::task t = set_parentpriv(url, generation, saga::task_base::Sync());
00241 t.get_result ();
00242 }
00244 SAGA_CALL_PUB_2_DEF_1 (set_parent, saga::url, int, 1)
00246
00247
00252 saga::url get_parent (int generation = 1)
00253 {
00254 saga::task t = get_parentpriv(generation, saga::task_base::Sync());
00255 return t.get_result <saga::url> ();
00256 }
00258 SAGA_CALL_PUB_1_DEF_1 (get_parent, int, 1)
00260
00261
00262
00266 std::vector <saga::url> list_files (void)
00267 {
00268 saga::task t = list_filespriv (saga::task_base::Sync());
00269 return t.get_result <std::vector <saga::url> > ();
00270 }
00272 SAGA_CALL_PUB_0_DEF_0 (list_files)
00274
00275
00280 int add_file (saga::url url)
00281 {
00282 saga::task t = add_filepriv(url, saga::task_base::Sync());
00283 return t.get_result <int> ();
00284 }
00286 SAGA_CALL_PUB_1_DEF_0 (add_file, saga::url)
00288
00289
00290
00295 saga::url get_file (int id)
00296 {
00297 saga::task t = get_filepriv(id, saga::task_base::Sync());
00298 return t.get_result <saga::url> ();
00299 }
00301 SAGA_CALL_PUB_1_DEF_0 (get_file, int)
00303
00304
00305
00311 saga::filesystem::file open_file (int id,
00312 int flags = CreateParents | Lock | ReadWrite)
00313 {
00314 saga::task t = open_filepriv(id, flags, saga::task_base::Sync());
00315 return t.get_result <saga::filesystem::file> ();
00316 }
00318 SAGA_CALL_PUB_2_DEF_1 (open_file, int, int, CreateParents | Lock | ReadWrite )
00320
00321
00327 saga::filesystem::file open_file (saga::url url,
00328 int flags = CreateParents | Lock | ReadWrite)
00329 {
00330 saga::task t = open_filepriv(url, flags, saga::task_base::Sync());
00331 return t.get_result <saga::filesystem::file> ();
00332 }
00334 SAGA_CALL_PUB_2_DEF_1 (open_file, saga::url, int, CreateParents | Lock | ReadWrite)
00336
00337
00338
00344 void remove_file (int id)
00345 {
00346 saga::task t = remove_filepriv(id, saga::task_base::Sync());
00347 t.get_result ();
00348 }
00350 SAGA_CALL_PUB_1_DEF_0 (remove_file, int)
00352
00353
00358 void remove_file (saga::url url)
00359 {
00360 saga::task t = remove_filepriv(url, saga::task_base::Sync());
00361 t.get_result ();
00362 }
00364 SAGA_CALL_PUB_1_DEF_0 (remove_file, saga::url)
00366
00367
00368
00374 void update_file (int id, saga::url new_url)
00375 {
00376 saga::task t = update_filepriv(id, new_url, saga::task_base::Sync());
00377 t.get_result ();
00378 }
00380 SAGA_CALL_PUB_2_DEF_0 (update_file, int, saga::url)
00382
00383
00389 void update_file (saga::url old_url, saga::url new_url)
00390 {
00391 saga::task t = update_filepriv(old_url, new_url, saga::task_base::Sync());
00392 t.get_result ();
00393 }
00395 SAGA_CALL_PUB_2_DEF_0 (update_file, saga::url, saga::url)
00397
00398
00399
00405 void stage_file (int id, saga::url new_url)
00406 {
00407 saga::task t = stage_filepriv(id, new_url, saga::task_base::Sync());
00408 t.get_result ();
00409 }
00411 SAGA_CALL_PUB_2_DEF_0 (stage_file, int, saga::url)
00413
00414
00420 void stage_file (saga::url old_url, saga::url new_url)
00421 {
00422 saga::task t = stage_filepriv(old_url, new_url, saga::task_base::Sync());
00423 t.get_result ();
00424 }
00426 SAGA_CALL_PUB_2_DEF_0 (stage_file, saga::url, saga::url)
00428
00429
00434 void stage_file (saga::url new_url)
00435 {
00436 saga::task t = stage_filepriv(new_url, saga::task_base::Sync());
00437 t.get_result ();
00438 }
00440 SAGA_CALL_PUB_1_DEF_0 (stage_file, saga::url)
00442 };
00443
00444 }}
00445
00446 #if defined(__WAVE__)
00447 #pragma wave option(output: null)
00448 #endif
00449
00450 #endif // !defined(SAGA_DEBUG)
00451
00452
00453 #if defined(BOOST_MSVC)
00454 #pragma warning(pop)
00455 #endif
00456
00457 #endif // !defined(SAGA_PACKAGES_DATA_CPR_CHECKPOINT_HPP)
00458