// Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net) // Copyright (c) 2005-2007 Hartmut Kaiser (hartmut.kaiser@gmail.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef SAGA_IMPL_ENGINE_ATTRIBUTE_HPP #define SAGA_IMPL_ENGINE_ATTRIBUTE_HPP // include stl #include #include #include #include #include #include #include // suppress warnings about dependent classes not being exported from the dll #if defined(BOOST_MSVC) #pragma warning(push) #pragma warning(disable : 4251 4231 4660) #endif /////////////////////////////////////////////////////////////////////////////// namespace saga { namespace impl { // in SAGA, attribute is actually an interface. However, our implementation // does not shy back from multiple inheritance, and implement it here... class SAGA_EXPORT attribute : public attribute_interface { public: typedef std::vector strvec_type; typedef std::map strmap_type; private: // the attributes attribute_cache attributes_; bool cache_only_; protected: bool is_valid_key(std::string const& key) const; public: attribute (void); attribute (attribute const& rhs); virtual ~attribute (void) {} void init (strmap_type const& ro_scalar, strmap_type const& rw_scalar, strmap_type const& ro_vector, strmap_type const& rw_vector); void init (bool extensible, bool cache_only = false); void init_keynames(strvec_type const& keynames); // setters/getters SAGA_CALL_IMPL_DECL_1(std::string, get_attribute, std::string) SAGA_CALL_IMPL_DECL_2(saga::void_t, set_attribute, std::string, std::string) SAGA_CALL_IMPL_DECL_1(strvec_type, get_vector_attribute, std::string) SAGA_CALL_IMPL_DECL_2(saga::void_t, set_vector_attribute, std::string, strvec_type) SAGA_CALL_IMPL_DECL_1(saga::void_t, remove_attribute, std::string) // inspection SAGA_CALL_IMPL_DECL_0(strvec_type, list_attributes) SAGA_CALL_IMPL_DECL_1(strvec_type, find_attributes, std::string) SAGA_CALL_IMPL_DECL_1(bool, attribute_exists, std::string) SAGA_CALL_IMPL_DECL_1(bool, attribute_is_readonly, std::string) SAGA_CALL_IMPL_DECL_1(bool, attribute_is_writable, std::string) SAGA_CALL_IMPL_DECL_1(bool, attribute_is_vector, std::string) SAGA_CALL_IMPL_DECL_1(bool, attribute_is_extended, std::string) bool attributes_extensible () const; attribute clone() const; bool is_equal(attribute const& rhs) const; // get_proxy returns the internal implementation of the // impl::object interface virtual saga::impl::proxy* get_proxy(); virtual saga::impl::proxy const* get_proxy() const; attribute_cache *get_cache() { return &attributes_; } }; } // namespace impl } // namespace saga #if defined(BOOST_MSVC) #pragma warning(pop) #endif #endif // SAGA_IMPL_ENGINE_ATTRIBUTE_HPP