QueriesProcessor.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * QueriesProcessor.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../../lib/GameConstants.h"
  12. class CQuery;
  13. using QueryPtr = std::shared_ptr<CQuery>;
  14. class QueriesProcessor
  15. {
  16. private:
  17. void addQuery(PlayerColor player, QueryPtr query);
  18. void popQuery(PlayerColor player, QueryPtr query);
  19. std::map<PlayerColor, std::vector<QueryPtr>> queries; //player => stack of queries
  20. public:
  21. static boost::mutex mx;
  22. void addQuery(QueryPtr query);
  23. void popQuery(const CQuery &query);
  24. void popQuery(QueryPtr query);
  25. void popIfTop(const CQuery &query); //removes this query if it is at the top (otherwise, do nothing)
  26. void popIfTop(QueryPtr query); //removes this query if it is at the top (otherwise, do nothing)
  27. QueryPtr topQuery(PlayerColor player);
  28. std::vector<std::shared_ptr<const CQuery>> allQueries() const;
  29. std::vector<QueryPtr> allQueries();
  30. QueryPtr getQuery(QueryID queryID);
  31. //void removeQuery
  32. };