bpmn++
A BPMN parser library, written in C++
Loading...
Searching...
No Matches
ExtensionElements.h
Go to the documentation of this file.
1#ifndef BPMN_ExtensionElements_H
2#define BPMN_ExtensionElements_H
3
4#include "Element.h"
5#include "BaseElement.h"
7
8namespace BPMN {
9
10class BaseElement;
11
12/**
13 * @brief Base class for extension elements that may be provided for a BPMN element.
14 */
15class ExtensionElements : public Element {
16public:
18
20
21 /**
22 * @brief Returns a vector of elements of type T embedded within a container of type T.
23 **/
24 template<class C, class T> std::vector< std::reference_wrapper<T> > get() {
25 if ( element ) {
26 if ( auto container = element->template getOptionalChild<C>(); container.has_value() ) {
27 return container->get().template getChildren<T>();
28 }
29 }
30 return std::vector< std::reference_wrapper<T> >();
31 }
32
33 /**
34 * @brief Returns a vector of elements of type T embedded within a container of type T.
35 **/
36 template<class C, class T> std::vector< std::reference_wrapper<const T> > get() const {
37 if ( element ) {
38 if ( auto container = element->template getOptionalChild<const C>(); container.has_value() ) {
39 return container->get().template getChildren<const T>();
40 }
41 }
42 return std::vector< std::reference_wrapper<const T> >();
43 }
44
45 /**
46 * @brief Reference to the base element the extension elements are bound to.
47 */
49private:
50 /**
51 * @brief Returns the @ref element if given or a `nullptr` otherwise.
52 **/
54
55};
56
57} // namespace BPMN
58
59#endif // BPMN_ExtensionElements_H
Base class for all core BPMN elements.
Definition BaseElement.h:15
Abstract base class for all elements in a BPMN model.
Definition Element.h:13
Base class for extension elements that may be provided for a BPMN element.
BaseElement * baseElement
Reference to the base element the extension elements are bound to.
std::vector< std::reference_wrapper< const T > > get() const
Returns a vector of elements of type T embedded within a container of type T.
std::vector< std::reference_wrapper< T > > get()
Returns a vector of elements of type T embedded within a container of type T.
XML::bpmn::tExtensionElements * element
The BPMN namespace contains linked classes representing a BPMN model.