diff --git a/crlcore/src/ccore/AllianceFramework.cpp b/crlcore/src/ccore/AllianceFramework.cpp index b3bca90a..548bade6 100644 --- a/crlcore/src/ccore/AllianceFramework.cpp +++ b/crlcore/src/ccore/AllianceFramework.cpp @@ -1,10 +1,34 @@ // -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | Alliance / Hurricane Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./AllianceFramework.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + #include "hurricane/Warning.h" #include "hurricane/Technology.h" #include "hurricane/DataBase.h" #include "hurricane/Library.h" +#include "hurricane/Cell.h" +#include "hurricane/Instance.h" #include "hurricane/viewer/Graphics.h" #include "crlcore/Utilities.h" @@ -23,6 +47,8 @@ namespace CRL { using Hurricane::Warning; using Hurricane::tab; using Hurricane::Graphics; + using Hurricane::ForEachIterator; + using Hurricane::Instance; AllianceFramework* AllianceFramework::_singleton = NULL; @@ -495,4 +521,27 @@ namespace CRL { } + size_t AllianceFramework::getInstancesCount ( Cell* cell, unsigned int flags ) + { + size_t gates = 0; + + forEach ( Instance*, iinstance, cell->getInstances() ) { + CatalogProperty *catalogProperty = static_cast + ((*iinstance)->getMasterCell()->getProperty ( CatalogProperty::getPropertyName()) ); + + if ( catalogProperty != NULL ) { + Catalog::State* state = catalogProperty->getState (); + if ( (flags and IgnoreFeeds) and state->isFeed() ) continue; + } + ++gates; + + if ( flags & Recursive ) { + gates += getInstancesCount ( iinstance->getMasterCell(), flags ); + } + } + + return gates; + } + + } // End of CRL namespace. diff --git a/crlcore/src/ccore/crlcore/AllianceFramework.h b/crlcore/src/ccore/crlcore/AllianceFramework.h index 89e927bc..7457be1e 100644 --- a/crlcore/src/ccore/crlcore/AllianceFramework.h +++ b/crlcore/src/ccore/crlcore/AllianceFramework.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // // =================================================================== // @@ -43,7 +43,8 @@ namespace CRL { class AllianceFramework { - + public: + enum InstancesCountFlags { Recursive=0x1, IgnoreFeeds=0x2 }; public: // Constructors. static AllianceFramework* create (); @@ -86,6 +87,7 @@ namespace CRL { void saveCell ( Cell* cell , unsigned int mode ); unsigned int loadLibraryCells ( Library* library ); unsigned int loadLibraryCells ( const Name& name ); + static size_t getInstancesCount ( Cell* cell, unsigned int flags ); // Internals - Attributes. protected: diff --git a/crlcore/src/ccore/crlcore/Measures.h b/crlcore/src/ccore/crlcore/Measures.h index 54ced7e6..bb052b23 100644 --- a/crlcore/src/ccore/crlcore/Measures.h +++ b/crlcore/src/ccore/crlcore/Measures.h @@ -61,7 +61,6 @@ namespace CRL { }; - BaseMeasure::~BaseMeasure () {} inline BaseMeasure::BaseMeasure ( const Name& name ) : _name(name) {} inline const Name& BaseMeasure::getName () const { return _name; } diff --git a/crlcore/src/ccore/properties/Measures.cpp b/crlcore/src/ccore/properties/Measures.cpp index d4d469ff..97d05ed2 100644 --- a/crlcore/src/ccore/properties/Measures.cpp +++ b/crlcore/src/ccore/properties/Measures.cpp @@ -42,6 +42,13 @@ namespace CRL { using Hurricane::Error; using Hurricane::ForEachIterator; + +// ------------------------------------------------------------------- +// Class : "CRL::MeasuresSet". + + + BaseMeasure::~BaseMeasure () {} + const char* MissingMeasures = "Measures::%s(): %s missing the Measures extension.";