Samchon Framework for CPP  1.0.0
DistributedSystemArrayBase.hpp
1 #pragma once
2 #include <samchon/API.hpp>
3 
4 #include <samchon/HashMap.hpp>
5 #include <samchon/protocol/Entity.hpp>
6 
7 namespace samchon
8 {
9 namespace templates
10 {
11 namespace distributed
12 {
13  class DistributedProcess;
14 
15 namespace base
16 {
17  class DistributedSystemArrayBase
18  {
19  protected:
20  HashMap<std::string, std::shared_ptr<DistributedProcess>> process_map_;
21 
22  public:
23  /* ---------------------------------------------------------
24  ACCESSORS
25  --------------------------------------------------------- */
33  auto getProcessMap() const -> const HashMap<std::string, std::shared_ptr<DistributedProcess>>&
34  {
35  return process_map_;
36  };
37 
45  auto hasProcess(const std::string &name) const -> bool
46  {
47  return process_map_.has(name);
48  };
49 
57  auto getProcess(const std::string &name) const -> std::shared_ptr<DistributedProcess>
58  {
59  return process_map_.get(name);
60  };
61 
68  void insertProcess(std::shared_ptr<DistributedProcess> role)
69  {
70  process_map_.emplace(((protocol::Entity<std::string>*)role.get())->key(), role);
71  };
72 
78  void eraseProcess(const std::string &name)
79  {
80  process_map_.erase(name);
81  };
82  };
83 };
84 };
85 };
86 };