# Coriolis Core (CRLCore) Documentation

# Coriolis Core (CRL) Documentation

ToolEngine.h
1 // -*- C++ -*-
2 //
3 // This file is part of the Coriolis Software.
4 // Copyright (c) UPMC 2008-2018, All Rights Reserved
5 //
6 // +-----------------------------------------------------------------+
7 // | C O R I O L I S |
8 // | Alliance / Hurricane Interface |
9 // | |
10 // | Author : Jean-Paul Chaput |
11 // | E-mail : Jean-Paul.Chaput@lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./crlcore/ToolEngine.h" |
14 // +-----------------------------------------------------------------+
15
16
17
18 #ifndef CRL_TOOL_ENGINE_H
19 #define CRL_TOOL_ENGINE_H
20
21 #include <string>
22 #include "hurricane/Commons.h"
23 #include "hurricane/Timer.h"
24 #include "hurricane/DBo.h"
25 #include "hurricane/Slot.h"
26
27 namespace Hurricane {
28 class Name;
29 class Cell;
30 }
31
32 #include "crlcore/Measures.h"
33 #include "crlcore/ToolEngines.h"
34
35
36 namespace CRL {
37
38 using Hurricane::Timer;
39 using Hurricane::Record;
40 using Hurricane::Name;
41 using Hurricane::DBo;
42 using Hurricane::Cell;
43
44
45 // -------------------------------------------------------------------
46 // Class : "CRL::ToolEngine".
47
48 class ToolEngine : public DBo {
49 public:
50 typedef DBo Super;
51 public:
52 static ToolEngines get ( const Cell* cell );
53 static ToolEngine* get ( const Cell* cell, const Name& name );
54 static void destroyAll ();
55 static bool inDestroyAll ();
56 public:
57 virtual const Name& getName () const = 0;
58 inline Cell* getCell () const;
59 inline uint32_t getPassNumber () const;
60 bool placementModificationFlagHasChanged ();
61 bool routingModificationFlagHasChanged ();
62 inline void setInRelationDestroy ( bool );
63 inline const Timer& getTimer () const;
64 inline void setPassNumber ( uint32_t );
65 inline std::string getMeasureLabel ( std::string ) const;
66 void startMeasures ();
67 void stopMeasures ();
68 void suspendMeasures ();
69 void resumeMeasures ();
70 void printMeasures () const;
71 template<typename Data>
72 inline void addMeasure ( std::string, const Data&, unsigned int width ) const;
73 template<typename Data>
74 inline void addMeasure ( std::string, const Data& ) const;
75 template<typename Data>
76 inline void addMeasure ( std::string, Data* ) const;
77 template<typename Data>
78 inline const Data& getMeasure ( std::string ) const;
79 virtual std::string _getTypeName () const;
80 virtual std::string _getString () const;
81 virtual Record* _getRecord () const;
82 private:
83 static bool _inDestroyAll;
84 protected:
85 Cell* _cell;
86 private:
87 unsigned int _placementModificationFlag;
88 unsigned int _routingModificationFlag;
89 bool _inRelationDestroy;
90 Timer _timer;
91 uint32_t _passNumber;
92 protected:
93 ToolEngine ( Cell* cell );
94 virtual void _postCreate ();
95 virtual void _preDestroy ();
96 protected:
97 void grabPlacementModificationFlag ();
98 void getPlacementModificationFlag ();
99 void grabRoutingModificationFlag ();
100 void getRoutingModificationFlag ();
101 };
102
103
104 // -------------------------------------------------------------------
105 // Inline Functions.
106
107
108 inline Cell* ToolEngine::getCell () const { return _cell; }
109 inline void ToolEngine::setInRelationDestroy ( bool state ) { _inRelationDestroy = state; }
110 inline const Timer& ToolEngine::getTimer () const { return _timer; }
111 inline uint32_t ToolEngine::getPassNumber () const { return _passNumber; }
112 inline void ToolEngine::setPassNumber ( uint32_t n ) { _passNumber = n; }
113
114 inline std::string ToolEngine::getMeasureLabel ( std::string label ) const
115 { return _getTypeName() + "." + label; }
116
117 template<typename Data>
118 inline void ToolEngine::addMeasure ( std::string name, const Data& data, unsigned int width ) const
119 { ::CRL::addMeasure( getCell(), getMeasureLabel(name), getPassNumber(), data, width ); }
120
121 template<typename Data>
122 inline void ToolEngine::addMeasure ( std::string name, const Data& data ) const
123 { ::CRL::addMeasure( getCell(), getMeasureLabel(name), getPassNumber(), data ); }
124
125 template<typename Data>
126 inline void ToolEngine::addMeasure ( std::string name, Data* data ) const
127 { ::CRL::addMeasure( getCell(), getMeasureLabel(name), getPassNumber(), data ); }
128
129 template<typename Data>
130 inline const Data& ToolEngine::getMeasure ( std::string name ) const
131 { return ::CRL::getMeasure<Data>( getCell(), getMeasureLabel(name) )->getData( getPassNumber() ); }
132
133
134 } // CRL namespace.
135
136 #endif // CRL_TOOL_ENGINE_H
CRL::ToolEngine::getName
virtual const Name & getName() const =0
Hurricane::Name
Hurricane::Cell
Hurricane::DBo
Hurricane::GenericCollection
CRL::ToolEngine::destroyAll
static void destroyAll()
CRL::ToolEngine
Base Class of all Coriolis Tools.
Definition: ToolEngine.h:48
Hurricane
CRL
The namespace of Coriolis Core.
Definition: Environment.h:24