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

- Search for |

# advert.hpp

Go to the documentation of this file.

    00001 #ifndef SAGA_PACKAGES_DATA_ADVERT_ADVERT_HPP
    00002 #define SAGA_PACKAGES_DATA_ADVERT_ADVERT_HPP
    00003
    00004 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
    00005 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/advert.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__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
    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 #include <boost/utility/enable_if.hpp>
    00025 #include <boost/lexical_cast.hpp>
    00026
    00027 // include dependent spec sections
    00028 #include <saga/saga/util.hpp>
    00029 #include <saga/saga/base.hpp>
    00030 #include <saga/saga/types.hpp>
    00031 #include <saga/saga/session.hpp>
    00032 #include <saga/saga/call.hpp>
    00033 #include <saga/saga/detail/attribute.hpp>
    00034 #include <saga/saga/detail/monitorable.hpp>
    00035
    00036 #include <saga/saga/packages/namespace/namespace_entry.hpp>
    00037 #include <saga/saga/packages/advert/config.hpp>
    00038
    00039 // suppress warnings about dependent classes not being exported from the dll
    00040 #if defined(BOOST_MSVC)
    00041 #pragma warning(push)
    00042 #pragma warning(disable: 4251 4231 4275 4660)
    00043 #endif
    00044
    00045 #ifdef SAGA_DEBUG
    00046 #include <saga/saga/packages/advert/preprocessed/advert.hpp>
    00047 #else
    00048
    00049 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
    00050 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/advert.hpp")
    00051 #endif
    00052
    00053 #if !defined(SAGA_ADVERT_NO_DEPRECATED)
    00054 #define SAGA_ADVERT_DEPRECATED_MSG "This function is deprecated and will be removed in the future."
    00055 #endif
    00056
    00058 namespace saga
    00059 {
    00063     namespace advert
    00064     {
    00068         namespace metrics
    00069         {
    00073             char const* const advert_modified = "advert.Modified";
    00074
    00078             char const* const advert_deleted = "advert.Deleted";
    00079         }
    00080
    00084         enum flags
    00085         {
    00086             Unknown         = /*  -1, */  saga::name_space::Unknown,
    00087             None            = /*   0, */  saga::name_space::None,
    00088             Overwrite       = /*   1, */  saga::name_space::Overwrite,
    00089             Recursive       = /*   2, */  saga::name_space::Recursive,
    00090             Dereference     = /*   4, */  saga::name_space::Dereference,
    00091             Create          = /*   8, */  saga::name_space::Create,
    00092             Exclusive       = /*  16, */  saga::name_space::Exclusive,
    00093             Lock            = /*  32, */  saga::name_space::Lock,
    00094             CreateParents   = /*  64, */  saga::name_space::CreateParents,
    00095             // 256, reserved for Truncate
    00096             // 512,  reserved for Append
    00097             Read            =    512,
    00098             Write           =   1024,
    00099             ReadWrite       =   Read | Write
    00100             // 2048, reserved for Binary
    00101         };
    00102
    00110         class SAGA_ADVERT_PACKAGE_EXPORT entry
    00111           : public saga::name_space::entry,
    00112             public saga::detail::attribute<entry>
    00113         {
    00114         protected:
    00116
    00117             friend class saga::impl::advert;
    00118
    00119             friend struct saga::detail::attribute<entry>;
    00120             typedef saga::detail::attribute<entry> attribute_base;
    00121             typedef saga::name_space::entry::monitorable_base monitorable_base;
    00122
    00123             TR1::shared_ptr <saga::impl::advert> get_impl_sp(void) const;
    00124             saga::impl::advert* get_impl (void) const;
    00125             explicit entry(saga::impl::advert *impl);
    00127
    00128         private:
    00130             // factory
    00131             SAGA_CALL_CREATE_PRIV_3(session const&, saga::url const&, int)
    00132
    00133             SAGA_CALL_PRIV_1(store_object, saga::object)
    00134             SAGA_CALL_PRIV_0(retrieve_object)
    00135             SAGA_CALL_PRIV_1(retrieve_object, saga::session)
    00136             SAGA_CALL_PRIV_1(store_string, std::string)
    00137             SAGA_CALL_PRIV_0(retrieve_string)
    00139
    00140             template <typename Tag, typename T>
    00141             saga::task store_object_or_string (Tag, T const& object, boost::mpl::true_)
    00142             {
    00143                 return store_objectpriv(object, Tag());
    00144             }
    00145
    00146             template <typename Tag, typename T>
    00147             saga::task store_object_or_string (Tag, T const& object, boost::mpl::false_)
    00148             {
    00149                 return store_stringpriv(
    00150                     boost::lexical_cast<std::string>(object), Tag());
    00151             }
    00152
    00153         public:
    00157             entry (saga::session const& s, saga::url url, int mode = Read);
    00158
    00162             explicit entry (saga::url url, int mode = Read);
    00163
    00166             explicit entry (saga::object const& other);
    00167
    00170             entry (void);
    00171
    00175             ~entry (void);
    00176
    00180             static entry create(session const& s, saga::url const& url,
    00181                 int mode = Read)
    00182             {
    00183                 return entry(s, url, mode);
    00184             }
    00186             SAGA_CALL_CREATE_3_DEF_1(session const&, saga::url const&, int, Read)
    00188
    00191             static entry create(saga::url const& url, int mode = Read)
    00192             {
    00193                 return entry(url, mode);
    00194             }
    00195             template <typename Tag>
    00196             static saga::task create(saga::url const& url, int mode = Read)
    00197             {
    00198                 return create<Tag>(detail::get_the_session(), url, mode);
    00199             }
    00200
    00202             entry &operator= (saga::object const& object);
    00204
    00210             void store_object (saga::object object)
    00211             {
    00212                 saga::task t = store_objectpriv(object, saga::task_base::Sync());
    00213                 t.get_result ();
    00214             }
    00215
    00216             template <typename T>
    00217             typename boost::disable_if<detail::has_sync_tag<T> >::type
    00218             store_object (T const& object)
    00219             {
    00220                 typedef typename detail::is_saga_object<T>::type is_saga_object;
    00221                 saga::task t = store_object_or_string(saga::task_base::Sync(),
    00222                     object, is_saga_object());
    00223                 t.get_result();
    00224             }
    00226             template <typename Tag, typename T>
    00227             typename boost::enable_if<detail::has_sync_tag<Tag>, saga::task>::type
    00228             store_object (T const& object)
    00229             {
    00230                 typedef typename detail::is_saga_object<T>::type is_saga_object;
    00231                 return store_object_or_string(Tag(), object, is_saga_object());
    00232             }
    00234
    00240             saga::object retrieve_object()
    00241             {
    00242                 saga::task t = retrieve_objectpriv (saga::task_base::Sync());
    00243                 return t.get_result<saga::object>();
    00244             }
    00246 //            SAGA_CALL_PUB_0_DEF_0(retrieve_object)
    00247             template <typename Tag>
    00248             typename boost::enable_if<detail::has_sync_tag<Tag>, saga::task>::type
    00249             retrieve_object()
    00250             {
    00251                 return retrieve_objectpriv(Tag());
    00252             }
    00254
    00255             template <typename T>
    00256             T& retrieve_object(
    00257                 typename boost::disable_if<detail::has_sync_tag<T> >::type* = 0)
    00258             {
    00259                 saga::task t = retrieve_stringpriv (saga::task_base::Sync());
    00260                 return t.get_result<T>();
    00261             }
    00263             template <typename T, typename Tag>
    00264             typename boost::disable_if<detail::has_sync_tag<T>, saga::task>::type
    00265             retrieve_object()
    00266             {
    00267                 return retrieve_stringpriv(Tag());
    00268             }
    00270
    00278             saga::object retrieve_object (saga::session const& s)
    00279             {
    00280                 saga::task t = retrieve_objectpriv(s, saga::task_base::Sync());
    00281                 return t.get_result<saga::object>();
    00282             }
    00284             template <typename Tag>
    00285             typename boost::enable_if<detail::has_sync_tag<Tag>, saga::task>::type
    00286             retrieve_object(saga::session const& s)
    00287             {
    00288                 return retrieve_objectpriv(s, Tag());
    00289             }
    00291
    00292 #if !defined(SAGA_ADVERT_NO_DEPRECATED)
    00294
    00299             SAGA_DEPRECATED(SAGA_ADVERT_DEPRECATED_MSG)
    00300             void store_string (std::string str)
    00301             {
    00302                 saga::task t = store_stringpriv(str, saga::task_base::Sync());
    00303                 t.get_result ();
    00304             }
    00305 //             SAGA_CALL_PUB_1_DEF_0(store_string, std::string)
    00307             template <typename Tag>
    00308             SAGA_DEPRECATED(SAGA_ADVERT_DEPRECATED_MSG)
    00309             saga::task store_string(std::string str)
    00310             {
    00311                 return store_stringpriv(str, Tag());
    00312             }
    00314
    00320             SAGA_DEPRECATED(SAGA_ADVERT_DEPRECATED_MSG)
    00321             std::string retrieve_string (void)
    00322             {
    00323                 saga::task t = retrieve_stringpriv (saga::task_base::Sync());
    00324                 return t.get_result<std::string>();
    00325             }
    00326 //             SAGA_CALL_PUB_0_DEF_0(retrieve_string)
    00328             template <typename Tag>
    00329             SAGA_DEPRECATED(SAGA_ADVERT_DEPRECATED_MSG)
    00330             saga::task retrieve_string()
    00331             {
    00332                 return retrieve_stringpriv(Tag());
    00333             }
    00335 #endif
    00336
    00337         }; // class advert
    00338     } // namespace advert
    00339 } // namespace saga
    00340
    00341 #undef SAGA_ADVERT_DEPRECATED_MSG
    00342
    00343 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES)
    00344 #pragma wave option(output: null)
    00345 #endif
    00346
    00347 #endif // !defined(SAGA_DEBUG)
    00348
    00349 // re-enable warnings about dependent classes not being exported from the dll
    00350 #if defined(BOOST_MSVC)
    00351 #pragma warning(pop)
    00352 #endif
    00353
    00354 #endif // !defined(SAGA_PACKAGES_DATA_ADVERT_ADVERT_HPP)
    00355