fixed build for gcc4, from eNigMa

tested also for gcc2.95


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18914 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2006-09-23 22:02:21 +00:00
parent 4205612012
commit 9f6275e0e4
26 changed files with 112 additions and 81 deletions
+1
View File
@@ -47,6 +47,7 @@ SharedLibrary libqoca.so :
QcSparseMatrix.cc
QcVarStow.cc
QcVariableBiMap.cc
QcUtility.cc
:
$(TARGET_LIBSTDC++)
;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef KeyIteratorHH
#define KeyIteratorHH
template <class Iterator, class Key>
template <class Iterator, typename Key>
class KeyIterator
: public Iterator
{
+10 -8
View File
@@ -3,12 +3,14 @@
#define QcBiMapDCL
#line 1 "QcBiMap.ch"
#include <iostream.h>
#include <map.h>
#include <vector.h>
#include <iostream>
#include <map>
#include <vector>
#include "qoca/QcDefines.hh"
#include "qoca/KeyIterator.hh"
using namespace std;
/** Bi-directional one-to-one mapping between identifier class and non-negative
integers.
@@ -24,7 +26,7 @@
template<class AKey>
template<typename AKey>
class QcBiMap
{
@@ -55,11 +57,11 @@ vAssertDeepInvar() const;
protected:
typedef map<AKey, int, less<AKey> > TIdentifierMap;
typedef vector<AKey> TIndexMap;
typedef std::map<AKey, int, less<AKey> > TIdentifierMap;
typedef std::vector<AKey> TIndexMap;
public:
typedef KeyIterator<TIdentifierMap::const_iterator, AKey> const_identifier_iterator;
typedef KeyIterator<typename TIdentifierMap::const_iterator, AKey> const_identifier_iterator;
//-----------------------------------------------------------------------//
@@ -117,7 +119,7 @@ Update(const AKey &ident, int index);
const_identifier_iterator
getIdentifiers_begin() const
{
TIdentifierMap::const_iterator i = fIdentifierMap.begin();
typename TIdentifierMap::const_iterator i = fIdentifierMap.begin();
return const_identifier_iterator (i);
}
+12 -12
View File
@@ -1,7 +1,7 @@
//begin o[d]
#include <iostream.h>
#include <map.h>
#include <vector.h>
#include <iostream>
#include <map>
#include <vector>
#include "qoca/QcDefines.hh"
#include "qoca/KeyIterator.hh"
//end o[d]
@@ -46,12 +46,12 @@ assertInvar() const
fIndexMap[ i].assertInvar();
if(fIndexMap[ i].isDead())
continue;
TIdentifierMap::const_iterator f = fIdentifierMap.find(fIndexMap[i]);
typename TIdentifierMap::const_iterator f = fIdentifierMap.find(fIndexMap[i]);
qcAssertInvar( f != fIdentifierMap.end());
qcAssertInvar( f->second == i);
}
for(TIdentifierMap::const_iterator ii = fIdentifierMap.begin(); ii != fIdentifierMap.end(); ii++)
for(typename TIdentifierMap::const_iterator ii = fIdentifierMap.begin(); ii != fIdentifierMap.end(); ii++)
{
unsigned ix = ii->second;
qcAssertInvar( ix < fIndexMap.size());
@@ -80,7 +80,7 @@ protected:
typedef vector<AKey> TIndexMap;
public:
typedef KeyIterator<TIdentifierMap::const_iterator, AKey> const_identifier_iterator;
typedef KeyIterator<typename TIdentifierMap::const_iterator, AKey> const_identifier_iterator;
//end o[d]
//-----------------------------------------------------------------------//
@@ -134,11 +134,11 @@ SwapByIndex(int i1, int i2)
fIndexMap[ i1] = ident2;
fIndexMap[ i2] = ident1;
QcBiMap<AKey>::TIdentifierMap::iterator it1 = fIdentifierMap.find( ident1);
typename QcBiMap<AKey>::TIdentifierMap::iterator it1 = fIdentifierMap.find( ident1);
qcAssertPost( it1 != fIdentifierMap.end());
it1->second = i2;
QcBiMap<AKey>::TIdentifierMap::iterator it2 = fIdentifierMap.find( ident2);
typename QcBiMap<AKey>::TIdentifierMap::iterator it2 = fIdentifierMap.find( ident2);
qcAssertPost( it2 != fIdentifierMap.end());
it2->second = i1;
}
@@ -191,13 +191,13 @@ Update(const AKey &ident, int index)
unsigned GetSize() const
{ return fIdentifierMap.size(); }
bool IdentifierPresent(AKey const &ident) const
bool IdentifierPresent(AKey const &ident) const
{ return (fIdentifierMap.find(ident) != fIdentifierMap.end()); }
const_identifier_iterator
getIdentifiers_begin() const
{
TIdentifierMap::const_iterator i = fIdentifierMap.begin();
typename TIdentifierMap::const_iterator i = fIdentifierMap.begin();
return const_identifier_iterator (i);
}
@@ -220,7 +220,7 @@ Identifier(int index)
inline AKey &
Identifier(char const *n)
{
QcBiMap<AKey>::TIdentifierMap::iterator iIt = fIdentifierMap.begin();
typename QcBiMap<AKey>::TIdentifierMap::iterator iIt = fIdentifierMap.begin();
while(iIt != fIdentifierMap.end())
{
@@ -243,7 +243,7 @@ Identifier(char const *n)
inline int
Index(AKey const &ident) const
{
QcBiMap<AKey>::TIdentifierMap::const_iterator iIt = fIdentifierMap.find( ident);
typename QcBiMap<AKey>::TIdentifierMap::const_iterator iIt = fIdentifierMap.find( ident);
qcAssertPre( iIt != fIdentifierMap.end());
unsigned ix = iIt->second;
qcAssertPost( (ix < fIndexMap.size())
+15 -11
View File
@@ -7,7 +7,11 @@
#line 21 "QcBiMap.ch"
#define TMPL template<class AKey>
#if __GNUC__ >= 4
#define TYPENAMEDEF typename
#else
#define TYPENAMEDEF
#endif
@@ -23,12 +27,12 @@ QcBiMap<AKey>::assertInvar() const
fIndexMap[ i].assertInvar();
if(fIndexMap[ i].isDead())
continue;
TIdentifierMap::const_iterator f = fIdentifierMap.find(fIndexMap[i]);
TYPENAMEDEF TIdentifierMap::const_iterator f = fIdentifierMap.find(fIndexMap[i]);
qcAssertInvar( f != fIdentifierMap.end());
qcAssertInvar( f->second == i);
}
for(TIdentifierMap::const_iterator ii = fIdentifierMap.begin(); ii != fIdentifierMap.end(); ii++)
for(TYPENAMEDEF TIdentifierMap::const_iterator ii = fIdentifierMap.begin(); ii != fIdentifierMap.end(); ii++)
{
unsigned ix = ii->second;
qcAssertInvar( ix < fIndexMap.size());
@@ -99,11 +103,11 @@ QcBiMap<AKey>::SwapByIndex(int i1, int i2)
fIndexMap[ i1] = ident2;
fIndexMap[ i2] = ident1;
QcBiMap<AKey>::TIdentifierMap::iterator it1 = fIdentifierMap.find( ident1);
TYPENAMEDEF QcBiMap<AKey>::TIdentifierMap::iterator it1 = fIdentifierMap.find( ident1);
qcAssertPost( it1 != fIdentifierMap.end());
it1->second = i2;
QcBiMap<AKey>::TIdentifierMap::iterator it2 = fIdentifierMap.find( ident2);
TYPENAMEDEF QcBiMap<AKey>::TIdentifierMap::iterator it2 = fIdentifierMap.find( ident2);
qcAssertPost( it2 != fIdentifierMap.end());
it2->second = i1;
}
@@ -127,8 +131,8 @@ QcBiMap<AKey>::Update(const AKey &ident, int index)
fIndexMap[ index] = ident;
// Insert ident->index mapping.
TIdentifierMap::value_type ins (ident, index);
typedef pair<TIdentifierMap::iterator, bool> insResultT;
TYPENAMEDEF TIdentifierMap::value_type ins (ident, index);
typedef pair<TYPENAMEDEF TIdentifierMap::iterator, bool> insResultT;
dbgPre(insResultT insResult =)
fIdentifierMap.insert (ins);
@@ -159,7 +163,7 @@ TMPL
inline AKey &
QcBiMap<AKey>::Identifier(char const *n)
{
QcBiMap<AKey>::TIdentifierMap::iterator iIt = fIdentifierMap.begin();
TYPENAMEDEF QcBiMap<AKey>::TIdentifierMap::iterator iIt = fIdentifierMap.begin();
while(iIt != fIdentifierMap.end())
{
@@ -179,7 +183,7 @@ TMPL
inline int
QcBiMap<AKey>::Index(AKey const &ident) const
{
QcBiMap<AKey>::TIdentifierMap::const_iterator iIt = fIdentifierMap.find( ident);
TYPENAMEDEF QcBiMap<AKey>::TIdentifierMap::const_iterator iIt = fIdentifierMap.find( ident);
qcAssertPre( iIt != fIdentifierMap.end());
unsigned ix = iIt->second;
qcAssertPost( (ix < fIndexMap.size())
@@ -194,7 +198,7 @@ TMPL
inline int
QcBiMap<AKey>::safeIndex(AKey const &ident) const
{
QcBiMap<AKey>::TIdentifierMap::const_iterator iIt = fIdentifierMap.find( ident);
TYPENAMEDEF QcBiMap<AKey>::TIdentifierMap::const_iterator iIt = fIdentifierMap.find( ident);
if(iIt == fIdentifierMap.end())
return -1;
int ix = iIt->second;
@@ -217,7 +221,7 @@ QcBiMap<AKey>::Print(ostream &os) const
os << i << " -> " << fIndexMap[i] << endl;
os << "Reverse Map:" << endl;
QcBiMap<AKey>::TIdentifierMap::const_iterator itF;
TYPENAMEDEF QcBiMap<AKey>::TIdentifierMap::const_iterator itF;
for (itF = fIdentifierMap.begin(); itF != fIdentifierMap.end(); ++itF)
os << (*itF).first << " -> " << (*itF).second << endl;
+3 -1
View File
@@ -27,10 +27,12 @@
#ifndef __QcCassSolverH
#define __QcCassSolverH
#include <map.h>
#include <map>
#include "qoca/QcDelLinInEqSystem.hh"
#include "qoca/QcCassConstraint.hh"
using namespace std;
class QcCassSolver : public QcDelLinInEqSystem
{
protected:
+2 -1
View File
@@ -173,7 +173,8 @@
)
#ifndef qcNoStream
# include <iostream.h>
# include <iostream>
using namespace std;
#endif
/* TODO: Maybe use autoconf to detect this. (OTOH, I imagine that
+1 -1
View File
@@ -24,7 +24,7 @@
// included with the above copyright notice. //
//============================================================================//
#include <math.h>
#include <cmath>
#include "qoca/QcDefines.hh"
#include "qoca/QcDelLinEqTableau.hh"
#ifdef qcDenseQuasiInverse
+1 -1
View File
@@ -31,7 +31,7 @@
#include "qoca/QcDefines.hh"
#ifndef qcNoStream
#include <iostream.h>
#include <iostream>
#endif
//#ifdef DEBUG
+15 -7
View File
@@ -1,7 +1,6 @@
// Generated automatically from QcIneqSolverBase.ch by /home/pmoulder/usr/local/bin/ch2xx.
#ifndef QcIneqSolverBaseDCL
#define QcIneqSolverBaseDCL
#line 1 "QcIneqSolverBase.ch"
#include <qoca/QcSolver.H>
#include <qoca/QcDelLinInEqSystem.hh>
@@ -12,11 +11,24 @@ class QcIneqSolverBase
public:
inline
QcIneqSolverBase();
#line 18 "QcIneqSolverBase.ch"
QcIneqSolverBase()
: QcSolver(),
fSystem()
{
;
}
inline
QcIneqSolverBase(unsigned hintNumConstraints, unsigned hintNumVariables);
#line 26 "QcIneqSolverBase.ch"
QcIneqSolverBase(unsigned hintNumConstraints, unsigned hintNumVariables)
: QcSolver(),
fSystem( hintNumConstraints, hintNumVariables)
{
;
}
virtual ~QcIneqSolverBase()
{
}
@@ -78,10 +90,8 @@ IsBasic(QcFloat const &v) const
virtual bool
AddConstraint(QcConstraint &c);
#line 101 "QcIneqSolverBase.ch"
virtual bool
AddConstraint(QcConstraint &c, QcFloat &hint);
#line 117 "QcIneqSolverBase.ch"
virtual void
BeginAddConstraint()
{
@@ -98,10 +108,8 @@ EndAddConstraint()
virtual bool
ChangeConstraint(QcConstraint &oldc, numT rhs);
#line 143 "QcIneqSolverBase.ch"
virtual bool
RemoveConstraint(QcConstraint &c);
#line 159 "QcIneqSolverBase.ch"
virtual bool
Reset()
{
+4 -5
View File
@@ -2,7 +2,6 @@
#include "QcIneqSolverBase.H"
#ifndef QcIneqSolverBaseIFN
#define QcIneqSolverBaseIFN
#line 1 "QcIneqSolverBase.ch"
#include <qoca/QcSolver.hh>
@@ -12,11 +11,12 @@
inline
/*inline
QcIneqSolverBase::QcIneqSolverBase()
: QcSolver(),
fSystem()
{
;
}
@@ -25,16 +25,15 @@ QcIneqSolverBase::QcIneqSolverBase(unsigned hintNumConstraints, unsigned hintNum
: QcSolver(),
fSystem( hintNumConstraints, hintNumVariables)
{
}
;
}*/
#line 80 "QcIneqSolverBase.ch"
//-----------------------------------------------------------------------//
// Constraint management methods //
//-----------------------------------------------------------------------//
#line 173 "QcIneqSolverBase.ch"
/*
Local Variables:
mode:c++
+1 -1
View File
@@ -27,7 +27,7 @@
#ifndef __QcLinEqSystemH
#define __QcLinEqSystemH
#include <vector.h>
#include <vector>
#include "qoca/QcSolver.hh"
#include "qoca/QcLinEqTableau.hh"
#include "qoca/QcConstraint.hh"
+2 -2
View File
@@ -27,8 +27,8 @@
#ifndef __QcLinEqTableauH
#define __QcLinEqTableauH
#include <deque.h>
#include <vector.h>
#include <deque>
#include <vector>
#include "qoca/QcTableau.hh"
#include "qoca/QcSparseCoeff.hh"
#include "qoca/QcDelCoreTableau.hh"
+1 -1
View File
@@ -25,7 +25,7 @@
//============================================================================//
#include <math.h>
#include <vector.h>
#include <vector>
#include "qoca/QcDefines.hh"
#include "qoca/QcLinInEqTableau.hh"
#include "qoca/QcConstraintIndexIterator.hh"
@@ -113,7 +113,7 @@ QcOrigRowStateVector::virtualAssertLinkageInvar() const
{
QcOrigRowState const *state = CAST(QcOrigRowState const *, *i);
assert( state->fRHS == 0.0);
assert( state->fMRowIndex == i - fStates);
assert( state->fMRowIndex == (i - (QcState const * const *)fStates));
assert( !state->fARowDeleted);
}
}
@@ -28,11 +28,13 @@
// included with the above copyright notice. //
//============================================================================//
#include <iostream.h>
#include <iostream>
#include <qoca/QcQuasiRowStateVector.H>
#include <qoca/QcQuasiColStateVector.hh>
using namespace std;
class QcQuasiRowColStateVector
{
public:
+2 -2
View File
@@ -28,8 +28,8 @@
// included with the above copyright notice. //
//============================================================================//
#include <vector.h>
#include <algo.h>
#include <vector>
#include <algorithm>
#include "qoca/QcConstraint.hh"
+2 -2
View File
@@ -27,8 +27,8 @@
// included with the above copyright notice. //
//============================================================================//
#include <vector.h>
#include <algo.h>
#include <vector>
#include <algorithm>
#include "qoca/QcConstraint.hh"
#include <qoca/QcFixedFloatRep.hh>
+2 -2
View File
@@ -29,8 +29,8 @@
// included with the above copyright notice. //
//============================================================================//
#include <vector.h>
#include <algo.h>
#include <vector>
#include <algorithm>
#include "qoca/QcConstraint.hh"
+2 -1
View File
@@ -27,7 +27,8 @@
#ifndef __QcSparseCoeffH
#define __QcSparseCoeffH
#include <iostream.h>
#include <iostream>
using namespace std;
class QcSparseCoeff
{
+1 -1
View File
@@ -27,7 +27,7 @@
#ifndef __QcSparseMatrixH
#define __QcSparseMatrixH
#include <vector.h>
#include <vector>
#include "qoca/QcDefines.hh"
#include "qoca/QcMatrix.hh"
#include "qoca/QcSparseMatrixElement.hh"
+2 -2
View File
@@ -27,7 +27,7 @@
#ifndef __QcStateH
#define __QcStateH
#include <iostream.h>
#include <iostream>
class QcState
{
@@ -37,7 +37,7 @@ public:
//-----------------------------------------------------------------------//
// Utililty functions. //
//-----------------------------------------------------------------------//
virtual void Print(ostream &os) = 0;
virtual void Print(std::ostream &os) = 0;
};
#endif
+2 -1
View File
@@ -27,7 +27,8 @@
#ifndef __QcStateVectorH
#define __QcStateVectorH
#include <iostream.h>
#include <iostream>
using namespace std;
#include "qoca/QcDefines.hh"
#include "qoca/QcState.hh"
+9 -8
View File
@@ -1,7 +1,7 @@
#ifndef __QcUnsortedListSetH
#define __QcUnsortedListSetH
#include <vector.h>
#include <vector>
#if __GNUC__ >= 4
template <class T, class Alloc = std::allocator<T> >
@@ -12,8 +12,8 @@ class QcUnsortedListSet
{
public:
typedef T value_type;
typedef value_type* iterator;
typedef value_type const * const_iterator;
typedef typename std::vector<T>::iterator iterator;
typedef typename std::vector<T>::const_iterator const_iterator;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef size_t size_type;
@@ -34,11 +34,12 @@ public:
{
}
iterator begin() { return elements.begin(); }
iterator end() { return elements.end(); }
// TODO: This really shouldn't rely on vector's iterator type being a pointer
iterator begin() { return (iterator)elements.begin(); }
iterator end() { return (iterator)elements.end(); }
iterator abegin() { return elements.begin(); }
iterator aend() { return elements.end(); }
iterator abegin() { return (iterator)elements.begin(); }
iterator aend() { return (iterator)elements.end(); }
const_iterator abegin() const { return elements.begin(); }
const_iterator aend() const { return elements.end(); }
@@ -83,6 +84,6 @@ private:
(The reason for using an instance variable is so that we can control
the interface.) */
vector<T> elements;
std::vector<T> elements;
};
#endif /* !__QcUnsortedListSetH */
+9
View File
@@ -0,0 +1,9 @@
#include <qoca/QcUtility.hh>
/* Needed for GCC4, avoids undefined references */
double const QcUtility::qcEps; // = _QC_EPS;
double const QcUtility::qcNearEps; // = 9.313225746154785e-10; // 2 ** -30
double const QcUtility::qcVaguelyNearEps; // = 9.5367431640625e-7; // 2 ** -20
double const QcUtility::qcMaxZeroVal; // = _QC_EPS * (1 - DBL_EPSILON / 2);
+8 -8
View File
@@ -60,26 +60,26 @@ public:
//-----------------------------------------------------------------------//
static bool IsVaguelyZero(numT val)
{ return fabs( val) < qcVaguelyNearEps; }
{ return fabs( val) < QcUtility::qcVaguelyNearEps; }
static bool IsNearZero(numT val)
{ return fabs( val) < qcNearEps; }
{ return fabs( val) < QcUtility::qcNearEps; }
static bool IsZero(double val)
{ return fabs( val) < qcEps; }
{ return fabs( val) < QcUtility::qcEps; }
static bool IsOne(double val)
{ return IsZero( val - 1.0); }
{ return QcUtility::IsZero( val - 1.0); }
static bool IsNegative(numT val)
{ return (val <= -qcEps); }
{ return (val <= -QcUtility::qcEps); }
static bool IsPositive(numT val)
{ return (val >= qcEps); }
{ return (val >= QcUtility::qcEps); }
static double Zeroise(double val)
{
return (IsZero( val)
return (QcUtility::IsZero( val)
? 0.0
: val);
}
@@ -87,7 +87,7 @@ public:
#ifndef NDEBUG
static bool IsZeroised(double val)
{
return (val == 0 || !IsZero( val));
return (val == 0 || !QcUtility::IsZero( val));
}
#endif