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>
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
bool operator==(std::nullptr_t) const
Check if the wrapped type is null.
Definition: Base.h:163
Base()
Constructor.
Definition: Base.h:85
std::shared_ptr< base_element_type > base
Wrapped reference.
Definition: Base.h:253
virtual ~Base()
Destructor.
Definition: Base.h:118
void reset()
Free the managed resource.
Definition: Base.h:185
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
bool operator!=(std::nullptr_t) const
Check if the wrapped type is not null.
Definition: Base.h:174
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:200