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/DBo.h"
22 #include "hurricane/Slot.h"
23 
24 namespace Hurricane {
25  class Name;
26  class Cell;
27 }
28 
29 #include "crlcore/Measures.h"
30 #include "crlcore/ToolEngines.h"
31 
32 
33 namespace CRL {
34 
35  using Hurricane::Timer;
36  using Hurricane::Record;
37  using Hurricane::Name;
38  using Hurricane::DBo;
39  using Hurricane::Cell;
40 
41 
42 // -------------------------------------------------------------------
43 // Class : "CRL::ToolEngine".
44 
45  class ToolEngine : public DBo {
46  public:
47  typedef DBo Super;
48  public:
49  static ToolEngines get ( const Cell* cell );
50  static ToolEngine* get ( const Cell* cell, const Name& name );
51  static void destroyAll ();
52  static bool inDestroyAll ();
53  public:
54  virtual const Name& getName () const = 0;
55  inline Cell* getCell () const;
56  inline uint32_t getPassNumber () const;
57  bool placementModificationFlagHasChanged ();
58  bool routingModificationFlagHasChanged ();
59  inline void setInRelationDestroy ( bool );
60  inline const Timer& getTimer () const;
61  inline void setPassNumber ( uint32_t );
62  inline std::string getMeasureLabel ( std::string ) const;
63  void startMeasures ();
64  void stopMeasures ();
65  void suspendMeasures ();
66  void resumeMeasures ();
67  void printMeasures () const;
68  template<typename Data>
69  inline void addMeasure ( std::string, const Data&, unsigned int width ) const;
70  template<typename Data>
71  inline void addMeasure ( std::string, const Data& ) const;
72  template<typename Data>
73  inline void addMeasure ( std::string, Data* ) const;
74  template<typename Data>
75  inline const Data* getMeasure ( std::string ) const;
76  virtual std::string _getTypeName () const;
77  virtual std::string _getString () const;
78  virtual Record* _getRecord () const;
79  private:
80  static bool _inDestroyAll;
81  protected:
82  Cell* _cell;
83  private:
84  bool _verbose;
85  unsigned int _placementModificationFlag;
86  unsigned int _routingModificationFlag;
87  bool _inRelationDestroy;
88  Timer _timer;
89  uint32_t _passNumber;
90  protected:
91  ToolEngine ( Cell* cell, bool verbose=true );
92  virtual void _postCreate ();
93  virtual void _preDestroy ();
94  protected:
95  void grabPlacementModificationFlag ();
96  void getPlacementModificationFlag ();
97  void grabRoutingModificationFlag ();
98  void getRoutingModificationFlag ();
99  };
100 
101 
102 // -------------------------------------------------------------------
103 // Inline Functions.
104 
105 
106  inline Cell* ToolEngine::getCell () const { return _cell; }
107  inline void ToolEngine::setInRelationDestroy ( bool state ) { _inRelationDestroy = state; }
108  inline const Timer& ToolEngine::getTimer () const { return _timer; }
109  inline uint32_t ToolEngine::getPassNumber () const { return _passNumber; }
110  inline void ToolEngine::setPassNumber ( uint32_t n ) { _passNumber = n; }
111 
112  inline std::string ToolEngine::getMeasureLabel ( std::string label ) const
113  { return _getTypeName() + "." + label; }
114 
115  template<typename Data>
116  inline void ToolEngine::addMeasure ( std::string name, const Data& data, unsigned int width ) const
117  { ::CRL::addMeasure( getCell(), getMeasureLabel(name), getPassNumber(), data, width ); }
118 
119  template<typename Data>
120  inline void ToolEngine::addMeasure ( std::string name, const Data& data ) const
121  { ::CRL::addMeasure( getCell(), getMeasureLabel(name), getPassNumber(), data ); }
122 
123  template<typename Data>
124  inline void ToolEngine::addMeasure ( std::string name, Data* data ) const
125  { ::CRL::addMeasure( getCell(), getMeasureLabel(name), getPassNumber(), data ); }
126 
127  template<typename Data>
128  inline const Data* ToolEngine::getMeasure ( std::string name ) const
129  {
130  const Measure<Data>* measure = ::CRL::getMeasure<Data>( getCell(), getMeasureLabel(name) );
131  if (not measure) return NULL;
132  return &(measure->getData( getPassNumber() ));
133  }
134 
135 
136 } // CRL namespace.
Base Class of all Coriolis Tools.
Definition: ToolEngine.h:45
static ToolEngine * get(const Cell *cell, const Name &name)
static void destroyAll()
virtual const Name & getName() const =0
static ToolEngines get(const Cell *cell)
The namespace of Coriolis Core.
Definition: AcmSigda.h:28


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