coriolis/chamsin/src/technology/ATechnology.h

114 lines
4.2 KiB
C
Raw Normal View History

#ifndef ATECHNOLOGY_H_
#define ATECHNOLOGY_H_
2008-05-22 06:45:09 -05:00
#include "hurricane/Property.h"
using namespace Hurricane;
namespace Hurricane {
class Technology;
2008-05-19 14:32:21 -05:00
class Layer;
}
class ATechnology : public PrivateProperty {
2008-05-06 08:34:26 -05:00
public:
typedef PrivateProperty Inherit;
2008-05-06 08:34:26 -05:00
class PhysicalRule {
public:
2008-05-19 14:32:21 -05:00
PhysicalRule(const Name& name,
2008-06-10 13:36:28 -05:00
DbU::Unit value,
const string& reference):
2008-05-19 06:34:13 -05:00
_name(name),
_value(value),
_reference(reference) {}
2008-05-06 08:34:26 -05:00
PhysicalRule(const PhysicalRule& physicalRule):
2008-05-19 06:34:13 -05:00
_name(physicalRule._name),
_value(physicalRule._value),
_reference(physicalRule._reference) {}
2008-05-19 14:32:21 -05:00
const Name _name;
2008-06-10 13:36:28 -05:00
const DbU::Unit _value;
2008-05-19 06:34:13 -05:00
const string _reference;
double getValue() const { return _value; }
2008-06-24 06:14:40 -05:00
string _getTypeName() const;
string _getString() const;
Record* _getRecord() const;
2008-05-06 08:34:26 -05:00
};
class TwoLayersPhysicalRule : public PhysicalRule {
public:
2008-06-24 06:14:40 -05:00
typedef PhysicalRule Inherit;
TwoLayersPhysicalRule(const Name& name,
DbU::Unit value,
const string& reference,
bool symetric):
PhysicalRule(name, value, reference),
_symetric(symetric) {}
bool isSymetric() const { return _symetric; }
const bool _symetric;
2008-06-24 06:14:40 -05:00
string _getTypeName() const;
string _getString() const;
Record* _getRecord() const;
};
struct PhysicalRuleNameCompare:
public std::binary_function<const PhysicalRule*, const PhysicalRule*, bool> {
bool operator()(const PhysicalRule* pr1, const PhysicalRule* pr2) const {
return pr1->_name < pr2->_name;
}
};
typedef pair<const Layer*, const Layer*> LayerPair;
typedef set<ATechnology::PhysicalRule*, PhysicalRuleNameCompare> PhysicalRules;
typedef set<ATechnology::TwoLayersPhysicalRule*, PhysicalRuleNameCompare> TwoLayersPhysicalRulesSet;
typedef map<const Layer*, PhysicalRules> OneLayerPhysicalRules;
typedef map<LayerPair, TwoLayersPhysicalRulesSet> TwoLayersPhysicalRules;
static ATechnology* create(Hurricane::Technology* technology);
static ATechnology* getATechnology(Hurricane::Technology* technology);
const PhysicalRule* getPhysicalRule(const Name& name) const;
const PhysicalRule* getPhysicalRule(const Name& name, const Layer* layer) const;
const PhysicalRule* getPhysicalRule(const Name& name, const Layer* layer1, const Layer* layer2) const;
2008-06-10 13:36:28 -05:00
void addPhysicalRule(const Name& name, DbU::Unit value, const string& reference);
void addPhysicalRule(const Name& name, const Name& layerName, DbU::Unit value, const string& reference);
2008-05-19 14:32:21 -05:00
void addPhysicalRule(const Name& name, const Name& layer1Name,
const Name& layer2Name, bool symetric, DbU::Unit value, const string& reference);
2008-05-19 14:32:21 -05:00
Layer* getLayer(const Name& layerName);
void print();
2008-05-19 06:34:13 -05:00
virtual Name getName() const;
2008-05-19 06:34:13 -05:00
virtual string _getTypeName() const;
2008-06-24 06:14:40 -05:00
virtual Record* _getRecord() const;
ATechnology():
Inherit(),
2008-05-19 14:32:21 -05:00
_noLayerPhysicalRules(),
_oneLayerPhysicalRules(),
_twoLayersPhysicalRules() {}
private:
2008-05-19 14:32:21 -05:00
PhysicalRules _noLayerPhysicalRules;
OneLayerPhysicalRules _oneLayerPhysicalRules;
TwoLayersPhysicalRules _twoLayersPhysicalRules;
};
2008-06-24 06:14:40 -05:00
// -------------------------------------------------------------------
2008-06-30 14:10:15 -05:00
// Inspector Support for : "ATechnology::LayerPair".
2008-06-24 06:14:40 -05:00
template<>
2008-06-30 14:10:15 -05:00
inline std::string getString<ATechnology::LayerPair> (ATechnology::LayerPair lp) {
return "<LayerPair layer1=" + getString(lp.first) + ", layer2=" + getString(lp.second) + ">";
2008-06-24 06:14:40 -05:00
}
INSPECTOR_P_SUPPORT(ATechnology);
INSPECTOR_P_SUPPORT(ATechnology::PhysicalRule);
INSPECTOR_P_SUPPORT(ATechnology::TwoLayersPhysicalRule);
2008-05-06 08:34:26 -05:00
#endif /* ATECHNOLOGY_H_*/