Solve the template lookup problem in tstream.
* Bug: In Hurricane, in tstream (Commons.h), in the *template* overload of operator<<(), do not use the operator<<() of ostream as it will be looked up in "stage 1" (template definition) and so will miss all the overloads added later and built over getString<>(). Instead, make use of getString<>(), which, as another template will be looked up in "stage 2" (template instanciation) and at that point will have all the needed template specialisation of getString<>(). We also need to define new stream manipulators to be able to create a matching template overload not dependant from the implementation. To avoid name clashes, we prefix a 't'. For now, only 'tsetw()' is refined. As a side effect, we cannot directly print bit-fields into the stream, we must go through an intermediate variable (happens once in AutoContact).
This commit is contained in:
parent
c30811471d
commit
9808fb12b2
|
@ -324,7 +324,13 @@ namespace Anabatic {
|
|||
_dyMin = 0;
|
||||
_dxMax = (int)DbU::toLambda( _gcell->getXMax()-_gcell->getXMin() );
|
||||
_dyMax = (int)DbU::toLambda( _gcell->getYMax()-_gcell->getYMin() );
|
||||
cdebug_log(145,0) << "* deltas: [" << _dxMin << " " << _dyMin << " " << _dxMax << " " << _dyMax << "]" << endl;
|
||||
if (cdebug.enabled()) {
|
||||
int dxMin = _dxMin;
|
||||
int dyMin = _dyMin;
|
||||
int dxMax = _dxMax;
|
||||
int dyMax = _dyMax;
|
||||
cdebug_log(145,0) << "* deltas: [" << dxMin << " " << dyMin << " " << dxMax << " " << dyMax << "]" << endl;
|
||||
}
|
||||
} else {
|
||||
cerr << Bug( "NULL GCell for %s.", _getString().c_str() ) << endl;
|
||||
}
|
||||
|
|
|
@ -201,7 +201,8 @@ namespace Anabatic {
|
|||
if (source == _target)
|
||||
throw Error("Edge::_setSource(): Source & target are the same (%s).", getString(source).c_str() );
|
||||
|
||||
invalidate(); _source=source;
|
||||
_invalidate();
|
||||
_source=source;
|
||||
}
|
||||
|
||||
|
||||
|
@ -210,7 +211,15 @@ namespace Anabatic {
|
|||
if (_source == target)
|
||||
throw Error("Edge::_setTarget(): Source & target are the same (%s).", getString(target).c_str() );
|
||||
|
||||
invalidate(); _target=target;
|
||||
_invalidate();
|
||||
_target=target;
|
||||
}
|
||||
|
||||
|
||||
void Edge::_invalidate ()
|
||||
{
|
||||
_flags |= Flags::Invalidated;
|
||||
Super::invalidate( false );
|
||||
}
|
||||
|
||||
|
||||
|
@ -220,7 +229,6 @@ namespace Anabatic {
|
|||
_axis = side.getCenter();
|
||||
_capacity = getAnabatic()->getCapacity( side, _flags );
|
||||
|
||||
Super::invalidate( false );
|
||||
_flags.reset( Flags::Invalidated );
|
||||
cdebug_log(110,0) << "Edge::_revalidate() " << this << endl;
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ namespace Anabatic {
|
|||
: Super(anabatic->getCell())
|
||||
, _observable ()
|
||||
, _anabatic (anabatic)
|
||||
, _flags (Flags::Invalidated)
|
||||
, _flags (Flags::ChannelGCell|Flags::Invalidated)
|
||||
, _westEdges ()
|
||||
, _eastEdges ()
|
||||
, _southEdges ()
|
||||
|
@ -711,9 +711,13 @@ namespace Anabatic {
|
|||
column = column->vcut( xcut );
|
||||
}
|
||||
|
||||
setType( Flags::MatrixGCell );
|
||||
|
||||
size_t hLocal = - getAnabatic()->getConfiguration()->getHEdgeLocal();
|
||||
size_t vLocal = - getAnabatic()->getConfiguration()->getVEdgeLocal();
|
||||
for ( ; ibegin < gcells.size() ; ++ibegin ) {
|
||||
gcells[ibegin]->setType( Flags::MatrixGCell );
|
||||
|
||||
for ( Edge* edge : gcells[ibegin]->getEdges(Flags::NorthSide|Flags::EastSide) ) {
|
||||
if (edge->isHorizontal()) edge->incCapacity( hLocal );
|
||||
else edge->incCapacity( vLocal );
|
||||
|
@ -1445,7 +1449,6 @@ namespace Anabatic {
|
|||
getRoutingPads( rps );
|
||||
|
||||
set<Net*> rpNets;
|
||||
set<RoutingPad*>::iterator irp = rps.begin();
|
||||
for ( RoutingPad* rp : rps ) {
|
||||
if (rp->getLayer() != Session::getRoutingLayer(0)) continue;
|
||||
rpNets.insert( rp->getNet() );
|
||||
|
|
|
@ -52,6 +52,7 @@ namespace Anabatic {
|
|||
static const unsigned int AllSides = WestSide|EastSide|SouthSide|NorthSide ;
|
||||
static const unsigned int DirectionMask = Horizontal|Vertical;
|
||||
static const unsigned int DestroyMask = DestroyGCell|DestroyBaseContact|DestroyBaseSegment;
|
||||
static const unsigned int GCellTypeMask = DeviceGCell|ChannelGCell|StrutGCell|MatrixGCell|IoPadGCell;
|
||||
// Flags for functions arguments only.
|
||||
static const unsigned int AboveLayer = (1 << 5);
|
||||
static const unsigned int BelowLayer = (1 << 6);
|
||||
|
|
|
@ -239,7 +239,7 @@ namespace Anabatic {
|
|||
cdebug_log(112,1) << "PriorityQueue::dump() size:" << size() << std::endl;
|
||||
size_t order = 0;
|
||||
for ( Vertex* v : _queue )
|
||||
cdebug_log(112,0) << "[" << std::setw(3) << order++ << "] " << v << std::endl;
|
||||
cdebug_log(112,0) << "[" << tsetw(3) << order++ << "] " << v << std::endl;
|
||||
cdebug_tabw(112,-1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,11 +75,11 @@ namespace Anabatic {
|
|||
void destroySegment ();
|
||||
inline const Flags& flags () const;
|
||||
inline Flags& flags ();
|
||||
inline void invalidate ();
|
||||
inline void revalidate () const;
|
||||
void _setSource ( GCell* );
|
||||
void _setTarget ( GCell* );
|
||||
private:
|
||||
void _invalidate ();
|
||||
void _revalidate ();
|
||||
public:
|
||||
// ExtensionGo support.
|
||||
|
@ -127,7 +127,6 @@ namespace Anabatic {
|
|||
inline void Edge::setSegment ( Segment* s ) { _segment=s; }
|
||||
inline const Flags& Edge::flags () const { return _flags; }
|
||||
inline Flags& Edge::flags () { return _flags; }
|
||||
inline void Edge::invalidate () { _flags |= Flags::Invalidated; }
|
||||
inline void Edge::revalidate () const { /*if (_flags&Flags::Invalidated)*/ const_cast<Edge*>(this)->_revalidate(); }
|
||||
|
||||
|
||||
|
|
|
@ -141,6 +141,7 @@ namespace Anabatic {
|
|||
bool isSouth ( GCell* ) const;
|
||||
bool hasGContact ( const Contact* ) const;
|
||||
inline AnabaticEngine* getAnabatic () const;
|
||||
inline Flags getType () const;
|
||||
inline DbU::Unit getXMin () const;
|
||||
inline DbU::Unit getYMin () const;
|
||||
inline DbU::Unit getXMax ( int shrink=0 ) const;
|
||||
|
@ -200,6 +201,7 @@ namespace Anabatic {
|
|||
inline const Key& getKey () const;
|
||||
size_t checkDensity () const;
|
||||
bool checkEdgeSaturation ( size_t hreserved, size_t vreserved) const;
|
||||
void setType ( Flags );
|
||||
void addBlockage ( size_t depth, DbU::Unit );
|
||||
inline void addHSegment ( AutoSegment* );
|
||||
inline void addVSegment ( AutoSegment* );
|
||||
|
@ -289,6 +291,7 @@ namespace Anabatic {
|
|||
inline bool GCell::isIoPad () const { return _flags & Flags::IoPadGCell; }
|
||||
inline bool GCell::isSaturated () const { return _flags & Flags::Saturated; }
|
||||
inline bool GCell::isInvalidated () const { return _flags & Flags::Invalidated; }
|
||||
inline Flags GCell::getType () const { return _flags & Flags::GCellTypeMask; }
|
||||
inline AnabaticEngine* GCell::getAnabatic () const { return _anabatic; }
|
||||
inline DbU::Unit GCell::getXMin () const { return _xmin; }
|
||||
inline DbU::Unit GCell::getYMin () const { return _ymin; }
|
||||
|
@ -308,6 +311,7 @@ namespace Anabatic {
|
|||
inline const vector<AutoSegment*>& GCell::getHSegments () const { return _hsegments; }
|
||||
inline const vector<AutoContact*>& GCell::getContacts () const { return _contacts; }
|
||||
inline const GCell::Key& GCell::getKey () const { return _key; }
|
||||
inline void GCell::setType ( Flags type ) { _flags.reset(Flags::GCellTypeMask); _flags |= (type&Flags::GCellTypeMask); };
|
||||
inline void GCell::updateKey ( size_t depth ) { _key.update(depth); }
|
||||
inline const Flags& GCell::flags () const { return _flags; }
|
||||
inline Flags& GCell::flags () { return _flags; }
|
||||
|
|
|
@ -49,18 +49,19 @@ namespace Anabatic {
|
|||
static inline Matrix::Index asMin ( Matrix*, Point position );
|
||||
static inline Matrix::Index asMax ( Matrix*, Point position );
|
||||
public:
|
||||
inline Index ( Matrix*, int index );
|
||||
inline Index ( Matrix*, int i, int j );
|
||||
inline Matrix* matrix () const;
|
||||
inline const int& index () const;
|
||||
inline int& index ();
|
||||
inline bool valid () const;
|
||||
inline int i () const;
|
||||
inline int j () const;
|
||||
inline Index& west ();
|
||||
inline Index& east ();
|
||||
inline Index& south ();
|
||||
inline Index& north ();
|
||||
inline Index ( Matrix*, int index );
|
||||
inline Index ( Matrix*, int i, int j );
|
||||
inline Matrix* matrix () const;
|
||||
inline const int& index () const;
|
||||
inline int& index ();
|
||||
inline bool valid () const;
|
||||
inline int i () const;
|
||||
inline int j () const;
|
||||
inline Index& west ();
|
||||
inline Index& east ();
|
||||
inline Index& south ();
|
||||
inline Index& north ();
|
||||
inline string _getString () const;
|
||||
private:
|
||||
Matrix* _matrix;
|
||||
int _index;
|
||||
|
@ -205,11 +206,6 @@ namespace Anabatic {
|
|||
inline Point Matrix::getGridPoint ( const Index& index ) const
|
||||
{ return getGridPoint( index.i(), index.j() ); }
|
||||
|
||||
// Matrix::Index inline functions.
|
||||
|
||||
inline Matrix::Index::Index ( Matrix* m, int index ) : _matrix(m), _index(index) { }
|
||||
inline Matrix::Index::Index ( Matrix* m, int i, int j ) : _matrix(m), _index(m->ij2index(i,j)) { }
|
||||
|
||||
inline Matrix::Index Matrix::Index::asMin ( Matrix* m, DbU::Unit x, DbU::Unit y ) { return Index( m, m->xy2minIndex(x,y) ); }
|
||||
inline Matrix::Index Matrix::Index::asMin ( Matrix* m, Point position ) { return Index( m, m->xy2minIndex(position) ); }
|
||||
inline Matrix::Index Matrix::Index::asMax ( Matrix* m, DbU::Unit x, DbU::Unit y ) { return Index( m, m->xy2maxIndex(x,y) ); }
|
||||
|
@ -226,16 +222,21 @@ namespace Anabatic {
|
|||
inline Matrix::Index& Matrix::Index::north () { return _matrix->north (*this); }
|
||||
|
||||
|
||||
// Matrix::Index inline functions.
|
||||
inline Matrix::Index::Index ( Matrix* m, int index ) : _matrix(m), _index(index) { }
|
||||
inline Matrix::Index::Index ( Matrix* m, int i, int j ) : _matrix(m), _index(m->ij2index(i,j)) { }
|
||||
|
||||
inline string Matrix::Index::_getString () const
|
||||
{ return "(" + getString(index()) + "|" + getString(i()) + "," + getString(j()) + ")"; }
|
||||
|
||||
|
||||
} // Anabatic namespace.
|
||||
|
||||
|
||||
inline std::ostream& operator<< ( std::ostream& o, const Anabatic::Matrix::Index& index )
|
||||
{
|
||||
o << "(" << index.index() << "|" << index.i() << "," << index.j() << ")";
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
INSPECTOR_P_SUPPORT(Anabatic::Matrix);
|
||||
GETSTRING_POINTER_SUPPORT(Anabatic::Matrix::Index);
|
||||
GETSTRING_VALUE_SUPPORT(Anabatic::Matrix::Index);
|
||||
IOSTREAM_POINTER_SUPPORT(Anabatic::Matrix::Index);
|
||||
IOSTREAM_VALUE_SUPPORT(Anabatic::Matrix::Index);
|
||||
|
||||
#endif // ANABATIC_MATRIX_H
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include <stack>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
|
@ -166,6 +167,38 @@ template<typename Data> inline std::string getString ( Data data )
|
|||
+ Hurricane::demangle(typeid(data).name())
|
||||
+ std::string(" unsupported by getString()>"); }
|
||||
|
||||
// "const &" flavors.
|
||||
|
||||
template<> inline std::string getString<const bool> ( const bool b )
|
||||
{ return (b)?"True":"False" ; }
|
||||
|
||||
template<> inline std::string getString<const int> ( const int i )
|
||||
{ std::ostringstream os (""); os << i; return os.str(); }
|
||||
|
||||
template<> inline std::string getString<const long> ( const long l )
|
||||
{ std::ostringstream os (""); os << l; return os.str(); }
|
||||
|
||||
template<> inline std::string getString<const unsigned int> ( const unsigned int u )
|
||||
{ std::ostringstream os (""); os << u; return os.str(); }
|
||||
|
||||
template<> inline std::string getString<const unsigned long> ( const unsigned long ul )
|
||||
{ std::ostringstream os (""); os << ul; return os.str(); }
|
||||
|
||||
template<> inline std::string getString<const unsigned long long> ( const unsigned long long ull )
|
||||
{ std::ostringstream os (""); os << ull; return os.str(); }
|
||||
|
||||
template<> inline std::string getString<const unsigned short int> ( const unsigned short int us )
|
||||
{ std::ostringstream os (""); os << us; return os.str(); }
|
||||
|
||||
template<> inline std::string getString<const float> ( const float f )
|
||||
{ std::ostringstream os (""); os << f; return os.str(); }
|
||||
|
||||
template<> inline std::string getString<const double> ( const double d )
|
||||
{ std::ostringstream os; os << d; return os.str(); }
|
||||
|
||||
template<> inline std::string getString<const std::string> ( const std::string s )
|
||||
{ return s; }
|
||||
|
||||
// "const *" flavors.
|
||||
|
||||
template<> inline std::string getString<const bool*> ( const bool* b )
|
||||
|
@ -627,7 +660,11 @@ inline Hurricane::Record* getRecord ( const std::multiset<Element,Compare>* s )
|
|||
{ \
|
||||
if (!d) return o << "NULL [const " #Data "]"; \
|
||||
return o << "&" << getString<const Data*>(d); \
|
||||
}
|
||||
} \
|
||||
|
||||
|
||||
//inline tstream& operator<< ( tstream& o, Data* d ) \
|
||||
//{ if (o.enabled()) static_cast<std::ostream&>(o) << d; return o; }
|
||||
|
||||
|
||||
# define GETRECORD_POINTER_SUPPORT(Data) \
|
||||
|
@ -651,7 +688,11 @@ inline Hurricane::Record* getRecord ( const std::multiset<Element,Compare>* s )
|
|||
{ return o << getString<Data&>(d); } \
|
||||
\
|
||||
inline std::ostream& operator<< ( std::ostream& o, const Data& d ) \
|
||||
{ return o << getString<Data&>(d); }
|
||||
{ return o << getString<const Data&>(d); } \
|
||||
\
|
||||
|
||||
// inline tstream& operator<< ( tstream& o, Data& d ) \
|
||||
//{ if (o.enabled()) static_cast<std::ostream&>(o) << d; return o; }
|
||||
|
||||
|
||||
# define GETRECORD_REFERENCE_SUPPORT(Data) \
|
||||
|
@ -734,19 +775,14 @@ class tstream : public std::ostream {
|
|||
inline tstream& log ( int level, int count=0 );
|
||||
inline tstream& tabw ( int level, int count );
|
||||
inline tstream ( std::ostream & );
|
||||
inline tstream& put ( char c );
|
||||
inline tstream& flush ();
|
||||
private:
|
||||
inline tstream& _tab ();
|
||||
inline tstream& _tabw ( int count );
|
||||
public:
|
||||
// Overload for formatted outputs.
|
||||
//template<typename T> inline tstream& operator<< ( T t );
|
||||
template<typename T> inline tstream& operator<< ( T* t );
|
||||
template<typename T> inline tstream& operator<< ( const T t );
|
||||
template<typename T> inline tstream& operator<< ( const T* t );
|
||||
inline tstream& put ( char c );
|
||||
inline tstream& flush ();
|
||||
// Overload for manipulators.
|
||||
inline tstream &operator<< ( std::ostream &(*pf)(std::ostream &) );
|
||||
inline tstream& operator<< ( std::ostream &(*pf)(std::ostream &) );
|
||||
private:
|
||||
int _minLevel;
|
||||
int _maxLevel;
|
||||
|
@ -790,27 +826,37 @@ inline tstream& tstream::_tabw ( int count )
|
|||
inline tstream& tstream::log ( int level, int count )
|
||||
{ setLevel(level); _tab(); return _tabw(count); }
|
||||
|
||||
// For POD Types.
|
||||
// template<typename T>
|
||||
// inline tstream& tstream::operator<< ( T& t )
|
||||
// { if (enabled()) { *(static_cast<std::ostream*>(this)) << t; } return *this; };
|
||||
|
||||
template<typename T>
|
||||
inline tstream& tstream::operator<< ( T* t )
|
||||
{ if (enabled()) { *(static_cast<std::ostream*>(this)) << t; } return *this; };
|
||||
|
||||
template<typename T>
|
||||
inline tstream& tstream::operator<< ( const T t )
|
||||
{ if (enabled()) { *(static_cast<std::ostream*>(this)) << t; } return *this; };
|
||||
|
||||
template<typename T>
|
||||
inline tstream& tstream::operator<< ( const T* t )
|
||||
{ if (enabled()) { *(static_cast<std::ostream*>(this)) << t; } return *this; };
|
||||
|
||||
// For STL Types.
|
||||
inline tstream& operator<< ( tstream& o, const std::string& s )
|
||||
inline tstream& operator<< ( tstream& o, const std::string s )
|
||||
{ if (o.enabled()) { static_cast<std::ostream&>(o) << s; } return o; };
|
||||
|
||||
// For POD Types.
|
||||
// template<typename T>
|
||||
// inline tstream& operator<< ( tstream& o, T& t )
|
||||
// { if (o.enabled()) { static_cast<std::ostream&>(o) << getString<T&>(t); } return o; };
|
||||
|
||||
template<typename T>
|
||||
inline tstream& operator<< ( tstream& o, T* t )
|
||||
{ if (o.enabled()) { static_cast<std::ostream&>(o) << getString<T*>(t); } return o; };
|
||||
|
||||
// template<typename T>
|
||||
// inline tstream& operator<< ( tstream& o, const T& t )
|
||||
// { if (o.enabled()) { static_cast<std::ostream&>(o) << getString<const T&>(t); } return o; };
|
||||
|
||||
template<typename T>
|
||||
inline tstream& operator<< ( tstream& o, T t )
|
||||
{ if (o.enabled()) { static_cast<std::ostream&>(o) << getString<T>(t); } return o; };
|
||||
|
||||
template<typename T>
|
||||
inline tstream& operator<< ( tstream& o, const T* t )
|
||||
{ if (o.enabled()) { static_cast<std::ostream&>(o) << getString<const T*>(t); } return o; };
|
||||
|
||||
struct _Tsetw { int n_; };
|
||||
inline _Tsetw tsetw ( int n ) { return { n }; }
|
||||
|
||||
template<>
|
||||
inline tstream& operator<< ( tstream& o, _Tsetw manip )
|
||||
{ if (o.enabled()) { static_cast<std::ostream&>(o) << std::setw(manip.n_); } return o; }
|
||||
|
||||
extern tstream cdebug;
|
||||
|
||||
|
|
|
@ -166,4 +166,6 @@ namespace Hurricane {
|
|||
|
||||
} // Hurricane namespace.
|
||||
|
||||
INSPECTOR_PV_SUPPORT(Hurricane::BaseFlags);
|
||||
|
||||
# endif // HURRICANE_BASE_FLAGS_H
|
||||
|
|
|
@ -285,7 +285,7 @@ namespace Hurricane {
|
|||
template<typename T> inline void JsonStack::push_back ( const std::string& key, T t )
|
||||
{
|
||||
cdebug_log(19,0) << "JsonStack::push_back(T) key:" << key << " value:" << t
|
||||
<< " (" << demangle(typeid(T)) << ")." << endl;
|
||||
<< " (" << demangle(typeid(T)) << ")." << endl;
|
||||
_stack.push_back(std::make_pair(key,boost::any(t)));
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2015-2016, 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
|
||||
// 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 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
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | 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 : "./hurricane/TStream.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef HURRICANE_TSTREAM_H
|
||||
#define HURRICANE_TSTREAM_H
|
||||
|
||||
#include "hurricane/Tabulation.h"
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "::cdebug()".
|
||||
//
|
||||
// Wrapper around the STL ostream which to print debugging messages.
|
||||
|
||||
class tstream : public std::ostream {
|
||||
public:
|
||||
inline int getMinLevel () const;
|
||||
inline int getMaxLevel () const;
|
||||
inline int setMinLevel ( int );
|
||||
inline int setMaxLevel ( int );
|
||||
inline int getLevel () const;
|
||||
inline int setLevel ( int );
|
||||
inline bool enabled () const;
|
||||
inline bool enabled ( int ) const;
|
||||
inline tstream& log ( int level, int count=0 );
|
||||
inline tstream& tabw ( int level, int count );
|
||||
inline tstream ( std::ostream & );
|
||||
private:
|
||||
inline tstream& _tab ();
|
||||
inline tstream& _tabw ( int count );
|
||||
public:
|
||||
// Overload for formatted outputs.
|
||||
//template<typename T> inline tstream& operator<< ( T t );
|
||||
template<typename T> inline tstream& operator<< ( T* t );
|
||||
template<typename T> inline tstream& operator<< ( const T t );
|
||||
template<typename T> inline tstream& operator<< ( const T* t );
|
||||
inline tstream& put ( char c );
|
||||
inline tstream& flush ();
|
||||
// Overload for manipulators.
|
||||
inline tstream &operator<< ( std::ostream &(*pf)(std::ostream &) );
|
||||
private:
|
||||
int _minLevel;
|
||||
int _maxLevel;
|
||||
int _level;
|
||||
Hurricane::Tabulation _tabulation;
|
||||
};
|
||||
|
||||
|
||||
inline tstream::tstream ( std::ostream& s )
|
||||
: std::ostream(s.rdbuf())
|
||||
, _minLevel(0)
|
||||
, _maxLevel(0)
|
||||
, _level(0)
|
||||
, _tabulation(" ")
|
||||
{ }
|
||||
|
||||
inline int tstream::getMinLevel () const { return _minLevel; }
|
||||
inline int tstream::getMaxLevel () const { return _maxLevel; }
|
||||
inline int tstream::setMinLevel ( int l ) { int pl=_minLevel; _minLevel=l; return pl; }
|
||||
inline int tstream::setMaxLevel ( int l ) { int pl=_maxLevel; _maxLevel=l; return pl; }
|
||||
inline int tstream::getLevel () const { return _level; }
|
||||
inline int tstream::setLevel ( int l ) { int pl=_level; _level=l; return pl; }
|
||||
inline bool tstream::enabled () const { return (_level >= _minLevel) and (_level < _maxLevel); }
|
||||
inline bool tstream::enabled ( int l ) const { return (l >= _minLevel) and (l < _maxLevel); }
|
||||
inline tstream& tstream::tabw ( int level, int count ) { setLevel(level); return _tabw(count); }
|
||||
inline tstream& tstream::put ( char c ) { if (enabled()) static_cast<std::ostream*>(this)->put(c); return *this; }
|
||||
inline tstream& tstream::flush () { if (enabled()) static_cast<std::ostream*>(this)->flush(); return *this; }
|
||||
inline tstream& tstream::operator<< ( std::ostream& (*pf)(std::ostream&) ) { if (enabled()) (*pf)(*this); return *this; }
|
||||
|
||||
|
||||
inline tstream& tstream::_tab () { if (enabled()) (*this) << _tabulation; return *this; }
|
||||
inline tstream& tstream::_tabw ( int count )
|
||||
{
|
||||
if (enabled()) {
|
||||
if (count > 0) while(count--) _tabulation++;
|
||||
else if (count < 0) while(count++) _tabulation--;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline tstream& tstream::log ( int level, int count )
|
||||
{ setLevel(level); _tab(); return _tabw(count); }
|
||||
|
||||
// For POD Types.
|
||||
// template<typename T>
|
||||
// inline tstream& tstream::operator<< ( T& t )
|
||||
// { if (enabled()) { *(static_cast<std::ostream*>(this)) << t; } return *this; };
|
||||
|
||||
template<typename T>
|
||||
inline tstream& tstream::operator<< ( T* t )
|
||||
{ if (enabled()) { *(static_cast<std::ostream*>(this)) << t; } return *this; };
|
||||
|
||||
template<typename T>
|
||||
inline tstream& tstream::operator<< ( const T t )
|
||||
{ if (enabled()) { *(static_cast<std::ostream*>(this)) << t; } return *this; };
|
||||
|
||||
template<typename T>
|
||||
inline tstream& tstream::operator<< ( const T* t )
|
||||
{ if (enabled()) { *(static_cast<std::ostream*>(this)) << t; } return *this; };
|
||||
|
||||
// For STL Types.
|
||||
inline tstream& operator<< ( tstream& o, const std::string& s )
|
||||
{ if (o.enabled()) { static_cast<std::ostream&>(o) << s; } return o; };
|
||||
|
||||
|
||||
extern tstream cdebug;
|
||||
|
||||
|
||||
#define cdebug_log(level,indent) if (cdebug.enabled(level)) cdebug.log(level,indent)
|
||||
#define cdebug_tabw(level,indent) cdebug.tabw(level,indent)
|
||||
|
||||
#endif // HURRICANE_TSTREAM_H
|
|
@ -325,7 +325,11 @@ namespace Katabatic {
|
|||
_dyMin = 0;
|
||||
_dxMax = (int)DbU::toLambda( _gcell->getXMax()-_gcell->getX() );
|
||||
_dyMax = (int)DbU::toLambda( _gcell->getYMax()-_gcell->getY() );
|
||||
cdebug_log(145,0) << "* deltas: [" << _dxMin << " " << _dyMin << " " << _dxMax << " " << _dyMax << "]" << endl;
|
||||
cdebug_log(145,0) << "* deltas: [" << (int)_dxMin
|
||||
<< " " << (int)_dyMin
|
||||
<< " " << (int)_dxMax
|
||||
<< " " << (int)_dyMax
|
||||
<< "]" << endl;
|
||||
} else {
|
||||
cerr << Bug( "NULL GCell for %s.", _getString().c_str() ) << endl;
|
||||
}
|
||||
|
|
|
@ -828,12 +828,12 @@ namespace {
|
|||
|
||||
forEach ( Hook*, hook, fromHook->getHooks() ) {
|
||||
cdebug_log(145,0) << "Topology [" << _connexity.connexity << "] = "
|
||||
<< "[" << _connexity.fields.globals
|
||||
<< "+" << _connexity.fields.M1
|
||||
<< "+" << _connexity.fields.M2
|
||||
<< "+" << _connexity.fields.M3
|
||||
<< "+" << _connexity.fields.Pin
|
||||
<< "+" << _connexity.fields.Pad
|
||||
<< "[" << (int)_connexity.fields.globals
|
||||
<< "+" << (int)_connexity.fields.M1
|
||||
<< "+" << (int)_connexity.fields.M2
|
||||
<< "+" << (int)_connexity.fields.M3
|
||||
<< "+" << (int)_connexity.fields.Pin
|
||||
<< "+" << (int)_connexity.fields.Pad
|
||||
<< "] " << _gcell
|
||||
<< endl;
|
||||
|
||||
|
@ -1447,7 +1447,7 @@ namespace {
|
|||
void GCellTopology::_do_xG_1Pad ()
|
||||
{
|
||||
cdebug_log(145,1) << "_do_xG_1Pad() [Managed Configuration - Optimized] " << _topology << endl;
|
||||
cdebug_log(145,0) << "_connexity.globals:" << _connexity.fields.globals << endl;
|
||||
cdebug_log(145,0) << "_connexity.globals:" << (int)_connexity.fields.globals << endl;
|
||||
|
||||
unsigned int flags = NoFlags;
|
||||
bool eastPad = false;
|
||||
|
@ -1585,7 +1585,7 @@ namespace {
|
|||
|
||||
void GCellTopology::_do_1G_xM1 ()
|
||||
{
|
||||
cdebug_log(145,1) << "_do_1G_" << _connexity.fields.M1 << "M1() [Managed Configuration]" << endl;
|
||||
cdebug_log(145,1) << "_do_1G_" << (int)_connexity.fields.M1 << "M1() [Managed Configuration]" << endl;
|
||||
|
||||
sort( _routingPads.begin(), _routingPads.end(), SortRpByX(NoFlags) ); // increasing X.
|
||||
for ( unsigned int i=1 ; i<_routingPads.size() ; ++i ) {
|
||||
|
@ -1687,9 +1687,9 @@ namespace {
|
|||
|
||||
void GCellTopology::_do_xG_xM1_xM3 ()
|
||||
{
|
||||
cdebug_log(145,1) << "_do_xG_" << _connexity.fields.M1
|
||||
<< "M1_" << _connexity.fields.M3
|
||||
<< "M3() [G:" << _connexity.fields.globals << " Managed Configuration]" << endl;
|
||||
cdebug_log(145,1) << "_do_xG_" << (int)_connexity.fields.M1
|
||||
<< "M1_" << (int)_connexity.fields.M3
|
||||
<< "M3() [G:" << (int)_connexity.fields.globals << " Managed Configuration]" << endl;
|
||||
cdebug_log(145,0) << "_connexity: " << _connexity.connexity << endl;
|
||||
cdebug_log(145,0) << "_north: " << _north << endl;
|
||||
cdebug_log(145,0) << "_south: " << _south << endl;
|
||||
|
@ -1814,8 +1814,8 @@ namespace {
|
|||
void GCellTopology::_do_xG_xM2 ()
|
||||
{
|
||||
cdebug_log(145,1) << "_do_"
|
||||
<< _connexity.fields.globals << "G_"
|
||||
<< _connexity.fields.M2 << "M2() [Managed Configuration - x]" << endl;
|
||||
<< (int)_connexity.fields.globals << "G_"
|
||||
<< (int)_connexity.fields.M2 << "M2() [Managed Configuration - x]" << endl;
|
||||
|
||||
Component* biggestRp = _routingPads[0];
|
||||
for ( unsigned int i=1 ; i<_routingPads.size() ; ++i ) {
|
||||
|
@ -1895,7 +1895,7 @@ namespace {
|
|||
|
||||
void GCellTopology::_do_xG_xM3 ()
|
||||
{
|
||||
cdebug_log(145,1) << "_do_xG_" << _connexity.fields.M3
|
||||
cdebug_log(145,1) << "_do_xG_" << (int)_connexity.fields.M3
|
||||
<< "M3() [Managed Configuration]" << endl;
|
||||
cdebug_log(145,0) << "_west:" << _west << endl;
|
||||
cdebug_log(145,0) << "_east:" << _east << endl;
|
||||
|
|
|
@ -659,7 +659,7 @@ namespace Kite {
|
|||
= (DbU::toLambda(_segment->getLength()) + 1.0)
|
||||
* (DbU::toLambda(_segment->base()->getSlack()) + 1.0);
|
||||
|
||||
cdebug_log(159,0) << _segment << " has " << _tracksNb << " choices " << perpandicular << endl;
|
||||
cdebug_log(159,0) << _segment << " has " << (int)_tracksNb << " choices " << perpandicular << endl;
|
||||
cdebug_tabw(159,-1);
|
||||
|
||||
DebugSession::close();
|
||||
|
|
Loading…
Reference in New Issue