39 #ifndef OME_COMMON_XML_DOM_BASE_H 40 #define OME_COMMON_XML_DOM_BASE_H 42 #include <ome/common/config.h> 95 template<
typename Deleter>
97 Base(base_element_type *wrapped,
100 ome::compat::shared_ptr<base_element_type>(wrapped, del) :
101 ome::compat::shared_ptr<base_element_type>())
110 Base(base_element_type *wrapped):
112 ome::compat::shared_ptr<base_element_type>(wrapped, &
ome::common::xml::dom::detail::unmanaged<base_element_type>) :
113 ome::compat::shared_ptr<base_element_type>())
141 const base_element_type*
152 operator bool ()
const 166 ome::compat::shared_ptr<base_element_type> n;
181 throw std::logic_error(
"Accessing null wrapped DOM type");
204 assign(ome::compat::shared_ptr<base_element_type>& wrapped)
223 D *newderived =
dynamic_cast<D *
>(newbase);
224 if (newbase && !newderived)
225 throw std::logic_error(
"Failed to assign incompatible wrapped DOM type");
231 ome::compat::shared_ptr<base_element_type>
base;
239 #endif // OME_COMMON_XML_DOM_BASE_H Base()
Constructor.
Definition: Base.h:85
virtual void assign(ome::compat::shared_ptr< base_element_type > &wrapped)
Assign a new wrapped value.
Definition: Base.h:204
Memory type substitution.
virtual ~Base()
Destructor.
Definition: Base.h:118
void reset()
Free the managed resource.
Definition: Base.h:163
Base(base_element_type *wrapped, Deleter del)
Construct with initial wrapped value (managed).
Definition: Base.h:97
Base of the DOM wrapper hierarchy.
Definition: Base.h:76
T base_element_type
Base element type (root type of the wrapped type).
Definition: Base.h:82
D * assign_check(base_element_type *newbase)
Check that a new wrapped value is of the correct derived type.
Definition: Base.h:221
Base base_type
Base type.
Definition: Base.h:80
virtual void assign(const base_type &wrapped)
Assign a new wrapped value.
Definition: Base.h:191
ome::compat::shared_ptr< base_element_type > base
Wrapped reference.
Definition: Base.h:231
Base(base_element_type *wrapped)
Construct with initial wrapped value (unmanaged).
Definition: Base.h:110
virtual void null_check() const
Check if the wrapped type is NULL.
Definition: Base.h:178