SAGA C++ API 1.6
logical_directory.hpp
Go to the documentation of this file.
00001 #ifndef SAGA_SAGA_PACKAGES_DATA_REPLICA_LOGICAL_DIRECTORY_HPP
00002 #define SAGA_SAGA_PACKAGES_DATA_REPLICA_LOGICAL_DIRECTORY_HPP
00003 
00004 #if defined(__WAVE__)
00005 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/logical_directory.hpp")
00006 #endif
00007 //  Copyright (c) 2005-2009 Hartmut Kaiser
00008 //  Copyright (c) 2007 Ole Weidner (oweidner@cct.lsu.edu)
00009 // 
00010 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
00011 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00012 
00013 #if defined(__WAVE__)
00014 #pragma wave option(output: null)
00015 #endif
00016 
00017 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
00018 #pragma once
00019 #endif 
00020 
00021 // include stl
00022 #include <string>
00023 
00024 // include dependent spec sections
00025 #include <saga/saga/util.hpp>
00026 #include <saga/saga/base.hpp>
00027 #include <saga/saga/call.hpp>
00028 #include <saga/saga/types.hpp>
00029 #include <saga/saga/object.hpp>
00030 #include <saga/saga/session.hpp>
00031 #include <saga/saga/detail/attribute.hpp>
00032 
00033 #include <saga/saga/packages/namespace/namespace_dir.hpp>
00034 #include <saga/saga/packages/replica/logical_file.hpp>
00035 
00036 // suppress warnings about dependent classes not being exported from the dll
00037 #if defined(BOOST_MSVC)
00038 #pragma warning(push)
00039 #pragma warning(disable: 4251 4231 4275 4660)
00040 #endif
00041 
00042 #ifdef SAGA_DEBUG
00043 #include <saga/saga/packages/replica/preprocessed/logical_directory.hpp>
00044 #else
00045 
00046 #if defined(__WAVE__)
00047 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/logical_directory.hpp")
00048 #endif
00049 
00050 namespace saga 
00051 {
00052     namespace replica 
00053     {
00054         
00056         
00057         namespace metrics 
00058         {
00060             //  metric names for a advert entries
00061             char const* const logical_directory_created_entry = "logical_directory.CreatedEntry";
00062             char const* const logical_directory_modified_entry = "logical_directory.ModifiedEntry";
00063             char const* const logical_directory_deleted_entry = "logical_directory.DeletedEntry";
00064         }
00065         
00066         
00075         class SAGA_REPLICA_PACKAGE_EXPORT logical_directory 
00076         : public saga::name_space::directory,
00077         public saga::detail::attribute<logical_directory>
00078         {
00079         protected:
00081 
00082             friend class saga::impl::logical_directory;
00083             friend struct saga::detail::attribute<logical_directory>;  // needs to access get_impl()
00084             typedef saga::detail::attribute<logical_directory> attribute_base;
00085             typedef saga::name_space::directory::monitorable_base monitorable_base;
00087             
00088         private:
00090             // factory
00091             SAGA_CALL_CREATE_PRIV_3(session const&, saga::url, int)
00092 
00093             
00094             SAGA_CALL_PRIV_1(is_file, saga::url)
00095 
00096             // overload open methods from namespace_dir
00097             SAGA_CALL_PRIV_2(open, saga::url, int)
00098             SAGA_CALL_PRIV_2(open_dir, saga::url, int)
00099             SAGA_CALL_PRIV_3(find, std::string, std::vector<std::string>, int)
00101             
00102         protected:
00104 
00105             TR1::shared_ptr <saga::impl::logical_directory> get_impl_sp() const;
00106             saga::impl::logical_directory* get_impl() const;
00107             explicit logical_directory(saga::impl::logical_directory *impl);
00109             
00110         public:
00115             logical_directory (session const& s, saga::url url, 
00116                                int mode = saga::replica::ReadWrite);
00117 
00122             explicit logical_directory (saga::url url, 
00123                                         int mode = saga::replica::ReadWrite);
00124 
00129             explicit logical_directory (saga::object const& o);
00130 
00135             logical_directory (void);
00136 
00141             ~logical_directory (void);
00142 
00146             static logical_directory create(session const& s, saga::url url, 
00147                 int mode = Read)
00148             {
00149                 return logical_directory(s, url, mode);
00150             }
00151             SAGA_CALL_CREATE_3_DEF_1(session const&, saga::url, int, Read)
00152 
00153             
00155             static logical_directory create(saga::url url, int mode = Read)
00156             {
00157                 return logical_directory(url, mode);
00158             }
00159             template <typename Tag>
00160             static saga::task create(saga::url url, int mode = Read)
00161             {
00162                 return create<Tag>(detail::get_the_session(), url, mode);
00163             }
00164 
00169             logical_directory& operator=(saga::object const& o);
00170 
00176             bool is_file(saga::url url) 
00177             {
00178                 saga::task t = is_filepriv(url, saga::task_base::Sync()); 
00179                 return t.get_result<bool>();
00180             }
00181             SAGA_CALL_PUB_1_DEF_0(is_file, saga::url)
00182             
00183             
00191             saga::replica::logical_file open(saga::url url, 
00192                                              int flags = saga::replica::Read) 
00193             {
00194                 saga::task t = openpriv(url, flags, saga::task_base::Sync()); 
00195                 return t.get_result<saga::replica::logical_file>();
00196             }
00197             SAGA_CALL_PUB_2_DEF_1(open, saga::url, int, saga::replica::Read)
00198             
00199             
00207             saga::replica::logical_directory open_dir(saga::url url, 
00208                                                       int flags
00209                                                       = saga::replica::Read) 
00210             {
00211                 saga::task t = open_dirpriv(url, flags, saga::task_base::Sync()); 
00212                 return t.get_result<saga::replica::logical_directory>();
00213             }
00214             SAGA_CALL_PUB_2_DEF_1(open_dir, saga::url, int, saga::replica::Read)
00215             
00216             
00226             std::vector<saga::url> find(std::string name_pattern, 
00227                                         std::vector<std::string> key_pattern, 
00228                                         int flags = saga::replica::Recursive) 
00229             {
00230                 saga::task t = findpriv(name_pattern, key_pattern, flags,
00231                                         saga::task_base::Sync()); 
00232                 return t.get_result<std::vector<saga::url> >();
00233             }
00234             SAGA_CALL_PUB_3_DEF_1(find, std::string, std::vector<std::string>, 
00235                                   int, saga::replica::None)
00236         }; 
00237         
00238     }}
00239 
00240 #if defined(__WAVE__)
00241 #pragma wave option(output: null)
00242 #endif
00243 
00244 #endif // !defined(SAGA_DEBUG)
00245 
00246 // re-enable warnings about dependent classes not being exported from the dll
00247 #if defined(BOOST_MSVC)
00248 #pragma warning(pop)
00249 #endif
00250 
00251 #endif // SAGA_SAGA_PACKAGES_DATA_REPLICA_LOGICAL_DIRECTORY_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines