Bincimap 2.0.16
Easy Imapping
Loading...
Searching...
No Matches
broker.h
Go to the documentation of this file.
1
7#ifndef broker_h_included
8#define broker_h_included
9#include "depot.h"
10#include "operators.h"
11
12#include <string>
13#include <map>
14
15namespace Binc {
16
17 class Request;
18 class Broker;
19
20 //------------------------------------------------------------------
22 private:
23 std::map<int, Broker *> brokers;
24
25 //--
26 BrokerFactory(void);
27
28 mutable std::string lastError;
29
30 public:
31 Broker *getBroker(int state);
32 void assign(const std::string &fname, Operator *o);
33 void addCapability(const std::string &c);
34 Operator *getOperator(int state, const std::string &name) const;
35
36 inline const std::string &getLastError(void) const;
37 inline void setLastError(const std::string &error) const;
38
39 //--
40 static BrokerFactory &getInstance(void);
41 ~BrokerFactory(void);
42 };
43
44 //------------------------------------------------------------------
45 inline const std::string &BrokerFactory::getLastError(void) const
46 {
47 return lastError;
48 }
49
50 //------------------------------------------------------------------
51 inline void BrokerFactory::setLastError(const std::string &error) const
52 {
53 lastError = error;
54 }
55
56 //------------------------------------------------------------------
57 class Broker {
58 private:
59 std::map<std::string, Operator *> operators;
60 std::map<std::string, bool> deletables;
61
62 public:
63 Operator * get(const std::string &name) const;
64 void assign(const std::string &fname, Operator *o, bool deletable = false);
66
67 //--
68 inline Broker(Broker &);
69 inline Broker(const Broker &);
70 Broker(void);
71 ~Broker(void);
72 };
73
75 {
76 }
77
78 inline Broker::Broker(const Broker &)
79 {
80 }
81
82}
83
84#endif
Broker * getBroker(int state)
Definition: broker.cc:78
void assign(const std::string &fname, Operator *o)
Definition: broker.cc:57
void setLastError(const std::string &error) const
Definition: broker.h:51
Operator * getOperator(int state, const std::string &name) const
Definition: broker.cc:69
~BrokerFactory(void)
Definition: broker.cc:28
void addCapability(const std::string &c)
Definition: broker.cc:43
static BrokerFactory & getInstance(void)
Definition: broker.cc:36
const std::string & getLastError(void) const
Definition: broker.h:45
Operator * get(const std::string &name) const
Definition: broker.cc:106
Operator::ParseResult parseStub(Request &cmd)
Definition: broker.cc:114
~Broker(void)
Definition: broker.cc:94
void assign(const std::string &fname, Operator *o, bool deletable=false)
Definition: broker.cc:99
Broker(void)
Definition: broker.cc:89
Definition: bincimapd.cc:9
Declaration of all operators.