39 #ifndef OME_COMMON_XML_DOM_BASE_H 40 #define OME_COMMON_XML_DOM_BASE_H 44 #include <ome/common/config.h> 95 template<
typename Deleter>
97 Base(base_element_type *wrapped,
100 std::shared_ptr<base_element_type>(wrapped, del) :
101 std::shared_ptr<base_element_type>())
110 Base(base_element_type *wrapped):
112 std::shared_ptr<base_element_type>(wrapped, &
ome::common::xml::dom::detail::unmanaged<base_element_type>) :
113 std::shared_ptr<base_element_type>())
141 const base_element_type*
152 operator bool ()
const 154 return get() !=
nullptr;
165 return get() ==
nullptr;
176 return get() !=
nullptr;
188 std::shared_ptr<base_element_type> n;
203 throw std::logic_error(
"Accessing null wrapped DOM type");
226 assign(std::shared_ptr<base_element_type>& wrapped)
245 D *newderived =
dynamic_cast<D *
>(newbase);
246 if (newbase && !newderived)
247 throw std::logic_error(
"Failed to assign incompatible wrapped DOM type");
253 std::shared_ptr<base_element_type>
base;
261 #endif // OME_COMMON_XML_DOM_BASE_H Base()
Constructor.
Definition: Base.h:85
std::shared_ptr< base_element_type > base
Wrapped reference.
Definition: Base.h:253
bool operator!=(const boolean &lhs, bool rhs)
Compare boolean with bool for inequality.
Definition: boolean.h:214
virtual ~Base()
Destructor.
Definition: Base.h:118
bool operator==(const boolean &lhs, bool rhs)
Compare boolean with bool for equality.
Definition: boolean.h:172
void reset()
Free the managed resource.
Definition: Base.h:185
virtual void null_check() const
Check if the wrapped type is null.
Definition: Base.h:200
Open Microscopy Environment C++.
Definition: base64.h:48
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:243
Base base_type
Base type.
Definition: Base.h:80
virtual void assign(const base_type &wrapped)
Assign a new wrapped value.
Definition: Base.h:213
virtual void assign(std::shared_ptr< base_element_type > &wrapped)
Assign a new wrapped value.
Definition: Base.h:226
Base(base_element_type *wrapped)
Construct with initial wrapped value (unmanaged).
Definition: Base.h:110