diff --git a/hurricane/src/hurricane/SharedPath.cpp b/hurricane/src/hurricane/SharedPath.cpp index 12dc8b31..f1aad421 100644 --- a/hurricane/src/hurricane/SharedPath.cpp +++ b/hurricane/src/hurricane/SharedPath.cpp @@ -102,10 +102,11 @@ static char NAME_SEPARATOR = '.'; SharedPath::SharedPath(Instance* headInstance, SharedPath* tailSharedPath) // *********************************************************************** - : _headInstance(headInstance), - _tailSharedPath(tailSharedPath), - _quarkMap(), - _nextOfInstanceSharedPathMap(NULL) + : _hash(0) + , _headInstance(headInstance) + , _tailSharedPath(tailSharedPath) + , _quarkMap() + , _nextOfInstanceSharedPathMap(NULL) { if (!_headInstance) throw Error("Can't create " + _TName("SharedPath") + " : null head instance"); @@ -126,6 +127,7 @@ SharedPath::SharedPath(Instance* headInstance, SharedPath* tailSharedPath) , getString(_tailSharedPath->getOwnerCell ()).c_str() ); + _hash = (_headInstance->getId() << 1) + ((_tailSharedPath) ? _tailSharedPath->getHash() << 1: 0); _headInstance->_getSharedPathMap()._insert(this); cdebug_log(0,0) << "SharedPath::SharedPath() pathHash:" << getHash() << " \"" << this << "\"" << endl; @@ -187,7 +189,8 @@ string SharedPath::getName() const unsigned long SharedPath::getHash() const // *************************************** -{ return (_headInstance->getId() << 1) + ((_tailSharedPath) ? _tailSharedPath->getHash() << 1: 0); } +//{ return (_headInstance->getId() << 1) + ((_tailSharedPath) ? _tailSharedPath->getHash() << 1: 0); } +{ return _hash; } string SharedPath::getJsonString(unsigned long flags) const // ******************************************************** @@ -245,6 +248,10 @@ void SharedPath::setNameSeparator(char nameSeparator) NAME_SEPARATOR = nameSeparator; } +std::string SharedPath::_getTypeName () const +// ****************************************** +{ return _TName("SharedPath"); } + string SharedPath::_getString() const // ********************************** { diff --git a/hurricane/src/hurricane/hurricane/SharedPath.h b/hurricane/src/hurricane/hurricane/SharedPath.h index 4e799bf8..3be0dd79 100644 --- a/hurricane/src/hurricane/hurricane/SharedPath.h +++ b/hurricane/src/hurricane/hurricane/SharedPath.h @@ -1,25 +1,35 @@ -// **************************************************************************************************** -// File: ./hurricane/SharedPath.h -// Authors: R. Escassut +// -*- C++ -*- +// // Copyright (c) BULL S.A. 2000-2018, All Rights Reserved // // This file is part of Hurricane. // -// Hurricane is free software: you can redistribute it and/or modify it under the terms of the GNU -// Lesser General Public License as published by the Free Software Foundation, either version 3 of the +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // -// Hurricane 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 Lesser GNU +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU // General Public License for more details. // -// You should have received a copy of the Lesser GNU General Public License along with Hurricane. If -// not, see . -// **************************************************************************************************** +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | 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 | +// | | +// | Authors : Remy Escassut | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./hurricane/RoutingPad.h" | +// +-----------------------------------------------------------------+ -#ifndef HURRICANE_SHARED_PATH -#define HURRICANE_SHARED_PATH +#pragma once #include "hurricane/Instances.h" #include "hurricane/SharedPathes.h" #include "hurricane/Quark.h" @@ -28,112 +38,77 @@ namespace Hurricane { -class Cell; -class Entity; + class Cell; + class Entity; +// ------------------------------------------------------------------- +// Class : "SharedPath". -// **************************************************************************************************** -// SharedPath declaration -// **************************************************************************************************** - -class SharedPath { -// ************* - -// Types -// ***** - - public: class QuarkMap : public IntrusiveMap { - // *************************************************************** - - public: typedef IntrusiveMap Inherit; - - public: QuarkMap(); - - public: virtual const Entity* _getKey(Quark* quark) const; - public: virtual unsigned _getHashValue(const Entity* entity) const; - public: virtual Quark* _getNextElement(Quark* quark) const; - public: virtual void _setNextElement(Quark* quark, Quark* nextQuark) const; + class SharedPath { + public: + class QuarkMap : public IntrusiveMap { + public: + typedef IntrusiveMap Inherit; + public: + QuarkMap (); + virtual const Entity* _getKey ( Quark* ) const; + virtual unsigned _getHashValue ( const Entity* ) const; + virtual Quark* _getNextElement ( Quark* ) const; + virtual void _setNextElement ( Quark* , Quark* nextQuark ) const; }; -// Attributes -// ********** + public: + SharedPath ( Instance* headInstance, SharedPath* tailSharedPath = NULL ); + ~SharedPath (); + private: + SharedPath ( const SharedPath& ) = delete; + SharedPath& operator= ( const SharedPath& ) = delete; + public: + static char getNameSeparator (); + static void setNameSeparator ( char nameSeparator ); + public: + unsigned long getHash () const; + inline Instance* getHeadInstance () const; + inline SharedPath* getTailSharedPath () const; + SharedPath* getHeadSharedPath () const; + Instance* getTailInstance () const; + std::string getName () const; + std::string getJsonString ( unsigned long flags ) const; + Cell* getOwnerCell () const; + Cell* getMasterCell () const; + Instances getInstances () const; + Transformation getTransformation ( const Transformation& transformation=Transformation() ) const; + public: + std::string _getTypeName () const; + std::string _getString () const; + Record* _getRecord () const; + inline Quark* _getQuark (const Entity* entity ) const; + inline Quarks _getQuarks () const; + inline QuarkMap& _getQuarkMap (); + inline SharedPath* _getNextOfInstanceSharedPathMap () const; + inline void _setNextOfInstanceSharedPathMap ( SharedPath* sharedPath ); + private: + // Attributes. + unsigned long _hash; + Instance* _headInstance; + SharedPath* _tailSharedPath; + QuarkMap _quarkMap; + SharedPath* _nextOfInstanceSharedPathMap; + }; - private: Instance* _headInstance; - private: SharedPath* _tailSharedPath; - private: QuarkMap _quarkMap; - private: SharedPath* _nextOfInstanceSharedPathMap; - -// Constructors -// ************ - - public: SharedPath(Instance* headInstance, SharedPath* tailSharedPath = NULL); - - private: SharedPath(const SharedPath& sharedPath); - // not implemented to forbid copy construction - -// Destructor -// ********** - - public: ~SharedPath(); - -// Operators -// ********* - - private: SharedPath& operator=(const SharedPath& sharedPath); - // not implemented to forbid assignment - -// Accessors -// ********* - - public: static char getNameSeparator(); - - public: unsigned long getHash() const; - public: Instance* getHeadInstance() const {return _headInstance;}; - public: SharedPath* getTailSharedPath() const {return _tailSharedPath;}; - public: SharedPath* getHeadSharedPath() const; - public: Instance* getTailInstance() const; - public: string getName() const; - public: string getJsonString(unsigned long flags) const; - public: Cell* getOwnerCell() const; - public: Cell* getMasterCell() const; - public: Instances getInstances() const; - public: Transformation getTransformation(const Transformation& transformation = Transformation()) const; - -// Updators -// ******** - - public: static void setNameSeparator(char nameSeparator); - -// Accessors -// ********* - - public: string _getTypeName() const { return _TName("SharedPath"); }; - public: string _getString() const; - public: Record* _getRecord() const; - - public: Quark* _getQuark(const Entity* entity) const {return _quarkMap.getElement(entity);}; - public: Quarks _getQuarks() const {return _quarkMap.getElements();}; - public: QuarkMap& _getQuarkMap() {return _quarkMap;}; - public: SharedPath* _getNextOfInstanceSharedPathMap() const {return _nextOfInstanceSharedPathMap;}; - - public: void _setNextOfInstanceSharedPathMap(SharedPath* sharedPath) {_nextOfInstanceSharedPathMap = sharedPath;}; - -}; + + inline Instance* SharedPath::getHeadInstance () const { return _headInstance; } + inline SharedPath* SharedPath::getTailSharedPath () const { return _tailSharedPath; } + inline Quark* SharedPath::_getQuark (const Entity* entity ) const { return _quarkMap.getElement(entity); } + inline Quarks SharedPath::_getQuarks () const { return _quarkMap.getElements(); } + inline SharedPath::QuarkMap& SharedPath::_getQuarkMap () { return _quarkMap; } + inline SharedPath* SharedPath::_getNextOfInstanceSharedPathMap () const { return _nextOfInstanceSharedPathMap; } + inline void SharedPath::_setNextOfInstanceSharedPathMap ( SharedPath* sharedPath ) { _nextOfInstanceSharedPathMap = sharedPath; } - -} // End of Hurricane namespace. +} // Hurricane namespace. INSPECTOR_P_SUPPORT(Hurricane::SharedPath); - - - -#endif // HURRICANE_SHARED_PATH - - -// **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2018, All Rights Reserved -// ****************************************************************************************************