SST  14.1.0
StructuralSimulationToolkit
linkPair.h
1 // Copyright 2009-2024 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-2024, 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  LinkPair(LinkId_t order) : left(new Link(order)), right(new Link(order))
30  {
31  my_id = order;
32 
33  left->pair_link = right;
34  right->pair_link = left;
35  }
36 
37  /** Create a new LinkPair. This is used when the endpoints are in different partitions.
38  * @param order Value used to enforce the link order.
39  * @param remote_tag Used to look up the correct link on the other side.
40  */
41  LinkPair(LinkId_t order, LinkId_t remote_tag) : left(new Link(remote_tag)), right(new Link(order))
42  {
43  my_id = order;
44 
45  left->pair_link = right;
46  right->pair_link = left;
47  }
48 
49  virtual ~LinkPair() {}
50 
51  /** Return the Left Link
52  * @return Left link
53  */
54  inline Link* getLeft() { return left; }
55 
56  /** Return the Right Link
57  * @return Right link
58  */
59  inline Link* getRight() { return right; }
60 
61 private:
62  Link* left;
63  Link* right;
64 
65  LinkId_t my_id;
66 };
67 
68 } // namespace SST
69 
70 #endif // SST_CORE_LINKPAIR_H
LinkPair(LinkId_t order, LinkId_t remote_tag)
Create a new LinkPair.
Definition: linkPair.h:41
Link * getLeft()
Return the Left Link.
Definition: linkPair.h:54
Definition: action.cc:18
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:29
Link * getRight()
Return the Right Link.
Definition: linkPair.h:59