* ./hurricane/src/hurricane :

- New : Mask object to manage masks.
    - New : BasicLayer ordering & connectivity is managed.
This commit is contained in:
Jean-Paul Chaput 2008-10-21 13:49:48 +00:00
parent 8397e7dccd
commit 26d07794ca
31 changed files with 1543 additions and 514 deletions

View File

@ -206,18 +206,19 @@ namespace Hurricane {
void BasicLayer::_postCreate ()
{
Mask basicLayersMask = 0;
for_each_basic_layer(basicLayer, getTechnology()->getBasicLayers()) {
basicLayersMask |= basicLayer->getMask();
end_for;
forEach ( BasicLayer*, basicLayer, getTechnology()->getBasicLayers() ) {
basicLayersMask |= (*basicLayer)->getMask();
}
Mask mask = 1;
while (mask && (mask & basicLayersMask)) mask = mask<<1;
while (mask && (mask & basicLayersMask)) mask = mask.lshift(1);
if (!mask)
throw Error("Can't create " + _TName("BasicLayer") + " : mask capacity overflow");
_setMask(mask);
if ( _material == Material::metal ) getTechnology()->_getMetalMask().set(getMask());
if ( _material == Material::cut ) getTechnology()->_getCutMask ().set(getMask());
if (_extractNumber) {
Mask extractMask = (1 << _extractNumber);
@ -234,6 +235,8 @@ namespace Hurricane {
void BasicLayer::_preDestroy ()
{
if ( _material == Material::metal ) getTechnology()->_getMetalMask().unset(getMask());
if ( _material == Material::cut ) getTechnology()->_getCutMask ().unset(getMask());
Layer::_preDestroy();
}
@ -287,7 +290,7 @@ namespace Hurricane {
string BasicLayer::Material::_getString () const
{ return getString(_code); }
{ return getString(&_code); }
Record* BasicLayer::Material::_getRecord () const

View File

@ -1,7 +1,8 @@
include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane )
set ( includes hurricane/BasicLayer.h hurricane/BasicLayers.h
set ( includes hurricane/Mask.h
hurricane/BasicLayer.h hurricane/BasicLayers.h
hurricane/RegularLayer.h hurricane/RegularLayers.h
hurricane/ViaLayer.h hurricane/ViaLayers.h
hurricane/ContactLayer.h
@ -36,8 +37,9 @@
hurricane/ListCollection.h
hurricane/Locator.h
hurricane/MapCollection.h
hurricane/Marker.h hurricane/Markers.h
hurricane/MultimapCollection.h
hurricane/MultisetCollection.h
hurricane/Marker.h hurricane/Markers.h
hurricane/Name.h hurricane/Names.h
hurricane/NetExternalComponents.h
hurricane/Net.h hurricane/Nets.h

View File

@ -338,9 +338,9 @@ class Cell_ComponentsUnder : public Collection<Component*> {
, _mask(mask)
, _sliceLocator()
{
if (_cell && (_mask != 0)) {
if (_cell && !_mask.zero()) {
_sliceLocator = getCollection(_cell->getExtensionSliceMap()).getLocator();
while (_sliceLocator.isValid() && !(_sliceLocator.getElement()->getMask() & _mask))
while (_sliceLocator.isValid() && !(_sliceLocator.getElement()->getMask().intersect(_mask)))
_sliceLocator.progress();
}
}
@ -387,7 +387,7 @@ class Cell_ComponentsUnder : public Collection<Component*> {
do {
_sliceLocator.progress();
}
while (_sliceLocator.isValid() && !(_sliceLocator.getElement()->getMask() & _mask));
while (_sliceLocator.isValid() && !(_sliceLocator.getElement()->getMask().intersect(_mask)));
}
}
@ -2077,7 +2077,7 @@ Cell_Slices::Locator::Locator(const Cell* cell, const Layer::Mask& mask)
_mask(mask),
_sliceLocator()
{
if (_cell && (_mask != 0)) {
if (_cell && !_mask.zero()) {
_sliceLocator = ((Cell*)_cell)->_getSliceMap().getElements().getLocator();
while (_sliceLocator.isValid() && !(_sliceLocator.getElement()->getLayer()->getMask() & _mask))
_sliceLocator.progress();
@ -2231,7 +2231,7 @@ Cell_Components::Locator::Locator(const Cell* cell, const Layer::Mask& mask)
_componentLocator(),
_component(NULL)
{
if (_cell && (_mask != 0)) {
if (_cell && !_mask.zero() ) {
_sliceLocator = _cell->getSlices(_mask).getLocator();
while (!_component && _sliceLocator.isValid()) {
Slice* slice = _sliceLocator.getElement();
@ -3981,7 +3981,7 @@ Cell_ComponentOccurrences::Locator::Locator(const Cell* cell, const Layer::Mask&
_instanceLocator(),
_occurrenceLocator()
{
if (_cell && (_mask != 0)) {
if (_cell && !_mask.zero() ) {
_componentLocator = _cell->getComponents(_mask).getLocator();
if (_componentLocator.isValid())
_state = 1;
@ -4202,7 +4202,7 @@ Cell_ComponentOccurrencesUnder::Locator::Locator(const Cell* cell, const Box& ar
_instanceLocator(),
_occurrenceLocator()
{
if (_cell && !_area.isEmpty() && (_mask != 0)) {
if (_cell && !_area.isEmpty() && !_mask.zero() ) {
_componentLocator = _cell->getComponentsUnder(_area, _mask).getLocator();
if (_componentLocator.isValid())
_state = 1;
@ -4429,7 +4429,7 @@ Cell_HyperNetRootNetOccurrences::Locator::Locator(const Cell* cell, Path path)
_instanceLocator=cell->getInstances().getLocator();
while (_netLocator.isValid() && !IsHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path)))
while (_netLocator.isValid() && !isHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path)))
_netLocator.progress();
if (!_netLocator.isValid())
@ -4493,7 +4493,7 @@ void Cell_HyperNetRootNetOccurrences::Locator::progress()
do {
_netLocator.progress();
}
while (_netLocator.isValid() && !IsHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path)));
while (_netLocator.isValid() && !isHyperNetRootNetOccurrence(Occurrence(_netLocator.getElement(),_path)));
}
else if (_hyperNetRootNetOccurrenceLocator.isValid())
_hyperNetRootNetOccurrenceLocator.progress();

View File

@ -112,7 +112,7 @@ namespace Hurricane {
if (record) {
record->add(getSlot("Cell" , _cell ));
record->add(getSlot("Name" , _name ));
record->add(getSlot("Mask" , _mask ));
record->add(getSlot("Mask" ,&_mask ));
record->add(getSlot("QuadTree",&_quadTree));
}
return record;

View File

@ -339,7 +339,7 @@ Occurrence getHyperNetRootNetOccurrence(const Occurrence& netoccurrence)
}
bool IsHyperNetRootNetOccurrence(Occurrence netoccurrence)
bool isHyperNetRootNetOccurrence(Occurrence netoccurrence)
// *******************************************************
{
Net* net=dynamic_cast<Net*>(netoccurrence.getEntity());

View File

@ -51,6 +51,7 @@ namespace Hurricane {
, _minimalSpacing(minimalSpacing)
, _pitch(pitch)
, _nextOfTechnologyLayerMap(NULL)
, _working(false)
{
if ( !_technology )
throw Error ( "Can't create " + _TName("Layer") + " : null technology" );
@ -71,6 +72,34 @@ namespace Hurricane {
{ return NULL; }
const Layer* Layer::getTop () const
{ return NULL; }
const Layer* Layer::getBottom () const
{ return NULL; }
const Layer* Layer::getOpposite ( const Layer* ) const
{ return NULL; }
Layer* Layer::getMetalAbove ( bool useWorking ) const
{ return _technology->getMetalAbove(this,useWorking); }
Layer* Layer::getMetalBelow ( bool useWorking ) const
{ return _technology->getMetalBelow(this,useWorking); }
Layer* Layer::getCutAbove ( bool useWorking ) const
{ return _technology->getCutAbove(this,useWorking); }
Layer* Layer::getCutBelow ( bool useWorking ) const
{ return _technology->getCutBelow(this,useWorking); }
DbU::Unit Layer::getEnclosure () const
{ return 0; }
@ -103,7 +132,7 @@ namespace Hurricane {
bool Layer::intersect ( const Layer* layer ) const
{
return ( (_mask & layer->getMask()) != 0 );
return ( layer->getMask().contains(_mask) );
}
@ -165,7 +194,7 @@ namespace Hurricane {
void Layer::_postCreate ()
{
_technology->_getLayerMap()._insert(this);
_technology->_getLayerList().push_back(this);
_technology->_insertInLayerMaskMap(this);
DBo::_postCreate();
}
@ -175,7 +204,7 @@ namespace Hurricane {
{
DBo::_preDestroy();
_technology->_getLayerList().remove(this);
_technology->_getLayerMaskMap().erase(_mask);
_technology->_getLayerMap()._remove(this);
}

View File

@ -231,6 +231,18 @@ namespace Hurricane {
{ return RegularLayer_RegularLayers(this); }
const Layer* RegularLayer::getTop () const
{ return getTechnology()->getLayer(_basicLayer->getMask()); }
const Layer* RegularLayer::getBottom () const
{ return getTechnology()->getLayer(_basicLayer->getMask()); }
const Layer* RegularLayer::getOpposite ( const Layer* ) const
{ return getTechnology()->getLayer(_basicLayer->getMask()); }
DbU::Unit RegularLayer::getEnclosure () const
{ return _enclosure; }
@ -269,10 +281,14 @@ namespace Hurricane {
if ( _basicLayer )
throw Error ( resetLayer, getString(getName()).c_str() );
getTechnology()->_removeFromLayerMaskMap ( this );
_basicLayer = basicLayer;
_setMask ( _basicLayer->getMask() );
_setExtractMask ( _basicLayer->getExtractMask() );
getTechnology()->_insertInLayerMaskMap ( this );
}

View File

@ -97,7 +97,7 @@ Technology::Technology(DataBase* dataBase, const Name& name)
_dataBase(dataBase),
_name(name),
_layerMap(),
_layerList()
_layerMaskMap()
{
if (!_dataBase)
throw Error("Can't create " + _TName("Technology") + " : null data base");
@ -119,6 +119,16 @@ Technology* Technology::create(DataBase* dataBase, const Name& name)
return technology;
}
// Layer* Technology::getLayer ( Layer::Mask mask ) const
// // ***************************************************
// {
// LayerMaskMap::const_iterator ilayer = _layerMaskMap.find(mask);
// if ( ilayer == _layerMaskMap.end() )
// return NULL;
// return ilayer->second;
// }
BasicLayer* Technology::getBasicLayer(const Name& name) const
// **********************************************************
{
@ -165,6 +175,94 @@ ViaLayers Technology::getViaLayers() const
return SubTypeCollection<Layer*, ViaLayer*>(getLayers());
}
Layer* Technology::getLayer ( const Layer::Mask& mask, bool useWorking ) const
{
LayerMaskMap::const_iterator lb = _layerMaskMap.lower_bound ( mask );
LayerMaskMap::const_iterator ub = _layerMaskMap.upper_bound ( mask );
for ( ; lb != ub ; lb++ ) {
if ( !useWorking || lb->second->isWorking() ) return lb->second;
}
return NULL;
}
Layer* Technology::getMetalAbove ( const Layer* layer, bool useWorking ) const
{
if ( !layer ) return NULL;
LayerMaskMap::const_iterator ub = _layerMaskMap.upper_bound ( layer->getMask() );
for ( ; ub != _layerMaskMap.end() ; ub++ ) {
if ( _metalMask.contains(ub->second->getMask())
&& ( !useWorking || ub->second->isWorking() ) )
return ub->second;
}
return NULL;
}
Layer* Technology::getMetalBelow ( const Layer* layer, bool useWorking ) const
{
if ( !layer ) return NULL;
LayerMaskMap::const_iterator lb = _layerMaskMap.lower_bound ( layer->getMask() );
if ( lb->second == layer ) lb--;
for ( ; lb != _layerMaskMap.begin() ; lb-- ) {
if ( _metalMask.contains(lb->second->getMask())
&& ( !useWorking || lb->second->isWorking() ) )
return lb->second;
}
return NULL;
}
Layer* Technology::getCutAbove ( const Layer* layer, bool useWorking ) const
{
if ( !layer ) return NULL;
LayerMaskMap::const_iterator ub = _layerMaskMap.upper_bound ( layer->getMask() );
for ( ; ub != _layerMaskMap.end() ; ub++ ) {
if ( _cutMask.contains(ub->second->getMask())
&& ( !useWorking || ub->second->isWorking() ) )
return ub->second;
}
return NULL;
}
Layer* Technology::getCutBelow ( const Layer* layer, bool useWorking ) const
{
if ( !layer ) return NULL;
LayerMaskMap::const_iterator lb = _layerMaskMap.lower_bound ( layer->getMask() );
if ( lb->second == layer ) lb--;
for ( ; lb != _layerMaskMap.begin() ; lb-- ) {
if ( _cutMask.contains(lb->second->getMask())
&& ( !useWorking || lb->second->isWorking() ) )
return lb->second;
}
return NULL;
}
Layer* Technology::getViaBetween ( const Layer* metal1, const Layer* metal2 ) const
{
if ( !metal1 || !metal2 ) return NULL;
if ( metal1->above(metal2) ) swap ( metal1, metal2 );
Layer* cutLayer = getCutBelow ( metal2 );
if ( !cutLayer ) return NULL;
return getLayer ( metal1->getMask() | metal2->getMask() | cutLayer->getMask() );
}
Layer* Technology::getNthMetal ( int nth ) const
{
return getLayer ( _metalMask.nthbit(nth) );
}
void Technology::setName(const Name& name)
// ***************************************
{
@ -176,6 +274,32 @@ void Technology::setName(const Name& name)
}
}
bool Technology::setWorkingLayer ( const Name& name )
{
Layer* layer = getLayer ( name );
if ( !layer ) return false;
return setWorkingLayer ( layer );
}
bool Technology::setWorkingLayer ( const Layer* layer )
{
bool found = false;
LayerMaskMap::iterator lb = _layerMaskMap.lower_bound ( layer->getMask() );
LayerMaskMap::iterator ub = _layerMaskMap.upper_bound ( layer->getMask() );
for ( ; lb != ub ; lb++ ) {
if ( lb->second == layer ) {
lb->second->setWorking ( true );
found = true;
} else
lb->second->setWorking ( false );
}
return found;
}
void Technology::_postCreate()
// ***************************
{
@ -194,6 +318,34 @@ void Technology::_preDestroy()
_dataBase->_setTechnology(NULL);
}
void Technology::_insertInLayerMaskMap ( Layer* layer )
// ****************************************************
{
_layerMaskMap.insert ( make_pair(layer->getMask(),layer) );
}
void Technology::_removeFromLayerMaskMap ( Layer* layer )
// ******************************************************
{
LayerMaskMap::iterator lb = _layerMaskMap.lower_bound ( layer->getMask() );
LayerMaskMap::iterator ub = _layerMaskMap.upper_bound ( layer->getMask() );
for ( ; lb != ub ; lb++ ) {
if ( lb->second == layer ) {
_layerMaskMap.erase ( lb );
break;
}
}
}
string Technology::_getTypeName () const
{
return _TName("Technology");
}
string Technology::_getString() const
// **********************************
{
@ -209,7 +361,9 @@ Record* Technology::_getRecord() const
if (record) {
record->add(getSlot("DataBase", _dataBase));
record->add(getSlot("Name", &_name));
record->add(getSlot("Layers", &_layerList));
record->add(getSlot("Layers", &_layerMaskMap));
record->add(getSlot("cutMask", &_cutMask));
record->add(getSlot("metalMask", &_metalMask));
}
return record;
}

View File

@ -104,7 +104,9 @@ namespace Hurricane {
_basicLayers.reserve ( 3 );
_enclosures .reserve ( 3 );
// Have to check wich one is top layer & cutLayer of type cut.
if ( bottomLayer->getMask() > topLayer->getMask() )
swap ( bottomLayer, topLayer );
_basicLayers.push_back ( bottomLayer );
_basicLayers.push_back ( cutLayer );
_basicLayers.push_back ( topLayer );
@ -146,6 +148,22 @@ namespace Hurricane {
{ return getCollection(_basicLayers); }
const Layer* ViaLayer::getTop () const
{ return getTechnology()->getLayer(_basicLayers[2]->getMask()); }
const Layer* ViaLayer::getBottom () const
{ return getTechnology()->getLayer(_basicLayers[0]->getMask()); }
const Layer* ViaLayer::getOpposite ( const Layer* layer ) const
{
if ( layer->getMask() == _basicLayers[0]->getMask() ) return getTop();
if ( layer->getMask() == _basicLayers[2]->getMask() ) return getBottom();
return NULL;
}
DbU::Unit ViaLayer::getEnclosure () const
{
return _maximalEnclosure;

View File

@ -894,6 +894,7 @@ template<typename Type> inline Hurricane::Record* getRecord ( const Hurricane::C
#include "hurricane/MultisetCollection.h"
#include "hurricane/SetCollection.h"
#include "hurricane/MapCollection.h"
#include "hurricane/MultimapCollection.h"
#include "hurricane/ListCollection.h"
#include "hurricane/VectorCollection.h"

View File

@ -51,9 +51,6 @@
// x-----------------------------------------------------------------x
//using namespace std;
namespace Hurricane {
@ -526,21 +523,21 @@ inline Hurricane::Record* getRecord ( const std::multiset<Element,Compare>* s )
# define GETSTRING_POINTER_SUPPORT(Data) \
template<> inline std::string getString<Data*>( Data* data ) \
{ if (!data) return "NULL " #Data; return data->_getString(); } \
{ if (!data) return "NULL [" #Data "]"; return data->_getString(); } \
\
template<> inline std::string getString<const Data*>( const Data* data ) \
{ if (!data) return "NULL const " #Data; return data->_getString(); }
{ if (!data) return "NULL [const " #Data "]"; return data->_getString(); }
# define IOSTREAM_POINTER_SUPPORT(Data) \
inline std::ostream& operator<< ( std::ostream& o, Data* d ) \
{ \
if (!d) return o << "NULL"; \
if (!d) return o << "NULL [" #Data "]"; \
return o << "&" << getString<Data*>(d); \
} \
inline std::ostream& operator<< ( std::ostream& o, const Data* d ) \
{ \
if (!d) return o << "NULL"; \
if (!d) return o << "NULL [const " #Data "]"; \
return o << "&" << getString<const Data*>(d); \
}

View File

@ -1,7 +1,7 @@
// -*- C++ -*-
//
// This file is part of the Hurricane Software.
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================

View File

@ -26,6 +26,7 @@
#ifndef __HURRICANE_EXTENSION_SLICE__
#define __HURRICANE_EXTENSION_SLICE__
#include "hurricane/Mask.h"
#include "hurricane/Name.h"
#include "hurricane/ExtensionSlices.h"
#include "hurricane/QuadTree.h"
@ -40,7 +41,7 @@ namespace Hurricane {
class ExtensionSlice {
public:
typedef unsigned long long Mask;
typedef Hurricane::Mask<unsigned long long> Mask;
public:
// Constructor & Destructor.
static ExtensionSlice* _create ( Cell* , const Name& );

View File

@ -64,7 +64,7 @@ class HyperNet {
Occurrence getHyperNetRootNetOccurrence(const Occurrence& netoccurrence);
bool IsHyperNetRootNetOccurrence(Occurrence netoccurrence);
bool isHyperNetRootNetOccurrence(Occurrence netoccurrence);

View File

@ -1,5 +1,4 @@
// -*- C++ -*-
//
// This file is part of the Hurricane Software.
@ -27,6 +26,7 @@
# ifndef __HURRICANE_LAYER__
# define __HURRICANE_LAYER__
# include "hurricane/Mask.h"
# include "hurricane/DBo.h"
# include "hurricane/Layers.h"
# include "hurricane/DbU.h"
@ -43,7 +43,7 @@ namespace Hurricane {
public:
// Types.
typedef unsigned long long Mask;
typedef Hurricane::Mask<unsigned long long> Mask;
// Accessors.
inline Technology* getTechnology () const;
inline const Name& getName () const;
@ -54,6 +54,13 @@ namespace Hurricane {
inline DbU::Unit getPitch () const;
virtual BasicLayers getBasicLayers () const = 0;
virtual Layer* getConnectorLayer () const;
virtual const Layer* getTop () const;
virtual const Layer* getBottom () const;
virtual const Layer* getOpposite ( const Layer* ) const;
Layer* getMetalAbove ( bool useWorking=true ) const;
Layer* getMetalBelow ( bool useWorking=true ) const;
Layer* getCutAbove ( bool useWorking=true ) const;
Layer* getCutBelow ( bool useWorking=true ) const;
virtual Layer* getObstructionLayer () const;
virtual DbU::Unit getEnclosure () const;
virtual DbU::Unit getExtentionCap () const;
@ -62,10 +69,14 @@ namespace Hurricane {
virtual DbU::Unit getExtentionCap ( const BasicLayer* layer ) const;
virtual DbU::Unit getExtentionWidth ( const BasicLayer* layer ) const;
// Predicates
inline bool above ( const Layer* layer ) const;
inline bool below ( const Layer* layer ) const;
bool contains ( const Layer* layer ) const;
bool intersect ( const Layer* layer ) const;
inline bool isWorking () const;
// Updators
void setName ( const Name& name );
inline void setWorking ( bool );
void setMinimalSize ( const DbU::Unit& minimalSize );
void setMinimalSpacing ( const DbU::Unit& minimalSpacing );
void setPitch ( const DbU::Unit& pitch );
@ -79,7 +90,10 @@ namespace Hurricane {
inline void _setMask ( const Mask& mask );
inline void _setExtractMask ( const Mask& extractMask );
inline void _setNextOfTechnologyLayerMap ( Layer* layer );
public:
struct MaskCompare {
inline bool operator () ( const Layer*, const Layer* ) const;
};
private:
// Internal: Attributes
@ -91,6 +105,7 @@ namespace Hurricane {
DbU::Unit _minimalSpacing;
DbU::Unit _pitch;
Layer* _nextOfTechnologyLayerMap;
bool _working;
protected:
// Internal: Constructors & Destructors.
@ -106,6 +121,9 @@ namespace Hurricane {
// Inline Functions.
inline bool Layer::isWorking () const { return _working; }
inline bool Layer::above ( const Layer* layer ) const { return _mask > layer->getMask(); }
inline bool Layer::below ( const Layer* layer ) const { return _mask < layer->getMask(); }
inline Technology* Layer::getTechnology () const { return _technology; }
inline const Name& Layer::getName () const { return _name; }
inline const Layer::Mask& Layer::getMask () const { return _mask; }
@ -113,17 +131,22 @@ namespace Hurricane {
inline const DbU::Unit& Layer::getMinimalSize () const { return _minimalSize; }
inline const DbU::Unit& Layer::getMinimalSpacing () const { return _minimalSpacing; }
inline DbU::Unit Layer::getPitch () const { return (!_pitch?(_minimalSize + _minimalSpacing):_pitch); }
inline void Layer::setWorking ( bool state ) { _working = state; }
inline Layer* Layer::_getNextOfTechnologyLayerMap () const { return _nextOfTechnologyLayerMap; }
inline void Layer::_setMask ( const Mask& mask ) { _mask = mask; }
inline void Layer::_setExtractMask ( const Mask& extractMask ) { _extractMask = extractMask; }
inline void Layer::_setNextOfTechnologyLayerMap ( Layer* layer ) { _nextOfTechnologyLayerMap = layer; }
inline bool Layer::MaskCompare::operator () ( const Layer* layer1, const Layer* layer2 ) const
{ return layer1->getMask() < layer2->getMask(); }
} // End of Hurricane namespace.
INSPECTOR_P_SUPPORT(Hurricane::Layer);
INSPECTOR_PV_SUPPORT(Hurricane::Layer::Mask);
# endif

View File

@ -0,0 +1,184 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./Mask.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_MASK__
#define __HURRICANE_MASK__
#include <iomanip>
#include "hurricane/Commons.h"
namespace Hurricane {
template<typename IntType>
class Mask {
public:
// Methods.
inline Mask ( IntType mask=0 );
inline bool zero () const;
inline Mask& set ( const Mask mask );
inline Mask& unset ( const Mask mask );
inline bool contains ( const Mask mask ) const;
inline bool intersect ( const Mask mask ) const;
inline Mask nthbit ( unsigned int ) const;
inline Mask operator compl () const;
inline Mask operator bitand ( const Mask mask ) const;
inline Mask operator bitor ( const Mask mask ) const;
inline Mask operator xor ( const Mask mask ) const;
inline Mask lshift ( unsigned int ) const;
inline Mask rshift ( unsigned int ) const;
inline Mask& operator |= ( const Mask mask );
inline Mask& operator &= ( const Mask mask );
inline bool operator == ( const Mask mask ) const;
inline bool operator != ( const Mask mask ) const;
inline bool operator < ( const Mask mask ) const;
inline bool operator > ( const Mask mask ) const;
inline operator IntType () const;
// Hurricane Managment.
inline string _getTypeName () const;
inline string _getString () const;
inline Record* _getRecord () const;
protected:
// Internal: Attributes.
static size_t _width;
IntType _mask;
};
// Inline Functions.
template<typename IntType>
inline Mask<IntType>::Mask ( IntType mask ) : _mask(mask) { }
template<typename IntType>
inline bool Mask<IntType>::zero () const
{ return _mask == 0; }
template<typename IntType>
inline Mask<IntType>& Mask<IntType>::set ( const Mask<IntType> mask )
{ _mask |= mask._mask; return *this; }
template<typename IntType>
inline Mask<IntType>& Mask<IntType>::unset ( const Mask<IntType> mask )
{ _mask &= ~mask._mask; return *this; }
template<typename IntType>
inline bool Mask<IntType>::contains ( const Mask<IntType> mask ) const
{ return (_mask & mask._mask) && !(~_mask & mask._mask); }
template<typename IntType>
inline bool Mask<IntType>::intersect ( const Mask<IntType> mask ) const
{ return _mask & mask._mask; }
template<typename IntType>
inline Mask<IntType> Mask<IntType>::nthbit ( unsigned int nth ) const
{
IntType select = 1;
for ( ; select ; select=select<<1 ) {
if ( _mask & select ) nth--;
if ( !nth ) break;
}
return select;
}
template<typename IntType>
inline Mask<IntType> Mask<IntType>::operator compl () const
{ return ~_mask; }
template<typename IntType>
inline Mask<IntType> Mask<IntType>::operator bitand ( const Mask<IntType> mask ) const
{ return _mask & mask._mask; }
template<typename IntType>
inline Mask<IntType> Mask<IntType>::operator bitor ( const Mask<IntType> mask ) const
{ return _mask | mask._mask; }
template<typename IntType>
inline Mask<IntType> Mask<IntType>::operator xor ( const Mask<IntType> mask ) const
{ return _mask ^ mask._mask; }
template<typename IntType>
inline Mask<IntType> Mask<IntType>::lshift ( unsigned int s ) const
{ return _mask << s; }
template<typename IntType>
inline Mask<IntType> Mask<IntType>::rshift ( unsigned int s ) const
{ return _mask >> s; }
template<typename IntType>
inline Mask<IntType>& Mask<IntType>::operator |= ( const Mask<IntType> mask )
{ _mask |= mask._mask; return *this; }
template<typename IntType>
inline Mask<IntType>& Mask<IntType>::operator &= ( const Mask<IntType> mask )
{ _mask &= mask._mask; return *this; }
template<typename IntType>
inline bool Mask<IntType>::operator == ( const Mask<IntType> mask ) const
{ return _mask == mask._mask; }
template<typename IntType>
inline bool Mask<IntType>::operator != ( const Mask<IntType> mask ) const
{ return _mask == mask._mask; }
template<typename IntType>
inline bool Mask<IntType>::operator < ( const Mask<IntType> mask ) const
{ return _mask < mask._mask; }
template<typename IntType>
inline bool Mask<IntType>::operator > ( const Mask<IntType> mask ) const
{ return _mask > mask._mask; }
template<typename IntType>
inline Mask<IntType>::operator IntType () const { return _mask; }
template<typename IntType>
inline string Mask<IntType>::_getTypeName () const { return _TName("Mask"); }
template<typename IntType>
inline string Mask<IntType>::_getString () const
{
std::ostringstream formatted;
formatted << "0x" << std::hex << std::setw(_width) << std::setfill('0') << _mask;
return formatted.str();
}
template<typename IntType>
inline Record* Mask<IntType>::_getRecord () const
{
Record* record = new Record ( _getString() );
record->add(getSlot("Mask", &_mask));
return record;
}
template<typename IntType>
size_t Mask<IntType>::_width = sizeof(IntType)<<2;
} // End of Hurricane namespace.
# endif // __HURRICANE_MASK__

View File

@ -0,0 +1,440 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./MultimapCollection.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_MULTIMAP_COLLECTION__
#define __HURRICANE_MULTIMAP_COLLECTION__
#include "hurricane/Commons.h"
namespace Hurricane {
// -------------------------------------------------------------------
// Class Template : "Hurricane::MultimapCollection".
template<class Key, class Element, class Compare=less<Key> >
class MultimapCollection : public Collection<Element> {
public:
// Types.
typedef std::multimap<Key,Element,Compare> Multimap;
public:
// Locator sub-class.
class Locator : public Hurricane::Locator<Element> {
public:
Locator ( const Multimap* );
virtual Element getElement () const;
virtual Hurricane::Locator<Element>* getClone () const;
virtual bool isValid () const;
virtual void progress ();
private:
const Multimap* _elements;
typename Multimap::const_iterator _iterator;
};
public:
// Methods.
MultimapCollection ( const Multimap* elements=NULL );
MultimapCollection ( const Multimap& );
MultimapCollection ( const MultimapCollection& );
MultimapCollection& operator= ( const MultimapCollection& );
virtual Collection<Element>* getClone () const;
virtual Hurricane::Locator<Element>* getLocator () const;
virtual unsigned getSize () const;
virtual string _getTypeName () const;
virtual string _getString () const;
Record* _getRecord () const;
private:
// Internal: Attributes.
const Multimap* _elements;
};
// -------------------------------------------------------------------
// Class Definition : "Hurricane::MultimapCollection::Locator".
template<class Key, class Element, class Compare>
MultimapCollection<Key,Element,Compare>::Locator::Locator ( const Multimap* elements )
: Hurricane::Locator<Element>()
, _elements(elements)
, _iterator()
{ if (_elements) _iterator = _elements->begin(); };
template<class Key, class Element, class Compare>
Element MultimapCollection<Key,Element,Compare>::Locator::getElement () const
{
return (isValid()) ? (*_iterator).second : Element();
}
template<class Key, class Element, class Compare>
Hurricane::Locator<Element>* MultimapCollection<Key,Element,Compare>::Locator::getClone () const
{
return new Locator(_elements);
}
template<class Key, class Element, class Compare>
bool MultimapCollection<Key,Element,Compare>::Locator::isValid () const
{
return (_elements && (_iterator != _elements->end()));
}
template<class Key, class Element, class Compare>
void MultimapCollection<Key,Element,Compare>::Locator::progress ()
{
++_iterator;
}
// -------------------------------------------------------------------
// Class Definition : "Hurricane::MultimapCollection::Locator".
template<class Key, class Element, class Compare>
MultimapCollection<Key,Element,Compare>::MultimapCollection ( const Multimap* elements )
: Collection<Element>()
, _elements(elements)
{ }
template<class Key, class Element, class Compare>
MultimapCollection<Key,Element,Compare>::MultimapCollection ( const Multimap& elements )
: Collection<Element>()
, _elements(&elements)
{ }
template<class Key, class Element, class Compare>
MultimapCollection<Key,Element,Compare>::MultimapCollection ( const MultimapCollection& collection )
: Collection<Element>()
, _elements(collection._elements)
{ }
template<class Key, class Element, class Compare>
MultimapCollection<Key,Element,Compare>& MultimapCollection<Key,Element,Compare>::operator= ( const MultimapCollection& collection )
{
_elements = collection._elements;
return *this;
}
template<class Key, class Element, class Compare>
Collection<Element>* MultimapCollection<Key,Element,Compare>::getClone () const
{
return new MultimapCollection(*this);
}
template<class Key, class Element, class Compare>
Hurricane::Locator<Element>* MultimapCollection<Key,Element,Compare>::getLocator () const
{
return (_elements) ? new Locator(_elements) : NULL;
}
template<class Key, class Element, class Compare>
unsigned MultimapCollection<Key,Element,Compare>::getSize () const
{
return (_elements) ? _elements->size() : 0;
}
template<class Key, class Element, class Compare>
string MultimapCollection<Key,Element,Compare>::_getTypeName () const
{
return _TName("MultimapCollection");
}
template<class Key, class Element, class Compare>
string MultimapCollection<Key,Element,Compare>::_getString () const
{
if (!_elements)
return "<" + _getTypeName() + " unbound>";
else {
if (_elements->empty())
return "<" + _getTypeName() + " empty>";
else
return "<" + _getTypeName() + " " + getString(_elements->size()) + ">";
}
}
template<class Key, class Element, class Compare>
Record* MultimapCollection<Key,Element,Compare>::_getRecord () const
{
Record* record = NULL;
if (!_elements->empty()) {
record = new Record(_getString());
typename map<Key,Element,Compare>::const_iterator iterator = _elements->begin();
while (iterator != _elements->end()) {
record->add(getSlot<Element>(getString((*iterator).first), (*iterator).second));
++iterator;
}
}
return record;
}
// -------------------------------------------------------------------
// Functions Templates.
// template<class Key, class Element, class Compare>
// inline GenericCollection<Element> getCollection ( const std::multimap<Key,Element,Compare>& elements )
// {
// return MultimapCollection<Key,Element,Compare>(elements);
// }
template<class Key, class Element, class Compare>
inline GenericCollection<Element> getCollection ( const std::multimap<Key,Element,Compare>* elements )
{
return MultimapCollection<Key,Element,Compare>(elements);
}
// -------------------------------------------------------------------
// Class Template : "Hurricane::MultimapRangeCollection".
template<class Key, class Element, class Compare=less<Key> >
class MultimapRangeCollection : public Collection<Element> {
public:
// Types.
typedef std::multimap<Key,Element,Compare> Multimap;
public:
// Locator sub-class.
class Locator : public Hurricane::Locator<Element> {
public:
Locator ( const Multimap*, const Key& );
virtual Element getElement () const;
virtual Hurricane::Locator<Element>* getClone () const;
virtual bool isValid () const;
virtual void progress ();
private:
const Multimap* _elements;
const Key _key;
typename Multimap::const_iterator _iterator;
typename Multimap::const_iterator _upperbound;
};
public:
// Methods.
MultimapRangeCollection ( const Multimap*, const Key& );
MultimapRangeCollection ( const Multimap&, const Key& );
MultimapRangeCollection ( const MultimapRangeCollection& );
MultimapRangeCollection& operator= ( const MultimapRangeCollection& );
virtual Collection<Element>* getClone () const;
virtual Hurricane::Locator<Element>* getLocator () const;
virtual unsigned getSize () const;
virtual string _getTypeName () const;
virtual string _getString () const;
Record* _getRecord () const;
private:
// Internal: Attributes.
const Multimap* _elements;
const Key _key;
};
// -------------------------------------------------------------------
// Class Definition : "Hurricane::MultimapRangeCollection::Locator".
template<class Key, class Element, class Compare>
MultimapRangeCollection<Key,Element,Compare>::Locator::Locator ( const Multimap* elements, const Key& key )
: Hurricane::Locator<Element>()
, _elements(elements)
, _key(key)
, _iterator()
, _upperbound()
{
if (_elements) {
_iterator = _elements->lower_bound(key);
_upperbound = _elements->upper_bound(key);
}
};
template<class Key, class Element, class Compare>
Element MultimapRangeCollection<Key,Element,Compare>::Locator::getElement () const
{
return (isValid()) ? (*_iterator).second : Element();
}
template<class Key, class Element, class Compare>
Hurricane::Locator<Element>* MultimapRangeCollection<Key,Element,Compare>::Locator::getClone () const
{
return new Locator(_elements,_key);
}
template<class Key, class Element, class Compare>
bool MultimapRangeCollection<Key,Element,Compare>::Locator::isValid () const
{
return (_elements && (_iterator != _upperbound));
}
template<class Key, class Element, class Compare>
void MultimapRangeCollection<Key,Element,Compare>::Locator::progress ()
{
++_iterator;
}
// -------------------------------------------------------------------
// Class Definition : "Hurricane::MultimapRangeCollection::Locator".
template<class Key, class Element, class Compare>
MultimapRangeCollection<Key,Element,Compare>::MultimapRangeCollection ( const Multimap* elements, const Key& key )
: Collection<Element>()
, _elements(elements)
, _key(key)
{ }
template<class Key, class Element, class Compare>
MultimapRangeCollection<Key,Element,Compare>::MultimapRangeCollection ( const Multimap& elements, const Key& key )
: Collection<Element>()
, _elements(&elements)
, _key(key)
{ }
template<class Key, class Element, class Compare>
MultimapRangeCollection<Key,Element,Compare>::MultimapRangeCollection ( const MultimapRangeCollection& collection )
: Collection<Element>()
, _elements(collection._elements)
, _key(collection._key)
{ }
template<class Key, class Element, class Compare>
MultimapRangeCollection<Key,Element,Compare>& MultimapRangeCollection<Key,Element,Compare>::operator= ( const MultimapRangeCollection& collection )
{
_elements = collection._elements;
_key = collection._key;
return *this;
}
template<class Key, class Element, class Compare>
Collection<Element>* MultimapRangeCollection<Key,Element,Compare>::getClone () const
{
return new MultimapRangeCollection(*this);
}
template<class Key, class Element, class Compare>
Hurricane::Locator<Element>* MultimapRangeCollection<Key,Element,Compare>::getLocator () const
{
return (_elements) ? new Locator(_elements,_key) : NULL;
}
template<class Key, class Element, class Compare>
unsigned MultimapRangeCollection<Key,Element,Compare>::getSize () const
{
if ( !_elements ) return 0;
size_t size = 0;
typename Multimap::const_iterator lb = _elements->upper_bound(_key);
typename Multimap::const_iterator ub = _elements->upper_bound(_key);
for ( ; lb != ub ; lb++, size++ );
return size;
}
template<class Key, class Element, class Compare>
string MultimapRangeCollection<Key,Element,Compare>::_getTypeName () const
{
return _TName("MultimapRangeCollection");
}
template<class Key, class Element, class Compare>
string MultimapRangeCollection<Key,Element,Compare>::_getString () const
{
if (!_elements)
return "<" + _getTypeName() + " unbound>";
else {
if (_elements->empty())
return "<" + _getTypeName() + " empty>";
else
return "<" + _getTypeName() + " " + getString(_elements->size()) + ">";
}
}
template<class Key, class Element, class Compare>
Record* MultimapRangeCollection<Key,Element,Compare>::_getRecord () const
{
Record* record = NULL;
if (!_elements->empty()) {
typename Multimap::const_iterator upperbound = _elements->upper_bound(_key);
record = new Record(_getString());
typename map<Key,Element,Compare>::const_iterator iterator = _elements->lower_bound(_key);
while (iterator != upperbound) {
record->add(getSlot<Element>(getString((*iterator).first), (*iterator).second));
++iterator;
}
}
return record;
}
// -------------------------------------------------------------------
// Functions Templates.
// template<class Key, class Element, class Compare>
// inline GenericCollection<Element> getRangeCollection ( const std::multimap<Key,Element,Compare>& elements, Key& key )
// {
// return MultimapRangeCollection<Key,Element,Compare>(elements,key);
// }
template<class Key, class Element, class Compare>
inline GenericCollection<Element> getRangeCollection ( const std::multimap<Key,Element,Compare>* elements, const Key& key )
{
return MultimapRangeCollection<Key,Element,Compare>(elements,key);
}
} // End of Hurricane namespace.
#endif // __HURRICANE_MULTIMAP_COLLECTION__

View File

@ -149,7 +149,8 @@ namespace Hurricane {
public:
static Name staticGetName ();
static StandardPrivateProperty* get ( const DBo* );
static Value* staticGetValue ( const DBo* );
static StandardPrivateProperty* get ( const DBo*, bool create=false );
// Constructors.
static StandardPrivateProperty* create ();
static StandardPrivateProperty* create ( const Value& );
@ -164,6 +165,8 @@ namespace Hurricane {
private:
// Internal: Attributes.
static Name _name;
static DBo* _owner;
static StandardPrivateProperty* _cache;
mutable Value _value;
protected:
@ -173,6 +176,14 @@ namespace Hurricane {
};
template<typename Value>
DBo* StandardPrivateProperty<Value>::_owner = NULL;
template<typename Value>
StandardPrivateProperty<Value>* StandardPrivateProperty<Value>::_cache = NULL;
template<typename Value>
Name StandardPrivateProperty<Value>::staticGetName ()
{
@ -180,36 +191,50 @@ namespace Hurricane {
}
template<typename Value>
Value* StandardPrivateProperty<Value>::staticGetValue ( const DBo* object )
{
if ( ( object == _owner ) || get(object) ) return _cache->getValue();
return NULL;
}
template<typename Value>
StandardPrivateProperty<Value>* StandardPrivateProperty<Value>::create ()
{
StandardPrivateProperty<Value>* property = new StandardPrivateProperty<Value>();
property->_postCreate();
return property;
_cache = new StandardPrivateProperty<Value>();
_cache->_postCreate();
return _cache;
}
template<typename Value>
StandardPrivateProperty<Value>* StandardPrivateProperty<Value>::create ( const Value& value )
{
StandardPrivateProperty<Value>* property = new StandardPrivateProperty<Value>(value);
property->_postCreate();
return property;
_cache = new StandardPrivateProperty<Value>(value);
_cache->_postCreate();
return _cache;
}
template<typename Value>
StandardPrivateProperty<Value>* StandardPrivateProperty<Value>::get ( const DBo* object )
StandardPrivateProperty<Value>* StandardPrivateProperty<Value>::get ( const DBo* object, bool create )
{
Property* property1 = object->getProperty ( StandardPrivateProperty<Value>::staticGetName() );
StandardPrivateProperty* property2 = dynamic_cast<StandardPrivateProperty<Value>*> ( property1 );
if ( object == _owner ) return _cache;
if ( property1 && !property2 )
Property* property = object->getProperty ( StandardPrivateProperty<Value>::staticGetName() );
_cache = dynamic_cast<StandardPrivateProperty<Value>*> ( property );
if ( !_cache ) {
if ( property )
throw Error ( propertyTypeNameError
, getString(StandardPrivateProperty<Value>::staticGetName()).c_str()
, getString(object).c_str() );
else if ( create )
const_cast<DBo*>(object)->put ( StandardPrivateProperty<Value>::create() );
}
return property2;
return _cache;
}
@ -314,7 +339,8 @@ namespace Hurricane {
public:
static Name staticGetName ();
static StandardSharedProperty* get ( const DBo* );
static Value* staticGetValue ( const DBo* );
static StandardSharedProperty* get ( const DBo*, bool create=false );
// Constructors.
static StandardSharedProperty* create ();
static StandardSharedProperty* create ( const Value& );
@ -329,6 +355,8 @@ namespace Hurricane {
private:
// Internal: Attributes.
static Name _name;
static DBo* _owner;
static StandardSharedProperty* _cache;
mutable Value _value;
protected:
@ -339,6 +367,14 @@ namespace Hurricane {
// Template function members.
template<typename Value>
DBo* StandardSharedProperty<Value>::_owner = NULL;
template<typename Value>
StandardSharedProperty<Value>* StandardSharedProperty<Value>::_cache = NULL;
template<typename Value>
Name StandardSharedProperty<Value>::staticGetName ()
{
@ -346,36 +382,50 @@ namespace Hurricane {
}
template<typename Value>
Value* StandardSharedProperty<Value>::staticGetValue ( const DBo* object )
{
if ( ( object == _owner ) || get(object) ) return _cache->getValue();
return NULL;
}
template<typename Value>
StandardSharedProperty<Value>* StandardSharedProperty<Value>::create ()
{
StandardSharedProperty<Value>* property = new StandardSharedProperty<Value>();
property->_postCreate();
return property;
_cache = new StandardSharedProperty<Value>();
_cache->_postCreate();
return _cache;
}
template<typename Value>
StandardSharedProperty<Value>* StandardSharedProperty<Value>::create ( const Value& value )
{
StandardSharedProperty<Value>* property = new StandardPrivateProperty<Value>(value);
property->_postCreate();
return property;
_cache = new StandardPrivateProperty<Value>(value);
_cache->_postCreate();
return _cache;
}
template<typename Value>
StandardSharedProperty<Value>* StandardSharedProperty<Value>::get ( const DBo* object )
StandardSharedProperty<Value>* StandardSharedProperty<Value>::get ( const DBo* object, bool create )
{
Property* property1 = object->getProperty ( StandardSharedProperty<Value>::staticGetName() );
StandardSharedProperty* property2 = dynamic_cast<StandardSharedProperty<Value>*> ( property1 );
if ( _owner == object ) return _cache;
if ( property1 && !property2 )
Property* property = object->getProperty ( StandardSharedProperty<Value>::staticGetName() );
_cache = dynamic_cast<StandardSharedProperty<Value>*> ( property );
if ( !_cache ) {
if ( property )
throw Error ( propertyTypeNameError
, getString(StandardSharedProperty<Value>::staticGetName()).c_str()
, getString(object).c_str() );
else if ( create )
const_cast<DBo*>(object)->put ( StandardSharedProperty<Value>::create() );
}
return property2;
return _cache;
}

View File

@ -2,36 +2,8 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Project.
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
//
// Main contributors :
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// The Coriolis Project is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// The Coriolis Project is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Coriolis Project; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
// License-Tag
// Authors-Tag
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
@ -42,7 +14,7 @@
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Remy Escassut |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./RegularLayer.h" |
@ -72,6 +44,9 @@ namespace Hurricane {
// Accessors.
virtual BasicLayers getBasicLayers () const;
inline BasicLayer* getBasicLayer () const;
virtual const Layer* getTop () const;
virtual const Layer* getBottom () const;
virtual const Layer* getOpposite ( const Layer* ) const;
virtual DbU::Unit getEnclosure () const;
virtual DbU::Unit getExtentionCap () const;
virtual DbU::Unit getExtentionWidth () const;

View File

@ -1,12 +1,33 @@
// ****************************************************************************************************
// File: Technology.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_TECHNOLOGY
#define HURRICANE_TECHNOLOGY
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./Technology.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_TECHNOLOGY__
#define __HURRICANE_TECHNOLOGY__
#include <map>
#include "hurricane/Mask.h"
#include "hurricane/DBo.h"
#include "hurricane/Layer.h"
#include "hurricane/BasicLayers.h"
@ -14,102 +35,110 @@
#include "hurricane/ViaLayers.h"
#include "hurricane/IntrusiveMap.h"
namespace Hurricane {
using std::multimap;
class DataBase;
class BasicLayer;
class RegularLayer;
class ViaLayer;
// -------------------------------------------------------------------
// Class : "Hurricane::Technology".
// ****************************************************************************************************
// Technology declaration
// ****************************************************************************************************
class Technology : public DBo {
// **************************
// Types
// *****
public: typedef DBo Inherit;
public: class LayerMap : public IntrusiveMap<Name, Layer> {
// ******************************************************
public: typedef IntrusiveMap<Name, Layer> Inherit;
public: LayerMap();
public: virtual Name _getKey(Layer* layer) const;
public: virtual unsigned _getHashValue(Name name) const;
public: virtual Layer* _getNextElement(Layer* layer) const;
public: virtual void _setNextElement(Layer* layer, Layer* nextLayer) const;
public:
typedef DBo Inherit;
typedef multimap<Layer::Mask,Layer*> LayerMaskMap;
public:
// Sub-class : LayerMap.
class LayerMap : public IntrusiveMap<Name,Layer> {
public:
typedef IntrusiveMap<Name,Layer> Inherit;
public:
LayerMap ();
virtual Name _getKey ( Layer* ) const;
virtual unsigned _getHashValue ( Name ) const;
virtual Layer* _getNextElement ( Layer* ) const;
virtual void _setNextElement ( Layer* , Layer* nextLayer) const;
};
public: typedef list<Layer*> LayerList;
public:
// Constructor.
static Technology* create ( DataBase* , const Name& );
// Accessors.
inline DataBase* getDataBase () const;
inline const Name& getName () const;
inline Layer* getLayer ( const Name& ) const;
BasicLayer* getBasicLayer ( const Name& ) const;
RegularLayer* getRegularLayer ( const Name& ) const;
ViaLayer* getViaLayer ( const Name& ) const;
inline Layers getLayers () const;
BasicLayers getBasicLayers () const;
BasicLayers getBasicLayers ( const Layer::Mask& ) const;
RegularLayers getRegularLayers () const;
ViaLayers getViaLayers () const;
Layer* getLayer ( const Layer::Mask&, bool useWorking=true ) const;
Layer* getMetalAbove ( const Layer*, bool useWorking=true ) const;
Layer* getMetalBelow ( const Layer*, bool useWorking=true ) const;
Layer* getCutAbove ( const Layer*, bool useWorking=true ) const;
Layer* getCutBelow ( const Layer*, bool useWorking=true ) const;
Layer* getViaBetween ( const Layer*, const Layer* ) const;
Layer* getNthMetal ( int ) const;
// Updators.
void setName ( const Name& );
bool setWorkingLayer ( const Name& );
bool setWorkingLayer ( const Layer* );
// Others.
inline LayerMap& _getLayerMap ();
inline LayerMaskMap& _getLayerMaskMap ();
void _insertInLayerMaskMap ( Layer* );
void _removeFromLayerMaskMap ( Layer* );
inline Layer::Mask& _getCutMask ();
inline Layer::Mask& _getMetalMask ();
// Hurricane Managment.
virtual string _getTypeName () const;
virtual string _getString () const;
virtual Record* _getRecord () const;
// Attributes
// **********
private: DataBase* _dataBase;
private: Name _name;
private: LayerMap _layerMap;
private: LayerList _layerList;
// Constructors
// ************
protected: Technology(DataBase* dataBase, const Name& name);
public: static Technology* create(DataBase* dataBase, const Name& name);
// Accessors
// *********
public: DataBase* getDataBase() const {return _dataBase;};
public: const Name& getName() const {return _name;};
public: Layer* getLayer(const Name& name) const {return _layerMap.getElement(name);};
public: BasicLayer* getBasicLayer(const Name& name) const;
public: RegularLayer* getRegularLayer(const Name& name) const;
public: ViaLayer* getViaLayer(const Name& name) const;
public: Layers getLayers() const {return getCollection(_layerList);};
public: BasicLayers getBasicLayers() const;
public: BasicLayers getBasicLayers(const Layer::Mask& mask) const;
public: RegularLayers getRegularLayers() const;
public: ViaLayers getViaLayers() const;
// Updators
// ********
public: void setName(const Name& name);
// Others
// ******
protected: virtual void _postCreate();
protected: virtual void _preDestroy();
public: virtual string _getTypeName() const {return _TName("Technology");};
public: virtual string _getString() const;
public: virtual Record* _getRecord() const;
public: LayerMap& _getLayerMap() {return _layerMap;};
public: LayerList& _getLayerList() {return _layerList;};
private:
// Internal: Attributes.
DataBase* _dataBase;
Name _name;
LayerMap _layerMap;
LayerMaskMap _layerMaskMap;
Layer::Mask _cutMask;
Layer::Mask _metalMask;
protected:
// Constructors & Destructors.
Technology ( DataBase* , const Name& );
virtual void _postCreate ();
virtual void _preDestroy ();
};
// Inline Functions.
inline DataBase* Technology::getDataBase () const { return _dataBase; }
inline const Name& Technology::getName () const { return _name; }
inline Layer* Technology::getLayer ( const Name& name ) const { return _layerMap.getElement(name); }
inline Layers Technology::getLayers () const { return getCollection(&_layerMaskMap); }
inline Technology::LayerMap& Technology::_getLayerMap () { return _layerMap; }
inline Technology::LayerMaskMap& Technology::_getLayerMaskMap () { return _layerMaskMap; }
inline Layer::Mask& Technology::_getCutMask () { return _cutMask; }
inline Layer::Mask& Technology::_getMetalMask () { return _metalMask; }
} // End of Hurricane namespace.
INSPECTOR_P_SUPPORT(Hurricane::Technology);
#endif // HURRICANE_TECHNOLOGY
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#endif // __HURRICANE_TECHNOLOGY__

View File

@ -76,6 +76,9 @@ namespace Hurricane {
);
// Accessors.
virtual BasicLayers getBasicLayers () const;
virtual const Layer* getTop () const;
virtual const Layer* getBottom () const;
virtual const Layer* getOpposite ( const Layer* ) const;
virtual DbU::Unit getEnclosure () const;
virtual DbU::Unit getEnclosure ( const BasicLayer* layer ) const;
// Updators.

View File

@ -32,6 +32,7 @@
hurricane/viewer/HPaletteEntry.h
hurricane/viewer/HPalette.h
hurricane/viewer/DisplayStyle.h
hurricane/viewer/ColorScale.h
hurricane/viewer/Graphics.h
hurricane/viewer/HGraphics.h
hurricane/viewer/Selector.h
@ -54,6 +55,7 @@
)
set ( cpps ScreenUtilities.cpp
DisplayStyle.cpp
ColorScale.cpp
Graphics.cpp
HGraphics.cpp
HPaletteEntry.cpp

View File

@ -1,36 +1,9 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Project.
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// Main contributors :
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// The Coriolis Project is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// The Coriolis Project is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Coriolis Project; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
// License-Tag
// Authors-Tag
// ===================================================================
//
// $Id$
@ -123,17 +96,17 @@ namespace Hurricane {
if ( _openAction ) return;
_openAction = new QAction ( tr("&Open Cell"), this );
_openAction->setObjectName ( "viewer.file.openCell" );
_openAction->setObjectName ( "viewer.menuBar.file.openCell" );
_openAction->setIcon ( QIcon(":/images/stock_open.png") );
_openAction->setStatusTip ( tr("Open (load) a new Cell") );
_nextAction = new QAction ( tr("&Next Breakpoint"), this );
_nextAction->setObjectName ( "viewer.file.nextBreakpoint" );
_nextAction->setObjectName ( "viewer.menuBar.file.nextBreakpoint" );
_nextAction->setStatusTip ( tr("Proceed to the next breakpoint") );
for ( int i=0 ; i<CellHistorySize ; i++ ) {
_cellHistoryAction[i] = new QAction ( this );
_cellHistoryAction[i]->setObjectName ( QString("viewer.file.cellHistory[%1]").arg(i) );
_cellHistoryAction[i]->setObjectName ( QString("viewer.menuBar.file.cellHistory[%1]").arg(i) );
_cellHistoryAction[i]->setVisible ( false );
_cellHistoryAction[i]->setData ( i );
_cellHistoryAction[i]->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
@ -141,67 +114,67 @@ namespace Hurricane {
}
_saveAction = new QAction ( tr("&Save Cell"), this );
_saveAction->setObjectName ( "viewer.file.saveCell" );
_saveAction->setObjectName ( "viewer.menuBar.file.saveCell" );
_saveAction->setIcon ( QIcon(":/images/stock_save.png") );
_saveAction->setStatusTip ( tr("Save the current Cell") );
_saveAction->setVisible ( false );
_closeAction = new QAction ( tr("&Close"), this );
_closeAction->setObjectName ( "viewer.file.close" );
_closeAction->setObjectName ( "viewer.menuBar.file.close" );
_closeAction->setStatusTip ( tr("Close This Coriolis CellViewer") );
_closeAction->setShortcut ( QKeySequence(tr("CTRL+W")) );
connect ( _closeAction, SIGNAL(triggered()), this, SLOT(close()) );
_exitAction = new QAction ( tr("&Exit"), this );
_exitAction->setObjectName ( "viewer.file.exit" );
_exitAction->setObjectName ( "viewer.menuBar.file.exit" );
_exitAction->setStatusTip ( tr("Exit All Coriolis CellViewer") );
_exitAction->setShortcut ( QKeySequence(tr("CTRL+Q")) );
connect ( _exitAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()) );
_refreshAction = new QAction ( tr("&Refresh"), this );
_refreshAction->setObjectName ( "viewer.view.refresh" );
_refreshAction->setObjectName ( "viewer.menuBar.view.refresh" );
_refreshAction->setStatusTip ( tr("Force full redrawing of the display") );
_refreshAction->setShortcut ( QKeySequence(tr("CTRL+L")) );
_fitToContentsAction = new QAction ( tr("&Fit to Contents"), this );
_fitToContentsAction->setObjectName ( "viewer.view.fit" );
_fitToContentsAction->setObjectName ( "viewer.menuBar.view.fit" );
_fitToContentsAction->setStatusTip ( tr("Adjust zoom to fit the whole cell's contents") );
_fitToContentsAction->setShortcut ( Qt::Key_F );
_showSelectionAction = new QAction ( tr("&Show Selection"), this );
_showSelectionAction->setObjectName ( "viewer.view.showSelection" );
_showSelectionAction->setObjectName ( "viewer.menuBar.view.showSelection" );
_showSelectionAction->setStatusTip ( tr("Highlight the selected items (darken others)") );
_showSelectionAction->setShortcut ( Qt::Key_S );
_showSelectionAction->setCheckable ( true );
_showPaletteAction = new QAction ( tr("Show &Palette"), this );
_showPaletteAction->setObjectName ( "viewer.view.showPalette" );
_showPaletteAction->setObjectName ( "viewer.menuBar.view.showPalette" );
_showPaletteAction->setStatusTip ( tr("Hide/Show the Palette sub-window") );
_showPaletteAction->setCheckable ( true );
_showPaletteAction->setChecked ( true );
_graphicsSettingsAction = new QAction ( tr("Graphics Settings"), this );
_graphicsSettingsAction->setObjectName ( "viewer.view.graphicsSettings" );
_graphicsSettingsAction->setObjectName ( "viewer.menuBar.view.graphicsSettings" );
_graphicsSettingsAction->setStatusTip ( tr("Tune Graphics Settings") );
_displayFilterAction = new QAction ( tr("Display Filter"), this );
_displayFilterAction->setObjectName ( "viewer.view.displayFilter" );
_displayFilterAction->setObjectName ( "viewer.menuBar.view.displayFilter" );
_displayFilterAction->setStatusTip ( tr("Tune Cell Displaying") );
_runInspectorOnDataBase= new QAction ( tr("Inspect &DataBase"), this );
_runInspectorOnDataBase->setObjectName ( "viewer.tools.inspectDb" );
_runInspectorOnDataBase->setObjectName ( "viewer.menuBar.tools.inspectDb" );
_runInspectorOnDataBase->setStatusTip ( tr("Run Inspector on Hurricane DataBase") );
_runInspectorOnCell= new QAction ( tr("Inspect &Cell"), this );
_runInspectorOnCell->setObjectName ( "viewer.tools.inspectCell" );
_runInspectorOnCell->setObjectName ( "viewer.menuBar.tools.inspectCell" );
_runInspectorOnCell->setStatusTip ( tr("Run Inspector on the current Cell") );
_browseSelection= new QAction ( tr("Browse &Selection"), this );
_browseSelection->setObjectName ( "viewer.tools.browseSelection" );
_browseSelection->setObjectName ( "viewer.menuBar.tools.browseSelection" );
_browseSelection->setStatusTip ( tr("Browse objects currently selecteds") );
_browseNetlist= new QAction ( tr("Browse &Netlist"), this );
_browseNetlist->setObjectName ( "viewer.tools.browseNetlist" );
_browseNetlist->setObjectName ( "viewer.menuBar.tools.browseNetlist" );
_browseNetlist->setStatusTip ( tr("Browse netlist from the current Cell") );
}
@ -211,8 +184,10 @@ namespace Hurricane {
if ( _fileMenu ) return;
if ( !_openAction ) createActions ();
menuBar()->setObjectName ( tr("viewer.menuBar") );
_fileMenu = menuBar()->addMenu ( tr("File") );
_fileMenu->setObjectName ( "viewer.file" );
_fileMenu->setObjectName ( "viewer.menuBar.file" );
_fileMenu->addAction ( _openAction );
_fileMenu->addAction ( _nextAction );
_fileMenu->addSeparator ();
@ -225,7 +200,7 @@ namespace Hurricane {
_fileMenu->addAction ( _exitAction );
_viewMenu = menuBar()->addMenu ( tr("View") );
_viewMenu->setObjectName ( "viewer.view" );
_viewMenu->setObjectName ( "viewer.menuBar.view" );
_viewMenu->addAction ( _refreshAction );
_viewMenu->addAction ( _fitToContentsAction );
_viewMenu->addAction ( _showSelectionAction );
@ -234,15 +209,21 @@ namespace Hurricane {
_viewMenu->addAction ( _graphicsSettingsAction );
_toolsMenu = menuBar()->addMenu ( tr("Tools") );
_toolsMenu->setObjectName ( "viewer.tools" );
_toolsMenu->setObjectName ( "viewer.menuBar.tools" );
_toolsMenu->addAction ( _runInspectorOnDataBase );
_toolsMenu->addAction ( _runInspectorOnCell );
_toolsMenu->addAction ( _browseSelection );
_toolsMenu->addAction ( _browseNetlist );
}
QMenu* CellViewer::createDebugMenu ()
{
if ( !_debugMenu ) {
_debugMenu = menuBar()->addMenu ( tr("Debug") );
_debugMenu->setObjectName ( "viewer.debug" );
_debugMenu->hide ();
_debugMenu->setObjectName ( "viewer.menuBar.debug" );
}
return _debugMenu;
}
@ -283,13 +264,14 @@ namespace Hurricane {
| QDockWidget::DockWidgetMovable
| QDockWidget::DockWidgetFloatable
);
layerMapDock->setObjectName ( "viewer.dock.paletteWindow" );
layerMapDock->setObjectName ( "viewer.menuBar.dock.paletteWindow" );
layerMapDock->setWidget ( _palette );
layerMapDock->setAllowedAreas ( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
addDockWidget ( Qt::RightDockWidgetArea, layerMapDock );
setCentralWidget ( _cellWidget );
connect ( this , SIGNAL(redrawCellWidget()), _cellWidget, SLOT(redraw()) );
connect ( _graphicsSettings , SIGNAL(styleChanged()) , _cellWidget, SLOT(redraw()) );
connect ( _refreshAction , SIGNAL(triggered()) , _cellWidget, SLOT(redraw()) );
connect ( _fitToContentsAction , SIGNAL(triggered()) , _cellWidget, SLOT(fitToContents()) );
@ -380,7 +362,7 @@ namespace Hurricane {
void CellViewer::setShowPalette ( bool show )
{
QDockWidget* paletteWindow = findChild<QDockWidget*>("viewer.dock.paletteWindow");
QDockWidget* paletteWindow = findChild<QDockWidget*>("viewer.menuBar.dock.paletteWindow");
if ( !paletteWindow ) {
cerr << "paletteWindow not found." << endl;

View File

@ -1,43 +1,16 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Project.
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// Main contributors :
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// The Coriolis Project is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// The Coriolis Project is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Coriolis Project; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
// License-Tag
// Authors-Tag
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | C O R I O L I S |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
@ -291,7 +264,7 @@ namespace Hurricane {
void CellWidget::DrawingQuery::setDrawExtensionGo ( const Name& name )
{
map<Name,pair<InitDrawExtension_t*,DrawExtensionGo_t*> >::iterator idraw
map<Name,pair<InitExtensionGo_t*,DrawExtensionGo_t*> >::iterator idraw
= _drawExtensionGos.find ( name );
if ( idraw != _drawExtensionGos.end() ) {
@ -334,6 +307,8 @@ namespace Hurricane {
, const Transformation& transformation
)
{
cerr << "DrawingQuery::drawGo() - " << go << endl;
const Segment* segment = dynamic_cast<const Segment*>(go);
if ( segment ) {
if ( 1 < _cellWidget->dbuToDisplayLength(segment->getWidth()) ) {
@ -479,6 +454,11 @@ namespace Hurricane {
}
void CellWidget::updatePalette ()
{
emit updatePalette(getCell());
}
void CellWidget::bindToPalette ( HPalette* palette )
{
@ -487,6 +467,7 @@ namespace Hurricane {
connect ( _palette, SIGNAL(paletteChanged()) , this , SLOT(redraw()) );
connect ( this , SIGNAL(cellChanged(Cell*)) , _palette, SLOT(updateExtensions(Cell*)) );
connect ( this , SIGNAL(updatePalette(Cell*)), _palette, SLOT(updateExtensions(Cell*)) );
}
@ -619,12 +600,12 @@ namespace Hurricane {
_textDrawingQuery.doQuery ();
}
_drawingQuery.setFilter ( _queryFilter & ~Query::DoMasterCells );
//_drawingQuery.setFilter ( _queryFilter & ~Query::DoMasterCells );
forEach ( ExtensionSlice*, islice, _cell->getExtensionSlices() ) {
if ( isDrawableLayer((*islice)->getName()) ) {
if ( isDrawableExtension((*islice)->getName()) ) {
_drawingQuery.setExtensionMask ( (*islice)->getMask() );
_drawingQuery.setDrawExtensionGo ( (*islice)->getName() );
_drawingQuery.setFilter ( Query::DoExtensionGos );
_drawingQuery.doQuery ();
}
}
@ -717,6 +698,14 @@ namespace Hurricane {
}
void CellWidget::drawBox ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 )
{
_redrawRectCount++;
_drawingPlanes.setLineMode ( false );
_drawingPlanes.painter().drawRect ( dbuToDisplayRect(x1,y1,x2,y2) );
}
void CellWidget::drawBox ( const Box& box )
{
_redrawRectCount++;
@ -739,6 +728,13 @@ namespace Hurricane {
}
void CellWidget::drawLine ( DbU::Unit x1, DbU::Unit y1, DbU::Unit x2, DbU::Unit y2 )
{
_drawingPlanes.setLineMode ( true );
_drawingPlanes.painter().drawLine ( dbuToDisplayPoint(x1,y1), dbuToDisplayPoint(x2,y2) );
}
void CellWidget::drawLine ( const Point& p1, const Point& p2 )
{
_drawingPlanes.setLineMode ( true );

View File

@ -0,0 +1,106 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./ColorScale.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "hurricane/viewer/ColorScale.h"
namespace Hurricane {
// -------------------------------------------------------------------
// Class : "Hurricane::ColorScale"
ColorScale::ColorScale ( const Name& name )
: _name(name)
{
for ( size_t i=0 ; i<256 ; i++ ) {
_red [i] = 0;
_green[i] = 0;
_blue [i] = 0;
_color[i] = NULL;
_brush[i] = NULL;
}
}
ColorScale::~ColorScale ()
{
if ( _brush[0] ) {
for ( size_t i=0 ; i<256 ; i++ ) {
delete _brush[i];
delete _color[i];
}
}
}
void ColorScale::qtAllocate ()
{
if ( !_brush[0] ) {
for ( size_t i=0 ; i<256 ; i++ ) {
_color[i] = new QColor ( _red[i], _green[i], _blue[i] );
_brush[i] = new QBrush ( *_color[i] );
}
}
}
QBrush ColorScale::getBrush ( size_t i, int darkening ) const
{
assert ( _brush[i] != NULL );
QBrush brush ( *_brush[i] );
brush.setColor ( _color[i]->darker(darkening) );
return brush;
}
// -------------------------------------------------------------------
// Class : "Hurricane::FireColorScale"
FireColorScale::FireColorScale ()
: ColorScale("Fire")
{
for ( size_t i=0 ; i<128 ; i++ ) {
_red [i] = i * 2;
_green[i] = 0;
_blue [i] = 0;
}
for ( size_t i=128 ; i<224 ; i++ ) {
_red [i] = 255;
_green[i] = ((i-128)*8)/3;
_blue [i] = 0;
}
for ( size_t i=224 ; i<256 ; i++ ) {
_red [i] = 255;
_green[i] = 255;
_blue [i] = (i-224)*8;
}
}
} // End of Hurricane namespace.

View File

@ -74,6 +74,7 @@ namespace Hurricane {
Graphics::Graphics ()
: _styles()
, _active(NULL)
, _fireColorScale()
, _qtEnabled(false)
{
}
@ -128,6 +129,8 @@ namespace Hurricane {
_qtEnabled = true;
for ( size_t si=0 ; si < _styles.size() ; si++ )
_styles[si]->qtAllocate ();
_fireColorScale.qtAllocate ();
}
@ -289,6 +292,12 @@ namespace Hurricane {
}
const ColorScale& Graphics::getColorScale ( ColorScale::ScaleType id )
{
return getGraphics()->_getColorScale ( id );
}
} // End of Hurricane namespace.

View File

@ -1,36 +1,9 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Project.
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// Main contributors :
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// The Coriolis Project is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// The Coriolis Project is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Coriolis Project; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
// License-Tag
// Authors-Tag
// ===================================================================
//
// $Id$
@ -93,6 +66,7 @@ namespace Hurricane {
public:
CellViewer ( QWidget* parent=NULL );
QMenu* createDebugMenu ();
inline void setApplicationName ( const QString& name );
void setCell ( Cell* cell );
Cell* getCell ();
@ -112,6 +86,8 @@ namespace Hurricane {
void browseNetlist ();
void selectionBrowserDestroyed ();
void netlistBrowserDestroyed ();
signals:
void redrawCellWidget ();
public:
enum { CellHistorySize = 10 };
@ -164,8 +140,6 @@ namespace Hurricane {
inline void CellViewer::setApplicationName ( const QString& name ) { _applicationName = name; }
} // End of Hurricane namespace.

View File

@ -1,43 +1,16 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Project.
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// Main contributors :
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// The Coriolis Project is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// The Coriolis Project is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Coriolis Project; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
// License-Tag
// Authors-Tag
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | C O R I O L I S |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
@ -50,8 +23,8 @@
// x-----------------------------------------------------------------x
# ifndef __CELL_WIDGET_H__
# define __CELL_WIDGET_H__
#ifndef __HURRICANE_CELL_WIDGET_H__
#define __HURRICANE_CELL_WIDGET_H__
#include <math.h>
@ -115,7 +88,7 @@ namespace Hurricane {
, const Box&
, const Transformation&
);
typedef void ( InitDrawExtension_t )( CellWidget* );
typedef void ( InitExtensionGo_t )( CellWidget* );
public:
// Constructor & Destructor.
CellWidget ( QWidget* parent=NULL );
@ -135,12 +108,15 @@ namespace Hurricane {
inline void setStartLevel ( int level );
inline void setStopLevel ( int level );
inline void setQueryFilter ( int filter );
inline void addDrawExtensionGo ( const Name&, InitDrawExtension_t*, DrawExtensionGo_t* );
// Painter control & Hurricane objects drawing primitives.
inline void addDrawExtensionGo ( const Name&, InitExtensionGo_t*, DrawExtensionGo_t* );
inline QPainter& getPainter ();
inline float getScale () const;
bool isDrawableLayer ( const Name& );
bool isDrawableExtension ( const Name& );
void drawBox ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit );
void drawBox ( const Box& );
void drawLine ( DbU::Unit, DbU::Unit, DbU::Unit, DbU::Unit );
void drawLine ( const Point&, const Point& );
void drawText ( const Point&, const Name&, int angle=0, bool reverse=false );
void drawGrid ();
@ -179,6 +155,7 @@ namespace Hurricane {
void mouseReleaseEvent ( QMouseEvent* );
signals:
void cellChanged ( Cell* );
void updatePalette ( Cell* );
void mousePositionChanged ( const Point& position );
void selectionChanged ( const set<Selector*>&, Cell* );
void occurrenceToggled ( Occurrence );
@ -194,6 +171,7 @@ namespace Hurricane {
void toggleSelect ( Occurrence occurence, bool fromPopup );
void setShowSelection ( bool state );
void setCumulativeSelection ( bool state );
void updatePalette ();
inline void redraw ();
void redraw ( QRect redrawArea );
inline void redrawSelection ();
@ -285,7 +263,7 @@ namespace Hurricane {
, unsigned int filter
);
inline void addDrawExtensionGo ( const Name&
, InitDrawExtension_t*
, InitExtensionGo_t*
, DrawExtensionGo_t*
);
void setDrawExtensionGo ( const Name& );
@ -304,7 +282,7 @@ namespace Hurricane {
protected:
CellWidget* _cellWidget;
DrawExtensionGo_t* _drawExtensionGo;
map<Name,pair<InitDrawExtension_t*,DrawExtensionGo_t*> >
map<Name,pair<InitExtensionGo_t*,DrawExtensionGo_t*> >
_drawExtensionGos;
};
@ -377,10 +355,10 @@ namespace Hurricane {
inline void CellWidget::DrawingQuery::addDrawExtensionGo ( const Name& name
, InitDrawExtension_t* initDrawExtension
, InitExtensionGo_t* initExtensionGo
, DrawExtensionGo_t* drawExtensionGo
)
{ _drawExtensionGos[name] = make_pair(initDrawExtension,drawExtensionGo); }
{ _drawExtensionGos[name] = make_pair(initExtensionGo,drawExtensionGo); }
inline bool CellWidget::DrawingPlanes::getLineMode () const
@ -461,10 +439,10 @@ namespace Hurricane {
inline void CellWidget::addDrawExtensionGo ( const Name& name
, InitDrawExtension_t* initDrawExtension
, InitExtensionGo_t* initExtensionGo
, DrawExtensionGo_t* drawExtensionGo
)
{ _drawingQuery.addDrawExtensionGo ( name, initDrawExtension, drawExtensionGo ); }
{ _drawingQuery.addDrawExtensionGo ( name, initExtensionGo, drawExtensionGo ); }
inline void CellWidget::setStartLevel ( int level )
@ -579,6 +557,10 @@ namespace Hurricane {
{ return _showSelection; }
inline QPainter& CellWidget::getPainter ()
{ return _drawingPlanes.painter(); }
inline float CellWidget::getScale () const
{ return _scale; }
@ -590,4 +572,4 @@ namespace Hurricane {
} // End of Hurricane namespace.
# endif
#endif // __HURRICANE_CELL_WIDGET__

View File

@ -0,0 +1,94 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./ColorScale.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_COLOR_SCALE__
#define __HURRICANE_COLOR_SCALE__
#include <QColor>
#include <QBrush>
#include "hurricane/Name.h"
namespace Hurricane {
// -------------------------------------------------------------------
// Class : "Hurricane::ColorScale"
class ColorScale {
public:
// Types.
enum ScaleType { Grey = 1
, Fire
, Rainbow
};
public:
// Accessors.
void qtAllocate ();
inline const Name& getName () const;
QBrush getBrush ( size_t , int darkening ) const;
protected:
// Internal - Attributes.
const Name _name;
int _red [256];
int _green[256];
int _blue [256];
QColor *_color[256];
QBrush *_brush[256];
protected:
// Internal - Constructors & Destructors.
ColorScale ( const Name& );
~ColorScale ();
private:
ColorScale ( const ColorScale& );
ColorScale& operator= ( const ColorScale& );
};
// -------------------------------------------------------------------
// Class : "Hurricane::FireColorScale"
class FireColorScale : public ColorScale {
public:
FireColorScale ();
};
// Functions.
inline const Name& ColorScale::getName () const { return _name; }
} // End of Hurricane namespace.
#endif // __HURRICANE_COLOR_SCALE__

View File

@ -1,36 +1,9 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Project.
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// Main contributors :
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// The Coriolis Project is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// The Coriolis Project is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Coriolis Project; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
// License-Tag
// Authors-Tag
// ===================================================================
//
// $Id$
@ -50,8 +23,8 @@
// x-----------------------------------------------------------------x
# ifndef __DISPLAYSTYLE_H__
# define __DISPLAYSTYLE_H__
#ifndef __HURRICANE_DISPLAYSTYLE_H__
#define __HURRICANE_DISPLAYSTYLE_H__
#include <string>
@ -70,8 +43,6 @@
namespace Hurricane {
class DrawingStyle {
public:
@ -259,4 +230,4 @@ namespace Hurricane {
} // End of Hurricane namespace.
# endif
#endif // __HURRICANE_DISPLAYSTYLE__

View File

@ -1,36 +1,9 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Project.
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// Main contributors :
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// The Coriolis Project is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// The Coriolis Project is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Coriolis Project; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
// License-Tag
// Authors-Tag
// ===================================================================
//
// $Id$
@ -50,14 +23,15 @@
// x-----------------------------------------------------------------x
# ifndef __GRAPHICS_H__
# define __GRAPHICS_H__
#ifndef __HURRICANE_GRAPHICS__
#define __HURRICANE_GRAPHICS__
#include <string>
#include <vector>
#include "hurricane/viewer/DisplayStyle.h"
#include "hurricane/viewer/ColorScale.h"
#include <QFont>
@ -89,6 +63,7 @@ namespace Hurricane {
static const string& getPattern ( const Name& key );
static float getThreshold ( const Name& key );
static int getDarkening ();
static const ColorScale& getColorScale ( ColorScale::ScaleType );
// Modifiers.
static void addStyle ( DisplayStyle* displayStyle );
@ -104,6 +79,7 @@ namespace Hurricane {
static Graphics* _singleton;
vector<DisplayStyle*> _styles;
DisplayStyle* _active;
FireColorScale _fireColorScale;
bool _qtEnabled;
// Internals - Constructors & Destructors.
@ -127,6 +103,7 @@ namespace Hurricane {
inline const string& _getPattern ( const Name& key ) const;
inline float _getThreshold ( const Name& key ) const;
inline int _getDarkening () const;
inline const ColorScale& _getColorScale ( ColorScale::ScaleType ) const;
inline void _enable ();
};
@ -153,6 +130,17 @@ namespace Hurricane {
inline int Graphics::_getDarkening () const
{ return _active->getDarkening(); }
inline const ColorScale& Graphics::_getColorScale ( ColorScale::ScaleType id ) const
{
switch ( id ) {
case ColorScale::Grey:
case ColorScale::Fire:
case ColorScale::Rainbow:
break;
}
return _fireColorScale;
}
inline DisplayStyle* Graphics::_getStyle () const
{ return _active; }
@ -165,4 +153,4 @@ namespace Hurricane {
} // End of Hurricane namespace.
# endif
#endif // __HURRICANE_GRAPHICS__