1 // OpenSTA, Static Timing Analyzer
2 // Copyright (c) 2020, Parallax Software, Inc.
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program.  If not, see <https://www.gnu.org/licenses/>.
16 
17 #pragma once
18 
19 #include "DisallowCopyAssign.hh"
20 #include "Vector.hh"
21 #include "SearchClass.hh"
22 #include "Path.hh"
23 #include "PathVertex.hh"
24 
25 namespace sta {
26 
27 // Path reference to either a PathVertex or PathEnum.
28 // This "could" be made smaller by using a union for
29 // path_vertex_.vertex_ and path_enumed_ and a non-legal
30 // value for path_vertex_.arrival_index_ (because a nullptr tag
31 // in PathVertex is valid).
32 class PathRef : public Path
33 {
34 public:
35   PathRef();
36   PathRef(const Path *path);
37   PathRef(const PathRef &path);
38   PathRef(const PathRef *path);
39   PathRef(const PathVertex &path);
40   void init();
41   void init(const PathRef &path);
42   void init(const PathRef *path);
43   void init(const PathVertex &path);
44   void init(const PathVertex *path);
45   void init(Vertex *vertex,
46 	    Tag *tag,
47 	    int arrival_index);
48   void init(PathEnumed *path);
49   virtual void setRef(PathRef *ref) const;
50   virtual bool isNull() const;
51   virtual Vertex *vertex(const StaState *sta) const;
52   virtual VertexId vertexId(const StaState *sta) const;
53   virtual Tag *tag(const StaState *sta) const;
54   virtual TagIndex tagIndex(const StaState *sta) const;
55   virtual const RiseFall *transition(const StaState *sta) const;
56   virtual int rfIndex(const StaState *sta) const;
57   virtual PathAnalysisPt *pathAnalysisPt(const StaState *sta) const;
58   virtual PathAPIndex pathAnalysisPtIndex(const StaState *sta) const;
59   void arrivalIndex(int &arrival_index,
60 		    bool &arrival_exists) const;
61   virtual Arrival arrival(const StaState *sta) const;
62   virtual void setArrival(Arrival arrival,
63 			  const StaState *sta);
64   virtual const Required &required(const StaState *sta) const;
65   virtual void setRequired(const Required &required,
66 			   const StaState *sta);
67   virtual void prevPath(const StaState *sta,
68 			// Return values.
69 			PathRef &prev_path,
70 			TimingArc *&prev_arc) const;
71   void deleteRep();
72 
73   using Path::setRef;
74   using Path::prevPath;
75 
76 protected:
77   PathVertex path_vertex_;
78   PathEnumed *path_enumed_;
79 
80 private:
81   friend class PathVertex;
82   friend class PathEnumed;
83 };
84 
85 } // namespace
86