GossipNewsAgency.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-11-27
  6. * Changed: 2022-05-20
  7. *
  8. * */
  9. #include "GossipNewsAgency.hpp"
  10. #include "GossipNewsEvent.hpp"
  11. #include <ls_std/ls_std_event.hpp>
  12. #include <iostream>
  13. ls_std_event_test::GossipNewsAgency::GossipNewsAgency(::std::string agencyName, EventManager eventManager)
  14. : NewsAgency(agencyName),
  15. m_eventManager(eventManager)
  16. {
  17. // subscribe listener at construction
  18. m_eventManager.subscribe(ls_std_event_test::GossipNewsEvent::EVENT_ID, )
  19. }
  20. void ls_std_event_test::GossipNewsAgency::clear()
  21. {
  22. this->news.clear();
  23. }
  24. ::std::string ls_std_event_test::GossipNewsAgency::getNews()
  25. {
  26. return this->news;
  27. }
  28. void ls_std_event_test::GossipNewsAgency::onGossipNews(ls_std_event_test::GossipNewsEvent event)
  29. {
  30. ::std::cout << event.getParameterList().at("news");
  31. }
  32. ls_std_event_test::GossipNewsAgency::~GossipNewsAgency()
  33. {
  34. //destructor should unsubscribe all methods to avoid nllptr when send Event
  35. }