12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- /*
- * Author: Patrick-Christopher Mattulat
- * Company: Lynar Studios
- * E-Mail: webmaster@lynarstudios.com
- * Created: 2020-11-26
- * Changed: 2023-02-07
- *
- * */
- #include <ls-std/core/exception/IllegalArgumentException.hpp>
- #include <ls-std/event/Event.hpp>
- ls::std::event::Event::Event(const ls::std::core::type::event_id &_id) : ls::std::core::Class("Event")
- {
- this->_assignId(_id);
- }
- ls::std::event::Event::~Event() = default;
- bool ls::std::event::Event::addParameter(const ls::std::core::type::event_parameter &_eventParameter)
- {
- bool wasAdded{};
- if (!this->_hasParameter(_eventParameter.first))
- {
- wasAdded = this->parameterList.insert(_eventParameter).second;
- }
- return wasAdded;
- }
- void ls::std::event::Event::clearParameterList()
- {
- this->parameterList.clear();
- }
- ls::std::core::type::event_id ls::std::event::Event::getId()
- {
- return this->id;
- }
- ls::std::core::type::event_parameter_list ls::std::event::Event::getParameterList()
- {
- return this->parameterList;
- }
- bool ls::std::event::Event::removeParameter(const ls::std::core::type::event_parameter_id &_id)
- {
- return this->parameterList.erase(_id) == 1;
- }
- void ls::std::event::Event::setId(const ls::std::core::type::event_id &_id)
- {
- this->_assignId(_id);
- }
- void ls::std::event::Event::_assignId(const ls::std::core::type::event_id &_id)
- {
- if (_id.empty())
- {
- throw ls::std::core::IllegalArgumentException{"_id is empty"};
- }
- this->id = _id;
- }
- bool ls::std::event::Event::_hasParameter(const ls::std::core::type::event_id &_id)
- {
- return this->parameterList.find(_id) != this->parameterList.end();
- }
|