/** * @file broker.h * @brief Declaration of the Broker class. * @author Andreas Aardal Hanssen * @date 2002-2005 */ #ifndef broker_h_included #define broker_h_included #include "depot.h" #include "operators.h" #include "recursivedescent.h" #include "session.h" #include #include #include namespace Binc { class Request; class Broker; class BrokerFactory { private: std::map brokers; BrokerFactory(); mutable std::string lastError; public: Broker *getBroker(Session::State state); void assign(const std::string &fname, std::shared_ptr o); void addCapability(const std::string &c); Operator *getOperator(Session::State state, const std::string &name) const; const std::string &getLastError() const { return lastError; } void setLastError(std::string error) const { lastError = std::move(error); } static BrokerFactory &getInstance(); BrokerFactory(const BrokerFactory &) = delete; BrokerFactory(const BrokerFactory &&) = delete; }; class Broker { private: std::map> operators; public: Parser &parser; Operator *get(const std::string &name) const; void assign(const std::string &fname, std::shared_ptr o); Parser::ParseResult parseStub(Request &cmd); Broker(Parser &p) : parser(p){}; Broker(const Broker &) = delete; Broker(Broker &&) = default; }; } #endif