1#ifndef BPMN_BaseElement_H
2#define BPMN_BaseElement_H
38 template<
typename T> T*
is() {
39 return dynamic_cast<T*
>(
element);
46 template<
typename T>
const T*
is()
const {
47 return dynamic_cast<const T*
>(
element);
55 template<
typename T = XML::bpmn::tBaseElement> T*
get() {
56 T* ptr =
dynamic_cast<T*
>(
element);
57 if ( ptr ==
nullptr ) {
58 throw std::runtime_error(
"Element: Illegal cast of element '" + (
element->id.has_value() ? (std::string)
element->id->get().value :
"") +
"'");
68 template<
typename T = XML::bpmn::tBaseElement>
const T*
get()
const {
69 const T* ptr =
dynamic_cast<const T*
>(
element);
70 if ( ptr ==
nullptr ) {
71 throw std::runtime_error(
"Element: Illegal cast of element" + (
element->id.has_value() ?
" '" + (std::string)
element->id->get().value +
"'" :
"" ) );
T * is()
Attempts to return the element in the specified type T.
std::unique_ptr< ExtensionElements > extensionElements
const T * get() const
Casts the element to the specified type T.
std::string id
Id of element.
const T * is() const
Attempts to return the element in the specified type T.
BaseElement(XML::bpmn::tBaseElement *element)
Constructs a BaseElement object representing a BPMN element.
~BaseElement()
Destructor.
XML::bpmn::tBaseElement * element
T * get()
Casts the element to the specified type T.
Abstract base class for all elements in a BPMN model.
Base class for extension elements that may be provided for a BPMN element.
The BPMN namespace contains linked classes representing a BPMN model.