Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / ss / api / memsync / src / TsoEdge.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: TsoEdge.h
5* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
7*
8* The above named program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public
10* License version 2 as published by the Free Software Foundation.
11*
12* The above named program is distributed in the hope that it will be
13* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15* General Public License for more details.
16*
17* You should have received a copy of the GNU General Public
18* License along with this work; if not, write to the Free Software
19* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20*
21* ========== Copyright Header End ============================================
22*/
23#ifndef _TSOEDGE_H
24#define _TSOEDGE_H
25/************************************************************************
26**
27** Copyright (C) 2002, Sun Microsystems, Inc.
28**
29** Sun considers its source code as an unpublished, proprietary
30** trade secret and it is available only under strict license provisions.
31** This copyright notice is placed here only to protect Sun in the event
32** the source is deemed a published work. Disassembly, decompilation,
33** or other means of reducing the object code to human readable form
34** is prohibited by the license agreement under which this code is
35** provided to the user or company in possession of this copy."
36**
37*************************************************************************/
38#include <iostream>
39
40#include "TsoCheckerDefs.h"
41#include "TsoNode.h"
42
43
44namespace Tso {
45
46 class TsoNode;
47
48 class TsoEdge {
49
50 public:
51 /**
52 * Default constructor
53 */
54 TsoEdge();
55
56 /**
57 * Copy constructor
58 *
59 * @param orig The TsoEdge object to copy.
60 */
61 TsoEdge( const TsoEdge &orig );
62
63 /**
64 * Destructor
65 */
66 virtual ~TsoEdge();
67
68 /**
69 * Equality operator
70 *
71 * @param rhs The right hand side of the equality operator
72 * @return Return true if this objec and rhs are equal,
73 * otherwise return false
74 */
75 bool operator==( const TsoEdge &rhs ) const;
76
77 /**
78 * Assignment operator
79 *
80 * @param rhs The right hand side of the assignment operator.
81 * @return The lvalue of the assignment.
82 */
83 const TsoEdge & operator=( const TsoEdge &rhs );
84
85 /**
86 * Return a string representation of this TsoEdge object.
87 */
88 std::string toString() const;
89
90 /**
91 * Find the edge between src and dst with the same type
92 * @param src Pointer of the edge's source node
93 * @param dst Pointer of the edge's destination node
94 * @param type Edge type
95 * @return the iterator of the edge if found, or src->outEnd() otherwise
96 * @see TsoChecherDefs.h
97 */
98 std::list<TsoEdge*>::iterator findEdge (TsoNode* src, TsoNode* dst, enum EDGE_TYPE type);
99
100 /**
101 * Form an edge between from src to dst with the type
102 * @param type Edge type
103 * @param src Pointer of the edge's source node
104 * @param dst Pointer of the edge's destination node
105 * @return the iterator of the edge
106 * @see TsoChecherDefs.h
107 */
108 TsoEdge* addEdge (enum EDGE_TYPE type, TsoNode* src, TsoNode* dst);
109
110
111 /******************************************************************
112 * Private variable get/set methods
113 ******************************************************************/
114 void setSrc (TsoNode* src) { src_ = src; }
115 void setDst (TsoNode* dst) { dst_ = dst; }
116 void setType (EDGE_TYPE type) { type_ = type; }
117
118 enum EDGE_TYPE getType() const { return type_; }
119 TsoNode* getSrc () const { return src_; }
120 TsoNode* getDst () const { return dst_; }
121
122
123 protected:
124
125 private:
126 /**
127 * type_ is the edge type defined in
128 * @see TsoCheckerDefs.h
129 */
130 enum EDGE_TYPE type_;
131
132 /**
133 * src_ is the pointer to the source TsoNode
134 */
135 TsoNode *src_;
136
137 /**
138 * dst_ is the pointer to the destination TsoNode
139 */
140 TsoNode *dst_;
141 };
142
143} /* namespace Tso */
144
145#endif /* _TSOEDGE_H */