Samchon Framework for CPP  1.0.0
ExternalSystemRole.hpp
1 #pragma once
2 #include <samchon/API.hpp>
3 
4 #include <samchon/protocol/Entity.hpp>
5 #include <samchon/protocol/IProtocol.hpp>
6 
7 #include <set>
8 
9 namespace samchon
10 {
11 namespace protocol
12 {
13  class ExternalSystem;
14 
39  class SAMCHON_FRAMEWORK_API ExternalSystemRole
40  : public Entity,
41  public IProtocol
42  {
43  protected:
44  typedef Entity super;
45 
46  private:
51 
52  protected:
56  std::string name;
57 
61  std::set<std::string> replyListeners;
62 
66  std::set<std::string> sendListeners;
67 
68  public:
69  /* ------------------------------------------------------------------
70  CONSTRUCTORS
71  ------------------------------------------------------------------ */
78  virtual ~ExternalSystemRole() = default;
79 
80  virtual void construct(std::shared_ptr<library::XML>) override;
81 
82  private:
83  void constructListeners(std::set<std::string> &, const std::shared_ptr<library::XML>);
84 
85  public:
86  /* ------------------------------------------------------------------
87  GETTERS
88  ------------------------------------------------------------------ */
92  auto getSystem() const->ExternalSystem*;
93 
94  virtual auto key() const->std::string override;
95 
99  auto hasSendListener(const std::string &) const -> bool;
100 
104  auto hasReplyListener(const std::string &) const -> bool;
105 
106  /* ------------------------------------------------------------------
107  CHAIN OF INVOKE MESSAGE
108  ------------------------------------------------------------------ */
109  virtual void sendData(std::shared_ptr<Invoke>) override;
110 
111  public:
112  /* ------------------------------------------------------------------
113  EXPORTERS
114  ------------------------------------------------------------------ */
115  virtual auto TAG() const->std::string override;
116 
117  virtual auto toXML() const->std::shared_ptr<library::XML> override;
118 
119  private:
120  auto toListenersXML(const std::set<std::string> &, const std::string &) const->std::shared_ptr<library::XML>;
121  };
122 };
123 };
An entity, a standard data class.
Definition: Entity.hpp:48
ExternalSystem * system
A driver of external system containing the ExternalSystemRole.
std::string name
A name representing the role.
Definition: RWMutex.hpp:4
std::set< std::string > sendListeners
Listeners to send in the role.
A network driver for an external system.
std::set< std::string > replyListeners
Listeners to reply in the role.
A role belongs to an external system.
An interface of Invoke message chain.
Definition: IProtocol.hpp:31
Standard message of network I/O.
Definition: Invoke.hpp:47
Top level namespace of products built from samchon.
Definition: ByteArray.hpp:7