1#ifndef BPMN_BaseElement_H
2#define BPMN_BaseElement_H
9class ExtensionElements;
30 template<
typename T> T*
is() {
31 return dynamic_cast<T*
>(
element);
38 template<
typename T>
const T*
is()
const {
39 return dynamic_cast<const T*
>(
element);
47 template<
typename T = XML::bpmn::tBaseElement> T*
get() {
48 T* ptr =
dynamic_cast<T*
>(
element);
49 if ( ptr ==
nullptr ) {
50 throw std::runtime_error(
"Element: Illegal cast of element '" + (
element->
id.has_value() ? (std::string)
element->
id->get().value :
"") +
"'");
60 template<
typename T = XML::bpmn::tBaseElement>
const T*
get()
const {
61 const T* ptr =
dynamic_cast<const T*
>(
element);
62 if ( ptr ==
nullptr ) {
63 throw std::runtime_error(
"Element: Illegal cast of element" + (
element->
id.has_value() ?
" '" + (std::string)
element->
id->get().value +
"'" :
"" ) );
Base class for all core BPMN elements.
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.
XML::bpmn::tBaseElement * element
T * get()
Casts the element to the specified type T.
Abstract base class for all elements in a BPMN model.
std::optional< std::reference_wrapper< Attribute > > id
Attribute value can be expected to be of type 'std::string'.
The BPMN namespace contains linked classes representing a BPMN model.