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

- Search for |

# attribute.hpp

Go to the documentation of this file.

    00001 //  Copyright (c) 2005-2009 Hartmut Kaiser
    00002 //  Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net)
    00003 //  Copyright (c) 2007 Ole Weidner (oweidner@cct.lsu.edu)
    00004 //
    00005 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
    00006 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
    00007
    00008 #ifndef SAGA_ATTRIBUTE_HPP
    00009 #define SAGA_ATTRIBUTE_HPP
    00010
    00011 // include stl
    00012 #include <map>
    00013 #include <vector>
    00014 #include <string>
    00015
    00016 // include dependent spec sections
    00017 #include <saga/saga/util.hpp>
    00018 #include <saga/saga/base.hpp>
    00019
    00020 #include <saga/saga/detail/attribute.hpp>
    00021
    00022 // suppress warnings about dependent classes not being exported from the dll
    00023 #if defined(BOOST_MSVC)
    00024 #pragma warning(push)
    00025 #pragma warning(disable : 4251 4231 4660)
    00026 #endif
    00027
    00029 //
    00030 // This is the relevant SIDL section from the SAGA spec.
    00031 //
    00033 //
    00034 //  package saga.attribute
    00035 //  {
    00036 //    interface attribute
    00037 //    {
    00038 //      // interface - no CONSTRUCTOR/DESTRUCTOR
    00039 //
    00040 //      // setter / getters
    00041 //      set_attribute           (in  string          key,
    00042 //                               in  string          value);
    00043 //      get_attribute           (in  string          key,
    00044 //                               out string          value);
    00045 //      set_vector_attribute    (in  string          key,
    00046 //                               in  array<string,1> values);
    00047 //      get_vector_attribute    (in  string          key,
    00048 //                               out array<string,1> values);
    00049 //      remove_attribute        (in  string          key);
    00050 //
    00051 //      // inspection methods
    00052 //      list_attributes         (out array<string,1> keys);
    00053 //      find_attributes         (in  string          pattern,
    00054 //                               out array<string,1> keys);
    00055 //      attribute_exists        (in  string          key,
    00056 //                               out bool            test);
    00057 //      attribute_is_readonly   (in  string          key,
    00058 //                               out bool            test);
    00059 //      attribute_is_writable   (in  string          key,
    00060 //                               out bool            test);
    00061 //      attribute_is_vector     (in  string          key,
    00062 //                               out bool            test);
    00063 //    }
    00064 //  }
    00065 //
    00067
    00069 namespace saga
    00070 {
    00072   namespace attributes
    00073   {
    00074     // common attribute values
    00075     char const* const common_true  = "True";
    00076     char const* const common_false  = "False";
    00077   }
    00078
    00083   class SAGA_EXPORT attribute
    00084   :   public saga::detail::attribute<attribute>
    00085   {
    00086     private:
    00087       friend struct saga::detail::attribute<attribute>;  // needs to access get_impl()
    00088       TR1::shared_ptr <saga::impl::object> impl_;
    00089
    00090     public:
    00092
    00093       typedef saga::impl::object implementation_base_type;
    00094       typedef std::vector <std::string> strvec_type;
    00095       typedef std::map <std::string, std::string> strmap_type;
    00097
    00098     protected:
    00100
    00101       TR1::shared_ptr<saga::impl::object> get_impl_sp (void) const { return impl_; }
    00102       saga::impl::object* get_impl (void) const { return impl_.get(); }
    00103       bool is_impl_valid() const { return impl_ ? true : false; }
    00105
    00106     public:
    00111       explicit attribute (saga::impl::object *impl);    // adaptor interface
    00112
    00117       attribute (saga::object rhs);
    00118
    00123       attribute (void);
    00124
    00129       ~attribute (void);
    00130   };
    00131
    00133 } // namespace saga
    00134
    00135 #if defined(BOOST_MSVC)
    00136 #pragma warning(pop)
    00137 #endif
    00138
    00139 #endif // SAGA_ATTRIBUTE_HPP
    00140