- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Search for |

# cpr_checkpoint.hpp

Go to the documentation of this file.

    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 //  Copyright (c) 2005-2009 Hartmut Kaiser
    00008 //  Copyright (c) 2007 Ole Weidner (oweidner@cct.lsu.edu)
    00009 //  Copyright (c) 2008 Andre Merzky (andre@merzky.net)
    00010 //
    00011 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
    00012 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
    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 // include dependent spec sections
    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 // suppress warnings about dependent classes not being exported from the dll
    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             //  metric names for a advert entries
    00063             char const* const checkpoint_modified = "checkpoint.Modified";
    00064             char const* const checkpoint_deleted  = "checkpoint.Deleted";
    00065         }
    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             Truncate        =    128,
    00087             Append          =    256,
    00088             Read            =    512,
    00089             Write           =   1024,
    00090             ReadWrite       =   Read | Write
    00091             // Binary          =   2048      // reserved
    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>;  // needs to access get_impl()
    00140             typedef saga::detail::attribute<checkpoint> attribute_base;
    00141             typedef saga::name_space::entry::monitorable_base monitorable_base;
    00143
    00144         private:
    00146             // factory
    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_sp(void) const;
    00171             saga::impl::cpr_checkpoint* get_impl (void) const;
    00172             explicit checkpoint(saga::impl::cpr_checkpoint *impl);
    00174
    00175         public:
    00180             checkpoint (session const& s, saga::url url, int mode = Read);
    00181
    00186             explicit checkpoint (saga::url url, int mode = Read);
    00187
    00192             explicit checkpoint (saga::object const& o);
    00193
    00198             checkpoint (void);
    00199
    00204             ~checkpoint (void);
    00205
    00209             static checkpoint create(session const& s, saga::url url,
    00210                 int mode = Read)
    00211             {
    00212                 return checkpoint(s, url, mode);
    00213             }
    00214             SAGA_CALL_CREATE_3_DEF_1(session const&, saga::url, int, Read)
    00215
    00216
    00218             static checkpoint create(saga::url url, int mode = Read)
    00219             {
    00220                 return checkpoint(url, mode);
    00221             }
    00222             template <typename Tag>
    00223             static saga::task create(saga::url url, int mode = Read)
    00224             {
    00225                 return create<Tag>(detail::get_the_session(), url, mode);
    00226             }
    00227
    00232             checkpoint& operator=(saga::object const& o);
    00233
    00239             void set_parent (saga::url url, int generation = 1)
    00240             {
    00241                 saga::task t = set_parentpriv(url, generation, saga::task_base::Sync());
    00242                 t.get_result ();
    00243             }
    00245             SAGA_CALL_PUB_2_DEF_1 (set_parent, saga::url, int, 1)
    00247
    00248
    00253             saga::url get_parent (int generation = 1)
    00254             {
    00255                 saga::task t = get_parentpriv(generation, saga::task_base::Sync());
    00256                 return t.get_result <saga::url> ();
    00257             }
    00259             SAGA_CALL_PUB_1_DEF_1 (get_parent, int, 1)
    00261
    00262
    00263
    00267             std::vector <saga::url> list_files (void)
    00268             {
    00269                 saga::task t = list_filespriv (saga::task_base::Sync());
    00270                 return t.get_result <std::vector <saga::url> > ();
    00271             }
    00273             SAGA_CALL_PUB_0_DEF_0 (list_files)
    00275
    00276
    00281             int add_file (saga::url url)
    00282             {
    00283                 saga::task t = add_filepriv(url, saga::task_base::Sync());
    00284                 return t.get_result <int> ();
    00285             }
    00287             SAGA_CALL_PUB_1_DEF_0 (add_file, saga::url)
    00289
    00290
    00291
    00296             saga::url get_file (int id)
    00297             {
    00298                 saga::task t = get_filepriv(id, saga::task_base::Sync());
    00299                 return t.get_result <saga::url> ();
    00300             }
    00302             SAGA_CALL_PUB_1_DEF_0 (get_file, int)
    00304
    00305
    00306
    00312             saga::filesystem::file open_file (int id,
    00313                                               int flags = CreateParents | Lock | ReadWrite)
    00314             {
    00315                 saga::task t = open_filepriv(id, flags, saga::task_base::Sync());
    00316                 return t.get_result <saga::filesystem::file> ();
    00317             }
    00319             SAGA_CALL_PUB_2_DEF_1 (open_file, int, int, CreateParents | Lock | ReadWrite )
    00321
    00322
    00328             saga::filesystem::file open_file (saga::url url,
    00329                                               int flags = CreateParents | Lock | ReadWrite)
    00330             {
    00331                 saga::task t = open_filepriv(url, flags, saga::task_base::Sync());
    00332                 return t.get_result <saga::filesystem::file> ();
    00333             }
    00335             SAGA_CALL_PUB_2_DEF_1 (open_file, saga::url, int, CreateParents | Lock | ReadWrite)
    00337
    00338
    00339
    00345             void remove_file (int id)
    00346             {
    00347                 saga::task t = remove_filepriv(id, saga::task_base::Sync());
    00348                 t.get_result ();
    00349             }
    00351             SAGA_CALL_PUB_1_DEF_0 (remove_file, int)
    00353
    00354
    00359             void remove_file (saga::url url)
    00360             {
    00361                 saga::task t = remove_filepriv(url, saga::task_base::Sync());
    00362                 t.get_result ();
    00363             }
    00365             SAGA_CALL_PUB_1_DEF_0 (remove_file, saga::url)
    00367
    00368
    00369
    00375             void update_file (int id, saga::url new_url)
    00376             {
    00377                 saga::task t = update_filepriv(id, new_url, saga::task_base::Sync());
    00378                 t.get_result ();
    00379             }
    00381             SAGA_CALL_PUB_2_DEF_0 (update_file, int, saga::url)
    00383
    00384
    00390             void update_file (saga::url old_url, saga::url new_url)
    00391             {
    00392                 saga::task t = update_filepriv(old_url, new_url, saga::task_base::Sync());
    00393                 t.get_result ();
    00394             }
    00396             SAGA_CALL_PUB_2_DEF_0 (update_file, saga::url, saga::url)
    00398
    00399
    00400
    00406             void stage_file (int id, saga::url new_url)
    00407             {
    00408                 saga::task t = stage_filepriv(id, new_url, saga::task_base::Sync());
    00409                 t.get_result ();
    00410             }
    00412             SAGA_CALL_PUB_2_DEF_0 (stage_file, int, saga::url)
    00414
    00415
    00421             void stage_file (saga::url old_url, saga::url new_url)
    00422             {
    00423                 saga::task t = stage_filepriv(old_url, new_url, saga::task_base::Sync());
    00424                 t.get_result ();
    00425             }
    00427             SAGA_CALL_PUB_2_DEF_0 (stage_file, saga::url, saga::url)
    00429
    00430
    00435             void stage_file (saga::url new_url)
    00436             {
    00437                 saga::task t = stage_filepriv(new_url, saga::task_base::Sync());
    00438                 t.get_result ();
    00439             }
    00441             SAGA_CALL_PUB_1_DEF_0 (stage_file, saga::url)
    00443         };
    00444
    00445     }}
    00446
    00447 #if defined(__WAVE__)
    00448 #pragma wave option(output: null)
    00449 #endif
    00450
    00451 #endif // !defined(SAGA_DEBUG)
    00452
    00453 // re-enable warnings about dependent classes not being exported from the dll
    00454 #if defined(BOOST_MSVC)
    00455 #pragma warning(pop)
    00456 #endif
    00457
    00458 #endif // !defined(SAGA_PACKAGES_DATA_CPR_CHECKPOINT_HPP)
    00459