SST  12.0.1
StructuralSimulationToolkit
linkPair.h
1 // Copyright 2009-2022 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2022, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_LINKPAIR_H
13 #define SST_CORE_LINKPAIR_H
14 
15 #include "sst/core/link.h"
16 #include "sst/core/sst_types.h"
17 
18 namespace SST {
19 
20 /**
21  * Defines a pair of links (to define a connected link)
22  */
23 class LinkPair
24 {
25 public:
26  /** Create a new LinkPair. This is used when the endpoints are in the same partition. */
27  LinkPair(LinkId_t order) : left(new Link(order)), right(new Link(order))
28  {
29  my_id = order;
30 
31  left->pair_link = right;
32  right->pair_link = left;
33  }
34 
35  /** Create a new LinkPair. This is used when the endpoints are in different partitions. */
36  LinkPair(LinkId_t order, LinkId_t remote_tag) : left(new Link(remote_tag)), right(new Link(order))
37  {
38  my_id = order;
39 
40  left->pair_link = right;
41  right->pair_link = left;
42  }
43 
44  virtual ~LinkPair() {}
45 
46  /** Return the Left Link */
47  inline Link* getLeft() { return left; }
48 
49  /** Return the Right Link */
50  inline Link* getRight() { return right; }
51 
52 private:
53  Link* left;
54  Link* right;
55 
56  LinkId_t my_id;
57 };
58 
59 } // namespace SST
60 
61 #endif // SST_CORE_LINKPAIR_H
LinkPair(LinkId_t order, LinkId_t remote_tag)
Create a new LinkPair.
Definition: linkPair.h:36
Link * getLeft()
Return the Left Link.
Definition: linkPair.h:47
Defines a pair of links (to define a connected link)
Definition: linkPair.h:23
LinkPair(LinkId_t order)
Create a new LinkPair.
Definition: linkPair.h:27
Link * getRight()
Return the Right Link.
Definition: linkPair.h:50