SST  15.1.0
StructuralSimulationToolkit
linkPair.h
1 // Copyright 2009-2025 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-2025, 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  * @param order Value used to enforce the link order.
28  */
29  explicit LinkPair(LinkId_t order) :
30  left(new Link(order)),
31  right(new Link(order))
32  {
33  my_id = order;
34 
35  left->pair_link = right;
36  right->pair_link = left;
37  }
38 
39  /** Create a new LinkPair. This is used on restart.
40  * @param order Value used to enforce the link order.
41  */
43  left(new Link()),
44  right(new Link())
45  {
46  my_id = -1;
47 
48  left->pair_link = right;
49  right->pair_link = left;
50  }
51 
52  /** Create a new LinkPair. This is used when the endpoints are in different partitions.
53  * @param order Value used to enforce the link order.
54  * @param remote_tag Used to look up the correct link on the other side.
55  */
56  LinkPair(LinkId_t order, LinkId_t remote_tag) :
57  left(new Link(remote_tag)),
58  right(new Link(order))
59  {
60  my_id = order;
61 
62  left->pair_link = right;
63  right->pair_link = left;
64  }
65 
66  virtual ~LinkPair() {}
67 
68  /** Return the Left Link
69  * @return Left link
70  */
71  inline Link* getLeft() { return left; }
72 
73  /** Return the Right Link
74  * @return Right link
75  */
76  inline Link* getRight() { return right; }
77 
78 private:
79  Link* left;
80  Link* right;
81 
82  LinkId_t my_id;
83 };
84 
85 } // namespace SST
86 
87 #endif // SST_CORE_LINKPAIR_H
LinkPair(LinkId_t order, LinkId_t remote_tag)
Create a new LinkPair.
Definition: linkPair.h:56
Link * getLeft()
Return the Left Link.
Definition: linkPair.h:71
Definition: action.cc:18
Defines a pair of links (to define a connected link)
Definition: linkPair.h:23
LinkPair()
Create a new LinkPair.
Definition: linkPair.h:42
LinkPair(LinkId_t order)
Create a new LinkPair.
Definition: linkPair.h:29
Link * getRight()
Return the Right Link.
Definition: linkPair.h:76