Coriolis Core (CRL) Documentation


ToolEngine.h
1// -*- C++ -*-
2//
3// This file is part of the Coriolis Software.
4// Copyright (c) Sorbonne Université 2008-2021, 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#pragma once
18#include <string>
19#include "hurricane/Commons.h"
20#include "hurricane/Timer.h"
21#include "hurricane/Observer.h"
22#include "hurricane/DBo.h"
23#include "hurricane/Slot.h"
24
25namespace Hurricane {
26 class Name;
27 class Cell;
28}
29
30#include "crlcore/Measures.h"
31#include "crlcore/ToolEngines.h"
32
33
34namespace CRL {
35
36 using Hurricane::BaseObserver;
37 using Hurricane::Observable;
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 static const unsigned int AboutToDestroy = (1 << 0);
51 public:
52 typedef DBo Super;
53 public:
54 static ToolEngines get ( const Cell* cell );
55 static ToolEngine* get ( const Cell* cell, const Name& name );
56 static void destroyAll ();
57 static bool inDestroyAll ();
58 public:
59 virtual const Name& getName () const = 0;
60 inline Cell* getCell () const;
61 inline uint32_t getPassNumber () const;
62 bool placementModificationFlagHasChanged ();
63 bool routingModificationFlagHasChanged ();
64 inline void setInRelationDestroy ( bool );
65 inline const Timer& getTimer () const;
66 inline void setPassNumber ( uint32_t );
67 inline std::string getMeasureLabel ( std::string ) const;
68 void startMeasures ();
69 void stopMeasures ();
70 void suspendMeasures ();
71 void resumeMeasures ();
72 void printMeasures () const;
73 template<typename Data>
74 inline void addMeasure ( std::string, const Data&, unsigned int width ) const;
75 template<typename Data>
76 inline void addMeasure ( std::string, const Data& ) const;
77 template<typename Data>
78 inline void addMeasure ( std::string, Data* ) const;
79 template<typename Data>
80 inline const Data* getMeasure ( std::string ) const;
81 void addObserver ( BaseObserver* );
82 void removeObserver ( BaseObserver* );
83 void notify ( unsigned int flags );
84 virtual std::string _getTypeName () const;
85 virtual std::string _getString () const;
86 virtual Record* _getRecord () const;
87 private:
88 static bool _inDestroyAll;
89 protected:
90 Cell* _cell;
91 private:
92 Observable _observers;
93 unsigned int _placementModificationFlag;
94 unsigned int _routingModificationFlag;
95 bool _inRelationDestroy;
96 Timer _timer;
97 uint32_t _passNumber;
98 bool _verbose;
99 protected:
100 ToolEngine ( Cell* cell, bool verbose=true );
101 virtual void _postCreate ();
102 virtual void _preDestroy ();
103 protected:
104 void grabPlacementModificationFlag ();
105 void getPlacementModificationFlag ();
106 void grabRoutingModificationFlag ();
107 void getRoutingModificationFlag ();
108 };
109
110
111// -------------------------------------------------------------------
112// Inline Functions.
113
114
115 inline Cell* ToolEngine::getCell () const { return _cell; }
116 inline void ToolEngine::setInRelationDestroy ( bool state ) { _inRelationDestroy = state; }
117 inline const Timer& ToolEngine::getTimer () const { return _timer; }
118 inline uint32_t ToolEngine::getPassNumber () const { return _passNumber; }
119 inline void ToolEngine::setPassNumber ( uint32_t n ) { _passNumber = n; }
120
121 inline std::string ToolEngine::getMeasureLabel ( std::string label ) const
122 { return _getTypeName() + "." + label; }
123
124 template<typename Data>
125 inline void ToolEngine::addMeasure ( std::string name, const Data& data, unsigned int width ) const
126 { ::CRL::addMeasure( getCell(), getMeasureLabel(name), getPassNumber(), data, width ); }
127
128 template<typename Data>
129 inline void ToolEngine::addMeasure ( std::string name, const Data& data ) const
130 { ::CRL::addMeasure( getCell(), getMeasureLabel(name), getPassNumber(), data ); }
131
132 template<typename Data>
133 inline void ToolEngine::addMeasure ( std::string name, Data* data ) const
134 { ::CRL::addMeasure( getCell(), getMeasureLabel(name), getPassNumber(), data ); }
135
136 template<typename Data>
137 inline const Data* ToolEngine::getMeasure ( std::string name ) const
138 {
139 const Measure<Data>* measure = ::CRL::getMeasure<Data>( getCell(), getMeasureLabel(name) );
140 if (not measure) return NULL;
141 return &(measure->getData( getPassNumber() ));
142 }
143
144
145} // CRL namespace.
static void destroyAll()
static ToolEngines get(const Cell *cell)
virtual const Name & getName() const =0
static ToolEngine * get(const Cell *cell, const Name &name)
The namespace of Coriolis Core.
Definition AcmSigda.h:28
GenericCollection< ToolEngine * > ToolEngines
Definition ToolEngines.h:53


Generated by doxygen 1.16.1 on Return to top of page
Coriolis Core (CRL) Copyright © 2008-2020 Sorbonne Universite, All rights reserved