Graybat  1.1
Graph Approach for Highly Generic Communication Schemes Based on Adaptive Topologies
Context.hpp
1 #pragma once
2 
3 #include <graybat/communicationPolicy/Traits.hpp>
4 
5 namespace graybat {
6 
7  namespace communicationPolicy {
8 
9  namespace zmq {
10 
16  template<typename T_CP>
17  class Context {
18 
19  using ContextID = typename graybat::communicationPolicy::ContextID<T_CP>;
20  using VAddr = typename graybat::communicationPolicy::VAddr<T_CP>;
21  using Tag = typename graybat::communicationPolicy::Tag<T_CP>;
22  using MsgType = typename graybat::communicationPolicy::MsgType<T_CP>;
23  using MsgID = typename graybat::communicationPolicy::MsgID<T_CP>;
24 
25  public:
26  Context() :
27  contextID(0),
28  vAddr(0),
29  nPeers(1),
30  isValid(false){
31 
32  }
33 
34  Context(ContextID contextID, VAddr vAddr, unsigned nPeers) :
35  contextID(contextID),
36  vAddr(vAddr),
37  nPeers(nPeers),
38  isValid(true){
39 
40  }
41 
42  size_t size() const{
43  return nPeers;
44  }
45 
46  VAddr getVAddr() const {
47  return vAddr;
48  }
49 
50  ContextID getID() const {
51  return contextID;
52  }
53 
54  bool valid() const{
55  return isValid;
56  }
57 
58  private:
59  ContextID contextID;
60  VAddr vAddr;
61  unsigned nPeers;
62  bool isValid;
63  };
64 
65 
66  } // zmq
67 
68  } // namespace communicationPolicy
69 
70 } // namespace graybat
Definition: chain.cpp:31
A context represents a set of peers which are able to communicate with each other.
Definition: Context.hpp:17
Definition: BiStar.hpp:8