mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
LinkedLists cleanup
This commit is contained in:
@ -26,22 +26,17 @@ License
|
|||||||
|
|
||||||
#include "ILList.H"
|
#include "ILList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
ILList<LListBase, T>::ILList(const ILList<LListBase, T>& slpl)
|
Foam::ILList<LListBase, T>::ILList(const ILList<LListBase, T>& lst)
|
||||||
:
|
:
|
||||||
UILList<LListBase, T>()
|
UILList<LListBase, T>()
|
||||||
{
|
{
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
|
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
|
||||||
iter != slpl.end();
|
iter != lst.end();
|
||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -53,9 +48,9 @@ ILList<LListBase, T>::ILList(const ILList<LListBase, T>& slpl)
|
|||||||
#ifndef __INTEL_COMPILER
|
#ifndef __INTEL_COMPILER
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
template<class CloneArg>
|
template<class CloneArg>
|
||||||
ILList<LListBase, T>::ILList
|
Foam::ILList<LListBase, T>::ILList
|
||||||
(
|
(
|
||||||
const ILList<LListBase, T>& slpl,
|
const ILList<LListBase, T>& lst,
|
||||||
const CloneArg& cloneArg
|
const CloneArg& cloneArg
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -63,8 +58,8 @@ ILList<LListBase, T>::ILList
|
|||||||
{
|
{
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
|
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
|
||||||
iter != slpl.end();
|
iter != lst.end();
|
||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -77,7 +72,7 @@ ILList<LListBase, T>::ILList
|
|||||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
ILList<LListBase, T>::~ILList()
|
Foam::ILList<LListBase, T>::~ILList()
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
}
|
}
|
||||||
@ -85,9 +80,8 @@ ILList<LListBase, T>::~ILList()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Return and remove head
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
bool ILList<LListBase, T>::eraseHead()
|
bool Foam::ILList<LListBase, T>::eraseHead()
|
||||||
{
|
{
|
||||||
T* tPtr;
|
T* tPtr;
|
||||||
if ((tPtr = this->removeHead()))
|
if ((tPtr = this->removeHead()))
|
||||||
@ -101,9 +95,8 @@ bool ILList<LListBase, T>::eraseHead()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return and remove element
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
bool ILList<LListBase, T>::erase(T* p)
|
bool Foam::ILList<LListBase, T>::erase(T* p)
|
||||||
{
|
{
|
||||||
T* tPtr;
|
T* tPtr;
|
||||||
if ((tPtr = remove(p)))
|
if ((tPtr = remove(p)))
|
||||||
@ -119,7 +112,7 @@ bool ILList<LListBase, T>::erase(T* p)
|
|||||||
|
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
void ILList<LListBase, T>::clear()
|
void Foam::ILList<LListBase, T>::clear()
|
||||||
{
|
{
|
||||||
label oldSize = this->size();
|
label oldSize = this->size();
|
||||||
for (label i=0; i<oldSize; i++)
|
for (label i=0; i<oldSize; i++)
|
||||||
@ -134,14 +127,14 @@ void ILList<LListBase, T>::clear()
|
|||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
void ILList<LListBase, T>::operator=(const ILList<LListBase, T>& slpl)
|
void Foam::ILList<LListBase, T>::operator=(const ILList<LListBase, T>& lst)
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
typename UILList<LListBase, T>::const_iterator iter = slpl.begin();
|
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
|
||||||
iter != slpl.end();
|
iter != lst.end();
|
||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -149,11 +142,6 @@ void ILList<LListBase, T>::operator=(const ILList<LListBase, T>& slpl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "ILListIO.C"
|
#include "ILListIO.C"
|
||||||
|
|||||||
@ -71,7 +71,7 @@ class ILList
|
|||||||
|
|
||||||
//- Read from Istream using given Istream constructor class
|
//- Read from Istream using given Istream constructor class
|
||||||
template<class INew>
|
template<class INew>
|
||||||
void read(Istream&, const INew& inewt);
|
void read(Istream&, const INew&);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -96,7 +96,7 @@ public:
|
|||||||
|
|
||||||
//- Copy constructor with additional argument for clone
|
//- Copy constructor with additional argument for clone
|
||||||
template<class CloneArg>
|
template<class CloneArg>
|
||||||
ILList(const ILList<LListBase, T>& slpl, const CloneArg& cloneArg)
|
ILList(const ILList<LListBase, T>& lst, const CloneArg& cloneArg)
|
||||||
#ifdef __INTEL_COMPILER
|
#ifdef __INTEL_COMPILER
|
||||||
:
|
:
|
||||||
UILList<LListBase, T>()
|
UILList<LListBase, T>()
|
||||||
@ -104,8 +104,8 @@ public:
|
|||||||
for
|
for
|
||||||
(
|
(
|
||||||
typename UILList<LListBase, T>::const_iterator iter =
|
typename UILList<LListBase, T>::const_iterator iter =
|
||||||
slpl.begin();
|
lst.begin();
|
||||||
iter != slpl.end();
|
iter != lst.end();
|
||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -118,7 +118,7 @@ public:
|
|||||||
|
|
||||||
//- Construct from Istream using given Istream constructor class
|
//- Construct from Istream using given Istream constructor class
|
||||||
template<class INew>
|
template<class INew>
|
||||||
ILList(Istream&, const INew& inewt);
|
ILList(Istream&, const INew&);
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
|||||||
@ -30,24 +30,19 @@ Description
|
|||||||
#include "Istream.H"
|
#include "Istream.H"
|
||||||
#include "INew.H"
|
#include "INew.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
template<class INew>
|
template<class INew>
|
||||||
void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
|
void Foam::ILList<LListBase, T>::read(Istream& is, const INew& iNew)
|
||||||
{
|
{
|
||||||
is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
|
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
|
||||||
|
|
||||||
token firstToken(is);
|
token firstToken(is);
|
||||||
|
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
(
|
(
|
||||||
"operator>>(Istream& is, ILList<LListBase, T>& L) : reading first token"
|
"operator>>(Istream&, ILList<LListBase, T>&) : reading first token"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (firstToken.isLabel())
|
if (firstToken.isLabel())
|
||||||
@ -63,23 +58,23 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
{
|
{
|
||||||
for (label i=0; i<s; i++)
|
for (label i=0; i<s; i++)
|
||||||
{
|
{
|
||||||
append(inewt(is).ptr());
|
append(iNew(is).ptr());
|
||||||
|
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
(
|
(
|
||||||
"operator>>(Istream& is, ILList<LListBase, T>& L) : "
|
"operator>>(Istream&, ILList<LListBase, T>&) : "
|
||||||
"reading entry"
|
"reading entry"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
T* tPtr = inewt(is).ptr();
|
T* tPtr = iNew(is).ptr();
|
||||||
append(tPtr);
|
append(tPtr);
|
||||||
|
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
(
|
(
|
||||||
"operator>>(Istream& is, ILList<LListBase, T>& L) : "
|
"operator>>(Istream&, ILList<LListBase, T>&) : "
|
||||||
"reading entry"
|
"reading entry"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -99,14 +94,14 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
{
|
{
|
||||||
FatalIOErrorIn
|
FatalIOErrorIn
|
||||||
(
|
(
|
||||||
"operator>>(Istream& is, ILList<LListBase, T>& L)",
|
"operator>>(Istream&, ILList<LListBase, T>&)",
|
||||||
is
|
is
|
||||||
) << "incorrect first token, '(', found " << firstToken.info()
|
) << "incorrect first token, '(', found " << firstToken.info()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
token lastToken(is);
|
token lastToken(is);
|
||||||
is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
|
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
|
||||||
|
|
||||||
while
|
while
|
||||||
(
|
(
|
||||||
@ -117,36 +112,34 @@ void ILList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
is.putBack(lastToken);
|
is.putBack(lastToken);
|
||||||
append(inewt(is).ptr());
|
append(iNew(is).ptr());
|
||||||
|
|
||||||
is >> lastToken;
|
is >> lastToken;
|
||||||
is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
|
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalIOErrorIn("operator>>(Istream& is, ILList<LListBase, T>& L)", is)
|
FatalIOErrorIn("operator>>(Istream&, ILList<LListBase, T>&)", is)
|
||||||
<< "incorrect first token, expected <int> or '(', found "
|
<< "incorrect first token, expected <int> or '(', found "
|
||||||
<< firstToken.info()
|
<< firstToken.info()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
is.fatalCheck("operator>>(Istream& is, ILList<LListBase, T>& L)");
|
is.fatalCheck("operator>>(Istream&, ILList<LListBase, T>&)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Construct from Istream using given Istream constructor class
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
template<class INew>
|
template<class INew>
|
||||||
ILList<LListBase, T>::ILList(Istream& is, const INew& inewt)
|
Foam::ILList<LListBase, T>::ILList(Istream& is, const INew& iNew)
|
||||||
{
|
{
|
||||||
read(is, inewt);
|
read(is, iNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Construct from Istream
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
ILList<LListBase, T>::ILList(Istream& is)
|
Foam::ILList<LListBase, T>::ILList(Istream& is)
|
||||||
{
|
{
|
||||||
read(is, INew<T>());
|
read(is, INew<T>());
|
||||||
}
|
}
|
||||||
@ -155,7 +148,7 @@ ILList<LListBase, T>::ILList(Istream& is)
|
|||||||
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
Istream& operator>>(Istream& is, ILList<LListBase, T>& L)
|
Foam::Istream& Foam::operator>>(Istream& is, ILList<LListBase, T>& L)
|
||||||
{
|
{
|
||||||
L.clear();
|
L.clear();
|
||||||
L.read(is, INew<T>());
|
L.read(is, INew<T>());
|
||||||
@ -166,6 +159,4 @@ Istream& operator>>(Istream& is, ILList<LListBase, T>& L)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -27,22 +27,16 @@ Description
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
|
|
||||||
#include "LList.H"
|
#include "LList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
LList<LListBase, T>::LList(const LList<LListBase, T>& slpl)
|
Foam::LList<LListBase, T>::LList(const LList<LListBase, T>& lst)
|
||||||
:
|
:
|
||||||
LListBase()
|
LListBase()
|
||||||
{
|
{
|
||||||
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||||
{
|
{
|
||||||
append(iter());
|
append(iter());
|
||||||
}
|
}
|
||||||
@ -50,7 +44,7 @@ LList<LListBase, T>::LList(const LList<LListBase, T>& slpl)
|
|||||||
|
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
LList<LListBase, T>::~LList()
|
Foam::LList<LListBase, T>::~LList()
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
}
|
}
|
||||||
@ -59,7 +53,7 @@ LList<LListBase, T>::~LList()
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
void LList<LListBase, T>::clear()
|
void Foam::LList<LListBase, T>::clear()
|
||||||
{
|
{
|
||||||
label oldSize = this->size();
|
label oldSize = this->size();
|
||||||
for (label i=0; i<oldSize; i++)
|
for (label i=0; i<oldSize; i++)
|
||||||
@ -74,21 +68,17 @@ void LList<LListBase, T>::clear()
|
|||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
void LList<LListBase, T>::operator=(const LList<LListBase, T>& slpl)
|
void Foam::LList<LListBase, T>::operator=(const LList<LListBase, T>& lst)
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
|
|
||||||
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||||
{
|
{
|
||||||
append(iter());
|
append(iter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "LListIO.C"
|
#include "LListIO.C"
|
||||||
|
|||||||
@ -67,7 +67,7 @@ Ostream& operator<<
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class LList Declaration
|
Class LList Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
|
|||||||
@ -30,16 +30,10 @@ Description
|
|||||||
#include "Istream.H"
|
#include "Istream.H"
|
||||||
#include "Ostream.H"
|
#include "Ostream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Construct from Istream
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
LList<LListBase, T>::LList(Istream& is)
|
Foam::LList<LListBase, T>::LList(Istream& is)
|
||||||
{
|
{
|
||||||
operator>>(is, *this);
|
operator>>(is, *this);
|
||||||
}
|
}
|
||||||
@ -48,18 +42,18 @@ LList<LListBase, T>::LList(Istream& is)
|
|||||||
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
Istream& operator>>(Istream& is, LList<LListBase, T>& L)
|
Foam::Istream& Foam::operator>>(Istream& is, LList<LListBase, T>& L)
|
||||||
{
|
{
|
||||||
// Anull list
|
// Anull list
|
||||||
L.clear();
|
L.clear();
|
||||||
|
|
||||||
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
|
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
|
||||||
|
|
||||||
token firstToken(is);
|
token firstToken(is);
|
||||||
|
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
(
|
(
|
||||||
" operator>>(Istream& is, LList<LListBase, T>& L) : reading first token"
|
" operator>>(Istream&, LList<LListBase, T>&) : reading first token"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (firstToken.isLabel())
|
if (firstToken.isLabel())
|
||||||
@ -101,14 +95,14 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
|
|||||||
{
|
{
|
||||||
FatalIOErrorIn
|
FatalIOErrorIn
|
||||||
(
|
(
|
||||||
" operator>>(Istream& is, LList<LListBase, T>& L)",
|
" operator>>(Istream&, LList<LListBase, T>&)",
|
||||||
is
|
is
|
||||||
) << "incorrect first token, '(', found " << firstToken.info()
|
) << "incorrect first token, '(', found " << firstToken.info()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
token lastToken(is);
|
token lastToken(is);
|
||||||
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
|
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
|
||||||
|
|
||||||
while
|
while
|
||||||
(
|
(
|
||||||
@ -124,19 +118,19 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
|
|||||||
L.append(element);
|
L.append(element);
|
||||||
|
|
||||||
is >> lastToken;
|
is >> lastToken;
|
||||||
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
|
is.fatalCheck(" operator>>(Istream&, LList<LListBase, T>&)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalIOErrorIn(" operator>>(Istream& is, LList<LListBase, T>& L)", is)
|
FatalIOErrorIn(" operator>>(Istream&, LList<LListBase, T>&)", is)
|
||||||
<< "incorrect first token, expected <int> or '(', found "
|
<< "incorrect first token, expected <int> or '(', found "
|
||||||
<< firstToken.info()
|
<< firstToken.info()
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check state of IOstream
|
// Check state of IOstream
|
||||||
is.fatalCheck(" operator>>(Istream& is, LList<LListBase, T>& L)");
|
is.fatalCheck(" operator>>(Istream&, LList<LListBase,>&)");
|
||||||
|
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
@ -145,19 +139,19 @@ Istream& operator>>(Istream& is, LList<LListBase, T>& L)
|
|||||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
Ostream& operator<<(Ostream& os, const LList<LListBase, T>& ll)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const LList<LListBase, T>& lst)
|
||||||
{
|
{
|
||||||
// Write size of LList
|
// Write size
|
||||||
os << nl << ll.size();
|
os << nl << lst.size();
|
||||||
|
|
||||||
// Write beginning of contents
|
// Write beginning of contents
|
||||||
os << nl << token::BEGIN_LIST << nl;
|
os << nl << token::BEGIN_LIST << nl;
|
||||||
|
|
||||||
// Write LList contents
|
// Write contents
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
typename LList<LListBase, T>::const_iterator iter = ll.begin();
|
typename LList<LListBase, T>::const_iterator iter = lst.begin();
|
||||||
iter != ll.end();
|
iter != lst.end();
|
||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -168,14 +162,10 @@ Ostream& operator<<(Ostream& os, const LList<LListBase, T>& ll)
|
|||||||
os << token::END_LIST;
|
os << token::END_LIST;
|
||||||
|
|
||||||
// Check state of IOstream
|
// Check state of IOstream
|
||||||
os.check("Ostream& operator<<(Ostream&, const LList&)");
|
os.check("Ostream& operator<<(Ostream&, const LList<LListBase, T>&)");
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -34,11 +34,11 @@ namespace Foam
|
|||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& slpl)
|
LPtrList<LListBase, T>::LPtrList(const LPtrList<LListBase, T>& lst)
|
||||||
:
|
:
|
||||||
LList<LListBase, T*>()
|
LList<LListBase, T*>()
|
||||||
{
|
{
|
||||||
for(const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||||
{
|
{
|
||||||
append(iter().clone().ptr());
|
append(iter().clone().ptr());
|
||||||
}
|
}
|
||||||
@ -89,11 +89,11 @@ void LPtrList<LListBase, T>::clear()
|
|||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
void LPtrList<LListBase, T>::operator=(const LPtrList<LListBase, T>& slpl)
|
void LPtrList<LListBase, T>::operator=(const LPtrList<LListBase, T>& lst)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
for(const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||||
{
|
{
|
||||||
append(iter().clone().ptr());
|
append(iter().clone().ptr());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,16 +29,11 @@ License
|
|||||||
#include "Ostream.H"
|
#include "Ostream.H"
|
||||||
#include "INew.H"
|
#include "INew.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
template<class INew>
|
template<class INew>
|
||||||
void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
void Foam::LPtrList<LListBase, T>::read(Istream& is, const INew& iNew)
|
||||||
{
|
{
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
(
|
(
|
||||||
@ -66,7 +61,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
{
|
{
|
||||||
for (label i=0; i<s; i++)
|
for (label i=0; i<s; i++)
|
||||||
{
|
{
|
||||||
append(inewt(is).ptr());
|
append(iNew(is).ptr());
|
||||||
|
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
(
|
(
|
||||||
@ -77,7 +72,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
T* tPtr = inewt(is).ptr();
|
T* tPtr = iNew(is).ptr();
|
||||||
append(tPtr);
|
append(tPtr);
|
||||||
|
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
@ -120,7 +115,7 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
is.putBack(lastToken);
|
is.putBack(lastToken);
|
||||||
append(inewt(is).ptr());
|
append(iNew(is).ptr());
|
||||||
|
|
||||||
is >> lastToken;
|
is >> lastToken;
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
@ -148,14 +143,14 @@ void LPtrList<LListBase, T>::read(Istream& is, const INew& inewt)
|
|||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
template<class INew>
|
template<class INew>
|
||||||
LPtrList<LListBase, T>::LPtrList(Istream& is, const INew& inewt)
|
Foam::LPtrList<LListBase, T>::LPtrList(Istream& is, const INew& iNew)
|
||||||
{
|
{
|
||||||
read(is, inewt);
|
read(is, iNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
LPtrList<LListBase, T>::LPtrList(Istream& is)
|
Foam::LPtrList<LListBase, T>::LPtrList(Istream& is)
|
||||||
{
|
{
|
||||||
read(is, INew<T>());
|
read(is, INew<T>());
|
||||||
}
|
}
|
||||||
@ -164,11 +159,10 @@ LPtrList<LListBase, T>::LPtrList(Istream& is)
|
|||||||
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
Istream& operator>>(Istream& is, LPtrList<LListBase, T>& L)
|
Foam::Istream& Foam::operator>>(Istream& is, LPtrList<LListBase, T>& L)
|
||||||
{
|
{
|
||||||
// Anull list
|
|
||||||
L.clear();
|
L.clear();
|
||||||
|
L.read(is, INew<T>());
|
||||||
|
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
@ -177,19 +171,19 @@ Istream& operator>>(Istream& is, LPtrList<LListBase, T>& L)
|
|||||||
// * * * * * * * * * * * * * * * Ostream Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Ostream Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
Ostream& operator<<(Ostream& os, const LPtrList<LListBase, T>& slpl)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const LPtrList<LListBase, T>& lst)
|
||||||
{
|
{
|
||||||
// Write size of LPtrList
|
// Write size
|
||||||
os << nl << slpl.size();
|
os << nl << lst.size();
|
||||||
|
|
||||||
// Write beginning of contents
|
// Write beginning of contents
|
||||||
os << nl << token::BEGIN_LIST << nl;
|
os << nl << token::BEGIN_LIST << nl;
|
||||||
|
|
||||||
// Write LPtrList contents
|
// Write contents
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
typename LPtrList<LListBase, T>::const_iterator iter = slpl.begin();
|
typename LPtrList<LListBase, T>::const_iterator iter = lst.begin();
|
||||||
iter != slpl.end();
|
iter != lst.end();
|
||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -200,14 +194,9 @@ Ostream& operator<<(Ostream& os, const LPtrList<LListBase, T>& slpl)
|
|||||||
os << token::END_LIST;
|
os << token::END_LIST;
|
||||||
|
|
||||||
// Check state of IOstream
|
// Check state of IOstream
|
||||||
os.check("Ostream& operator<<(Ostream&, const LPtrList&)");
|
os.check("Ostream& operator<<(Ostream&, const LPtrList<LListBase, T>&)");
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -28,17 +28,12 @@ Description
|
|||||||
|
|
||||||
#include "UILList.H"
|
#include "UILList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
UILList<LListBase, T>::UILList(const UILList<LListBase, T>& slpl)
|
Foam::UILList<LListBase, T>::UILList(const UILList<LListBase, T>& lst)
|
||||||
{
|
{
|
||||||
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
for (const_iterator iter = lst.begin(); iter != lst.end(); ++iter)
|
||||||
{
|
{
|
||||||
append(&iter());
|
append(&iter());
|
||||||
}
|
}
|
||||||
@ -48,22 +43,24 @@ UILList<LListBase, T>::UILList(const UILList<LListBase, T>& slpl)
|
|||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
void UILList<LListBase, T>::operator=(const UILList<LListBase, T>& slpl)
|
void Foam::UILList<LListBase, T>::operator=(const UILList<LListBase, T>& rhs)
|
||||||
{
|
{
|
||||||
LListBase::clear();
|
LListBase::clear();
|
||||||
|
|
||||||
for (const_iterator iter = slpl.begin(); iter != slpl.end(); ++iter)
|
for (const_iterator iter = rhs.begin(); iter != rhs.end(); ++iter)
|
||||||
{
|
{
|
||||||
append(&iter());
|
append(&iter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Comparison for equality
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
bool UILList<LListBase, T>::operator==(const UILList<LListBase, T>& slpl) const
|
bool Foam::UILList<LListBase, T>::operator==
|
||||||
|
(
|
||||||
|
const UILList<LListBase, T>& rhs
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
if (this->size() != slpl.size())
|
if (this->size() != rhs.size())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -71,7 +68,7 @@ bool UILList<LListBase, T>::operator==(const UILList<LListBase, T>& slpl) const
|
|||||||
bool equal = true;
|
bool equal = true;
|
||||||
|
|
||||||
const_iterator iter1 = this->begin();
|
const_iterator iter1 = this->begin();
|
||||||
const_iterator iter2 = slpl.begin();
|
const_iterator iter2 = rhs.begin();
|
||||||
|
|
||||||
for (; iter1 != this->end(); ++iter1, ++iter2)
|
for (; iter1 != this->end(); ++iter1, ++iter2)
|
||||||
{
|
{
|
||||||
@ -84,16 +81,15 @@ bool UILList<LListBase, T>::operator==(const UILList<LListBase, T>& slpl) const
|
|||||||
|
|
||||||
// Comparison for inequality
|
// Comparison for inequality
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
bool UILList<LListBase, T>::operator!=(const UILList<LListBase, T>& slpl) const
|
bool Foam::UILList<LListBase, T>::operator!=
|
||||||
|
(
|
||||||
|
const UILList<LListBase, T>& rhs
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
return !operator==(slpl);
|
return !operator==(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "UILListIO.C"
|
#include "UILListIO.C"
|
||||||
|
|||||||
@ -266,7 +266,7 @@ public:
|
|||||||
// STL member operators
|
// STL member operators
|
||||||
|
|
||||||
//- Equality operation on ULists of the same type.
|
//- Equality operation on ULists of the same type.
|
||||||
// Returns true when the ULists are elementwise equal
|
// Returns true when the ULists are element-wise equal
|
||||||
// (using UList::value_type::operator==). Takes linear time.
|
// (using UList::value_type::operator==). Takes linear time.
|
||||||
bool operator==(const UILList<LListBase, T>&) const;
|
bool operator==(const UILList<LListBase, T>&) const;
|
||||||
|
|
||||||
|
|||||||
@ -30,27 +30,22 @@ Description
|
|||||||
#include "Ostream.H"
|
#include "Ostream.H"
|
||||||
#include "token.H"
|
#include "token.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class LListBase, class T>
|
template<class LListBase, class T>
|
||||||
Ostream& operator<<(Ostream& os, const UILList<LListBase, T>& ill)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const UILList<LListBase, T>& lst)
|
||||||
{
|
{
|
||||||
// Write size of UILList
|
// Write size
|
||||||
os << nl << ill.size();
|
os << nl << lst.size();
|
||||||
|
|
||||||
// Write beginning of contents
|
// Write beginning of contents
|
||||||
os << nl << token::BEGIN_LIST << nl;
|
os << nl << token::BEGIN_LIST << nl;
|
||||||
|
|
||||||
// Write UILList contents
|
// Write contents
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
typename UILList<LListBase, T>::const_iterator iter = ill.begin();
|
typename UILList<LListBase, T>::const_iterator iter = lst.begin();
|
||||||
iter != ill.end();
|
iter != lst.end();
|
||||||
++iter
|
++iter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -61,14 +56,9 @@ Ostream& operator<<(Ostream& os, const UILList<LListBase, T>& ill)
|
|||||||
os << token::END_LIST;
|
os << token::END_LIST;
|
||||||
|
|
||||||
// Check state of IOstream
|
// Check state of IOstream
|
||||||
os.check("Ostream& operator<<(Ostream&, const UILList&)");
|
os.check("Ostream& operator<<(Ostream&, const UILList<LListBase, T>&)");
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -32,17 +32,12 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
Foam::DLListBase::iterator Foam::DLListBase::endIter
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
DLListBase::iterator DLListBase::endIter
|
|
||||||
(
|
(
|
||||||
const_cast<DLListBase&>(static_cast<const DLListBase&>(DLListBase()))
|
const_cast<DLListBase&>(static_cast<const DLListBase&>(DLListBase()))
|
||||||
);
|
);
|
||||||
|
|
||||||
DLListBase::const_iterator DLListBase::endConstIter
|
Foam::DLListBase::const_iterator Foam::DLListBase::endConstIter
|
||||||
(
|
(
|
||||||
static_cast<const DLListBase&>(DLListBase()),
|
static_cast<const DLListBase&>(DLListBase()),
|
||||||
reinterpret_cast<const link*>(NULL)
|
reinterpret_cast<const link*>(NULL)
|
||||||
@ -51,7 +46,7 @@ DLListBase::const_iterator DLListBase::endConstIter
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void DLListBase::insert(DLListBase::link* a)
|
void Foam::DLListBase::insert(DLListBase::link* a)
|
||||||
{
|
{
|
||||||
nElmts_++;
|
nElmts_++;
|
||||||
|
|
||||||
@ -71,7 +66,7 @@ void DLListBase::insert(DLListBase::link* a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DLListBase::append(DLListBase::link* a)
|
void Foam::DLListBase::append(DLListBase::link* a)
|
||||||
{
|
{
|
||||||
nElmts_++;
|
nElmts_++;
|
||||||
|
|
||||||
@ -91,7 +86,7 @@ void DLListBase::append(DLListBase::link* a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DLListBase::swapUp(DLListBase::link* a)
|
bool Foam::DLListBase::swapUp(DLListBase::link* a)
|
||||||
{
|
{
|
||||||
if (first_ != a)
|
if (first_ != a)
|
||||||
{
|
{
|
||||||
@ -132,7 +127,7 @@ bool DLListBase::swapUp(DLListBase::link* a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DLListBase::swapDown(DLListBase::link* a)
|
bool Foam::DLListBase::swapDown(DLListBase::link* a)
|
||||||
{
|
{
|
||||||
if (last_ != a)
|
if (last_ != a)
|
||||||
{
|
{
|
||||||
@ -173,7 +168,7 @@ bool DLListBase::swapDown(DLListBase::link* a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DLListBase::link* DLListBase::removeHead()
|
Foam::DLListBase::link* Foam::DLListBase::removeHead()
|
||||||
{
|
{
|
||||||
nElmts_--;
|
nElmts_--;
|
||||||
|
|
||||||
@ -197,7 +192,7 @@ DLListBase::link* DLListBase::removeHead()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DLListBase::link* DLListBase::remove(DLListBase::link* l)
|
Foam::DLListBase::link* Foam::DLListBase::remove(DLListBase::link* l)
|
||||||
{
|
{
|
||||||
nElmts_--;
|
nElmts_--;
|
||||||
|
|
||||||
@ -229,7 +224,7 @@ DLListBase::link* DLListBase::remove(DLListBase::link* l)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DLListBase::link* DLListBase::replace
|
Foam::DLListBase::link* Foam::DLListBase::replace
|
||||||
(
|
(
|
||||||
DLListBase::link* oldLink,
|
DLListBase::link* oldLink,
|
||||||
DLListBase::link* newLink
|
DLListBase::link* newLink
|
||||||
@ -266,8 +261,4 @@ DLListBase::link* DLListBase::replace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -26,21 +26,16 @@ License
|
|||||||
|
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline DLListBase::link::link()
|
inline Foam::DLListBase::link::link()
|
||||||
:
|
:
|
||||||
prev_(0),
|
prev_(0),
|
||||||
next_(0)
|
next_(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::DLListBase()
|
inline Foam::DLListBase::DLListBase()
|
||||||
:
|
:
|
||||||
first_(0),
|
first_(0),
|
||||||
last_(0),
|
last_(0),
|
||||||
@ -48,7 +43,7 @@ inline DLListBase::DLListBase()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::DLListBase(link* a)
|
inline Foam::DLListBase::DLListBase(link* a)
|
||||||
:
|
:
|
||||||
first_(a),
|
first_(a),
|
||||||
last_(a),
|
last_(a),
|
||||||
@ -61,32 +56,32 @@ inline DLListBase::DLListBase(link* a)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline DLListBase::~DLListBase()
|
inline Foam::DLListBase::~DLListBase()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline bool DLListBase::link::registered() const
|
inline bool Foam::DLListBase::link::registered() const
|
||||||
{
|
{
|
||||||
return prev_ != 0 && next_ != 0;
|
return prev_ != 0 && next_ != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void DLListBase::link::deregister()
|
inline void Foam::DLListBase::link::deregister()
|
||||||
{
|
{
|
||||||
prev_ = 0;
|
prev_ = 0;
|
||||||
next_ = 0;
|
next_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline label DLListBase::size() const
|
inline Foam::label Foam::DLListBase::size() const
|
||||||
{
|
{
|
||||||
return nElmts_;
|
return nElmts_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::link* DLListBase::first()
|
inline Foam::DLListBase::link* Foam::DLListBase::first()
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -98,7 +93,7 @@ inline DLListBase::link* DLListBase::first()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const DLListBase::link* DLListBase::first() const
|
inline const Foam::DLListBase::link* Foam::DLListBase::first() const
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -110,7 +105,7 @@ inline const DLListBase::link* DLListBase::first() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::link* DLListBase::last()
|
inline Foam::DLListBase::link* Foam::DLListBase::last()
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -122,7 +117,7 @@ inline DLListBase::link* DLListBase::last()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const DLListBase::link* DLListBase::last() const
|
inline const Foam::DLListBase::link* Foam::DLListBase::last() const
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -134,7 +129,7 @@ inline const DLListBase::link* DLListBase::last() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void DLListBase::clear()
|
inline void Foam::DLListBase::clear()
|
||||||
{
|
{
|
||||||
nElmts_ = 0;
|
nElmts_ = 0;
|
||||||
first_ = 0;
|
first_ = 0;
|
||||||
@ -142,13 +137,16 @@ inline void DLListBase::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::link* DLListBase::remove(DLListBase::iterator& it)
|
inline Foam::DLListBase::link* Foam::DLListBase::remove
|
||||||
|
(
|
||||||
|
DLListBase::iterator& it
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return remove(it.curElmt_);
|
return remove(it.curElmt_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::link* DLListBase::replace
|
inline Foam::DLListBase::link* Foam::DLListBase::replace
|
||||||
(
|
(
|
||||||
DLListBase::iterator& oldIter,
|
DLListBase::iterator& oldIter,
|
||||||
DLListBase::link* newLink
|
DLListBase::link* newLink
|
||||||
@ -160,7 +158,7 @@ inline DLListBase::link* DLListBase::replace
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline DLListBase::iterator::iterator(DLListBase& s, link* elmt)
|
inline Foam::DLListBase::iterator::iterator(DLListBase& s, link* elmt)
|
||||||
:
|
:
|
||||||
curList_(s),
|
curList_(s),
|
||||||
curElmt_(elmt),
|
curElmt_(elmt),
|
||||||
@ -168,7 +166,7 @@ inline DLListBase::iterator::iterator(DLListBase& s, link* elmt)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::iterator::iterator(DLListBase& s)
|
inline Foam::DLListBase::iterator::iterator(DLListBase& s)
|
||||||
:
|
:
|
||||||
curList_(s),
|
curList_(s),
|
||||||
curElmt_(NULL),
|
curElmt_(NULL),
|
||||||
@ -176,32 +174,32 @@ inline DLListBase::iterator::iterator(DLListBase& s)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline void DLListBase::iterator::operator=(const iterator& iter)
|
inline void Foam::DLListBase::iterator::operator=(const iterator& iter)
|
||||||
{
|
{
|
||||||
curElmt_ = iter.curElmt_;
|
curElmt_ = iter.curElmt_;
|
||||||
curLink_ = iter.curLink_;
|
curLink_ = iter.curLink_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool DLListBase::iterator::operator==(const iterator& iter) const
|
inline bool Foam::DLListBase::iterator::operator==(const iterator& iter) const
|
||||||
{
|
{
|
||||||
return curElmt_ == iter.curElmt_;
|
return curElmt_ == iter.curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool DLListBase::iterator::operator!=(const iterator& iter) const
|
inline bool Foam::DLListBase::iterator::operator!=(const iterator& iter) const
|
||||||
{
|
{
|
||||||
return curElmt_ != iter.curElmt_;
|
return curElmt_ != iter.curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::link& DLListBase::iterator::operator*()
|
inline Foam::DLListBase::link& Foam::DLListBase::iterator::operator*()
|
||||||
{
|
{
|
||||||
return *curElmt_;
|
return *curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::iterator& DLListBase::iterator::operator++()
|
inline Foam::DLListBase::iterator& Foam::DLListBase::iterator::operator++()
|
||||||
{
|
{
|
||||||
// Check if the curElmt_ is the last element (if it points to itself)
|
// Check if the curElmt_ is the last element (if it points to itself)
|
||||||
// or if the list is empty because the last element may have been removed
|
// or if the list is empty because the last element may have been removed
|
||||||
@ -219,7 +217,7 @@ inline DLListBase::iterator& DLListBase::iterator::operator++()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::iterator DLListBase::iterator::operator++(int)
|
inline Foam::DLListBase::iterator Foam::DLListBase::iterator::operator++(int)
|
||||||
{
|
{
|
||||||
iterator tmp = *this;
|
iterator tmp = *this;
|
||||||
++*this;
|
++*this;
|
||||||
@ -227,7 +225,7 @@ inline DLListBase::iterator DLListBase::iterator::operator++(int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::iterator DLListBase::begin()
|
inline Foam::DLListBase::iterator Foam::DLListBase::begin()
|
||||||
{
|
{
|
||||||
if (size())
|
if (size())
|
||||||
{
|
{
|
||||||
@ -240,7 +238,7 @@ inline DLListBase::iterator DLListBase::begin()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const DLListBase::iterator& DLListBase::end()
|
inline const Foam::DLListBase::iterator& Foam::DLListBase::end()
|
||||||
{
|
{
|
||||||
return endIter;
|
return endIter;
|
||||||
}
|
}
|
||||||
@ -248,7 +246,7 @@ inline const DLListBase::iterator& DLListBase::end()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * STL const_iterator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * STL const_iterator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline DLListBase::const_iterator::const_iterator
|
inline Foam::DLListBase::const_iterator::const_iterator
|
||||||
(
|
(
|
||||||
const DLListBase& s,
|
const DLListBase& s,
|
||||||
const link* elmt
|
const link* elmt
|
||||||
@ -259,20 +257,23 @@ inline DLListBase::const_iterator::const_iterator
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::const_iterator::const_iterator(const iterator& iter)
|
inline Foam::DLListBase::const_iterator::const_iterator(const iterator& iter)
|
||||||
:
|
:
|
||||||
curList_(iter.curList_),
|
curList_(iter.curList_),
|
||||||
curElmt_(iter.curElmt_)
|
curElmt_(iter.curElmt_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline void DLListBase::const_iterator::operator=(const const_iterator& iter)
|
inline void Foam::DLListBase::const_iterator::operator=
|
||||||
|
(
|
||||||
|
const const_iterator& iter
|
||||||
|
)
|
||||||
{
|
{
|
||||||
curElmt_ = iter.curElmt_;
|
curElmt_ = iter.curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool DLListBase::const_iterator::operator==
|
inline bool Foam::DLListBase::const_iterator::operator==
|
||||||
(
|
(
|
||||||
const const_iterator& iter
|
const const_iterator& iter
|
||||||
) const
|
) const
|
||||||
@ -281,7 +282,7 @@ inline bool DLListBase::const_iterator::operator==
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool DLListBase::const_iterator::operator!=
|
inline bool Foam::DLListBase::const_iterator::operator!=
|
||||||
(
|
(
|
||||||
const const_iterator& iter
|
const const_iterator& iter
|
||||||
) const
|
) const
|
||||||
@ -290,13 +291,14 @@ inline bool DLListBase::const_iterator::operator!=
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const DLListBase::link& DLListBase::const_iterator::operator*()
|
inline const Foam::DLListBase::link& DLListBase::const_iterator::operator*()
|
||||||
{
|
{
|
||||||
return *curElmt_;
|
return *curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::const_iterator& DLListBase::const_iterator::operator++()
|
inline Foam::DLListBase::const_iterator&
|
||||||
|
Foam::DLListBase::const_iterator::operator++()
|
||||||
{
|
{
|
||||||
if (curElmt_ == curList_.last_)
|
if (curElmt_ == curList_.last_)
|
||||||
{
|
{
|
||||||
@ -311,7 +313,8 @@ inline DLListBase::const_iterator& DLListBase::const_iterator::operator++()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::const_iterator DLListBase::const_iterator::operator++(int)
|
inline Foam::DLListBase::const_iterator
|
||||||
|
Foam::DLListBase::const_iterator::operator++(int)
|
||||||
{
|
{
|
||||||
const_iterator tmp = *this;
|
const_iterator tmp = *this;
|
||||||
++*this;
|
++*this;
|
||||||
@ -319,7 +322,7 @@ inline DLListBase::const_iterator DLListBase::const_iterator::operator++(int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline DLListBase::const_iterator DLListBase::begin() const
|
inline Foam::DLListBase::const_iterator Foam::DLListBase::begin() const
|
||||||
{
|
{
|
||||||
if (size())
|
if (size())
|
||||||
{
|
{
|
||||||
@ -332,14 +335,10 @@ inline DLListBase::const_iterator DLListBase::begin() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const DLListBase::const_iterator& DLListBase::end() const
|
inline const Foam::DLListBase::const_iterator& Foam::DLListBase::end() const
|
||||||
{
|
{
|
||||||
return endConstIter;
|
return endConstIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -25,22 +25,16 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
|
|
||||||
#include "SLListBase.H"
|
#include "SLListBase.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
Foam::SLListBase::iterator Foam::SLListBase::endIter
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
SLListBase::iterator SLListBase::endIter
|
|
||||||
(
|
(
|
||||||
const_cast<SLListBase&>(static_cast<const SLListBase&>(SLListBase()))
|
const_cast<SLListBase&>(static_cast<const SLListBase&>(SLListBase()))
|
||||||
);
|
);
|
||||||
|
|
||||||
SLListBase::const_iterator SLListBase::endConstIter
|
Foam::SLListBase::const_iterator Foam::SLListBase::endConstIter
|
||||||
(
|
(
|
||||||
static_cast<const SLListBase&>(SLListBase()),
|
static_cast<const SLListBase&>(SLListBase()),
|
||||||
reinterpret_cast<const link*>(NULL)
|
reinterpret_cast<const link*>(NULL)
|
||||||
@ -49,7 +43,7 @@ SLListBase::const_iterator SLListBase::endConstIter
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void SLListBase::insert(SLListBase::link* a)
|
void Foam::SLListBase::insert(SLListBase::link* a)
|
||||||
{
|
{
|
||||||
nElmts_++;
|
nElmts_++;
|
||||||
|
|
||||||
@ -66,7 +60,7 @@ void SLListBase::insert(SLListBase::link* a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SLListBase::append(SLListBase::link* a)
|
void Foam::SLListBase::append(SLListBase::link* a)
|
||||||
{
|
{
|
||||||
nElmts_++;
|
nElmts_++;
|
||||||
|
|
||||||
@ -82,7 +76,7 @@ void SLListBase::append(SLListBase::link* a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SLListBase::link* SLListBase::removeHead()
|
Foam::SLListBase::link* Foam::SLListBase::removeHead()
|
||||||
{
|
{
|
||||||
nElmts_--;
|
nElmts_--;
|
||||||
|
|
||||||
@ -108,7 +102,7 @@ SLListBase::link* SLListBase::removeHead()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SLListBase::link* SLListBase::remove(SLListBase::link* it)
|
Foam::SLListBase::link* Foam::SLListBase::remove(SLListBase::link* it)
|
||||||
{
|
{
|
||||||
SLListBase::iterator iter = begin();
|
SLListBase::iterator iter = begin();
|
||||||
SLListBase::link *prev = &(*iter);
|
SLListBase::link *prev = &(*iter);
|
||||||
@ -143,8 +137,4 @@ SLListBase::link* SLListBase::remove(SLListBase::link* it)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -29,33 +29,28 @@ Description
|
|||||||
|
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline SLListBase::link::link()
|
inline Foam::SLListBase::link::link()
|
||||||
:
|
:
|
||||||
next_(0)
|
next_(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::link::link(link* p)
|
inline Foam::SLListBase::link::link(link* p)
|
||||||
:
|
:
|
||||||
next_(p)
|
next_(p)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::SLListBase()
|
inline Foam::SLListBase::SLListBase()
|
||||||
:
|
:
|
||||||
last_(0),
|
last_(0),
|
||||||
nElmts_(0)
|
nElmts_(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::SLListBase(link* a)
|
inline Foam::SLListBase::SLListBase(link* a)
|
||||||
:
|
:
|
||||||
last_(a->next_ = a),
|
last_(a->next_ = a),
|
||||||
nElmts_(1)
|
nElmts_(1)
|
||||||
@ -64,19 +59,19 @@ inline SLListBase::SLListBase(link* a)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline SLListBase::~SLListBase()
|
inline Foam::SLListBase::~SLListBase()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline label SLListBase::size() const
|
inline Foam::label Foam::SLListBase::size() const
|
||||||
{
|
{
|
||||||
return nElmts_;
|
return nElmts_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::link* SLListBase::first()
|
inline Foam::SLListBase::link* Foam::SLListBase::first()
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -88,7 +83,7 @@ inline SLListBase::link* SLListBase::first()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const SLListBase::link* SLListBase::first() const
|
inline const Foam::SLListBase::link* Foam::SLListBase::first() const
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -100,7 +95,7 @@ inline const SLListBase::link* SLListBase::first() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::link* SLListBase::last()
|
inline Foam::SLListBase::link* Foam::SLListBase::last()
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -112,7 +107,7 @@ inline SLListBase::link* SLListBase::last()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const SLListBase::link* SLListBase::last() const
|
inline const Foam::SLListBase::link* Foam::SLListBase::last() const
|
||||||
{
|
{
|
||||||
if (!nElmts_)
|
if (!nElmts_)
|
||||||
{
|
{
|
||||||
@ -124,14 +119,17 @@ inline const SLListBase::link* SLListBase::last() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void SLListBase::clear()
|
inline void Foam::SLListBase::clear()
|
||||||
{
|
{
|
||||||
nElmts_ = 0;
|
nElmts_ = 0;
|
||||||
last_ = 0;
|
last_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::link* SLListBase::remove(SLListBase::iterator& it)
|
inline Foam::SLListBase::link* Foam::SLListBase::remove
|
||||||
|
(
|
||||||
|
SLListBase::iterator& it
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return remove(it.curElmt_);
|
return remove(it.curElmt_);
|
||||||
}
|
}
|
||||||
@ -139,7 +137,7 @@ inline SLListBase::link* SLListBase::remove(SLListBase::iterator& it)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline SLListBase::iterator::iterator(SLListBase& s, link* elmt)
|
inline Foam::SLListBase::iterator::iterator(SLListBase& s, link* elmt)
|
||||||
:
|
:
|
||||||
curList_(s),
|
curList_(s),
|
||||||
curElmt_(elmt),
|
curElmt_(elmt),
|
||||||
@ -147,7 +145,7 @@ inline SLListBase::iterator::iterator(SLListBase& s, link* elmt)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::iterator::iterator(SLListBase& s)
|
inline Foam::SLListBase::iterator::iterator(SLListBase& s)
|
||||||
:
|
:
|
||||||
curList_(s),
|
curList_(s),
|
||||||
curElmt_(NULL),
|
curElmt_(NULL),
|
||||||
@ -155,32 +153,32 @@ inline SLListBase::iterator::iterator(SLListBase& s)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline void SLListBase::iterator::operator=(const iterator& iter)
|
inline void Foam::SLListBase::iterator::operator=(const iterator& iter)
|
||||||
{
|
{
|
||||||
curElmt_ = iter.curElmt_;
|
curElmt_ = iter.curElmt_;
|
||||||
curLink_ = iter.curLink_;
|
curLink_ = iter.curLink_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool SLListBase::iterator::operator==(const iterator& iter) const
|
inline bool Foam::SLListBase::iterator::operator==(const iterator& iter) const
|
||||||
{
|
{
|
||||||
return curElmt_ == iter.curElmt_;
|
return curElmt_ == iter.curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool SLListBase::iterator::operator!=(const iterator& iter) const
|
inline bool Foam::SLListBase::iterator::operator!=(const iterator& iter) const
|
||||||
{
|
{
|
||||||
return curElmt_ != iter.curElmt_;
|
return curElmt_ != iter.curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::link& SLListBase::iterator::operator*()
|
inline Foam::SLListBase::link& Foam::SLListBase::iterator::operator*()
|
||||||
{
|
{
|
||||||
return *curElmt_;
|
return *curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::iterator& SLListBase::iterator::operator++()
|
inline Foam::SLListBase::iterator& Foam::SLListBase::iterator::operator++()
|
||||||
{
|
{
|
||||||
if (curElmt_ == curList_.last_ || curList_.last_ == 0)
|
if (curElmt_ == curList_.last_ || curList_.last_ == 0)
|
||||||
{
|
{
|
||||||
@ -196,7 +194,7 @@ inline SLListBase::iterator& SLListBase::iterator::operator++()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::iterator SLListBase::iterator::operator++(int)
|
inline Foam::SLListBase::iterator Foam::SLListBase::iterator::operator++(int)
|
||||||
{
|
{
|
||||||
iterator tmp = *this;
|
iterator tmp = *this;
|
||||||
++*this;
|
++*this;
|
||||||
@ -204,7 +202,7 @@ inline SLListBase::iterator SLListBase::iterator::operator++(int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::iterator SLListBase::begin()
|
inline Foam::SLListBase::iterator Foam::SLListBase::begin()
|
||||||
{
|
{
|
||||||
if (size())
|
if (size())
|
||||||
{
|
{
|
||||||
@ -217,7 +215,7 @@ inline SLListBase::iterator SLListBase::begin()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const SLListBase::iterator& SLListBase::end()
|
inline const Foam::SLListBase::iterator& Foam::SLListBase::end()
|
||||||
{
|
{
|
||||||
return endIter;
|
return endIter;
|
||||||
}
|
}
|
||||||
@ -225,7 +223,7 @@ inline const SLListBase::iterator& SLListBase::end()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * STL const_iterator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * STL const_iterator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline SLListBase::const_iterator::const_iterator
|
inline Foam::SLListBase::const_iterator::const_iterator
|
||||||
(
|
(
|
||||||
const SLListBase& s,
|
const SLListBase& s,
|
||||||
const link* elmt
|
const link* elmt
|
||||||
@ -236,20 +234,23 @@ inline SLListBase::const_iterator::const_iterator
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::const_iterator::const_iterator(const iterator& iter)
|
inline Foam::SLListBase::const_iterator::const_iterator(const iterator& iter)
|
||||||
:
|
:
|
||||||
curList_(iter.curList_),
|
curList_(iter.curList_),
|
||||||
curElmt_(iter.curElmt_)
|
curElmt_(iter.curElmt_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline void SLListBase::const_iterator::operator=(const const_iterator& iter)
|
inline void Foam::SLListBase::const_iterator::operator=
|
||||||
|
(
|
||||||
|
const const_iterator& iter
|
||||||
|
)
|
||||||
{
|
{
|
||||||
curElmt_ = iter.curElmt_;
|
curElmt_ = iter.curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool SLListBase::const_iterator::operator==
|
inline bool Foam::SLListBase::const_iterator::operator==
|
||||||
(
|
(
|
||||||
const const_iterator& iter
|
const const_iterator& iter
|
||||||
) const
|
) const
|
||||||
@ -258,7 +259,7 @@ inline bool SLListBase::const_iterator::operator==
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool SLListBase::const_iterator::operator!=
|
inline bool Foam::SLListBase::const_iterator::operator!=
|
||||||
(
|
(
|
||||||
const const_iterator& iter
|
const const_iterator& iter
|
||||||
) const
|
) const
|
||||||
@ -267,13 +268,14 @@ inline bool SLListBase::const_iterator::operator!=
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const SLListBase::link& SLListBase::const_iterator::operator*()
|
inline const Foam::SLListBase::link& SLListBase::const_iterator::operator*()
|
||||||
{
|
{
|
||||||
return *curElmt_;
|
return *curElmt_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::const_iterator& SLListBase::const_iterator::operator++()
|
inline Foam::SLListBase::const_iterator&
|
||||||
|
Foam::SLListBase::const_iterator::operator++()
|
||||||
{
|
{
|
||||||
if (curElmt_ == curList_.last_)
|
if (curElmt_ == curList_.last_)
|
||||||
{
|
{
|
||||||
@ -288,7 +290,8 @@ inline SLListBase::const_iterator& SLListBase::const_iterator::operator++()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::const_iterator SLListBase::const_iterator::operator++(int)
|
inline Foam::SLListBase::const_iterator
|
||||||
|
Foam::SLListBase::const_iterator::operator++(int)
|
||||||
{
|
{
|
||||||
const_iterator tmp = *this;
|
const_iterator tmp = *this;
|
||||||
++*this;
|
++*this;
|
||||||
@ -296,7 +299,7 @@ inline SLListBase::const_iterator SLListBase::const_iterator::operator++(int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline SLListBase::const_iterator SLListBase::begin() const
|
inline Foam::SLListBase::const_iterator Foam::SLListBase::begin() const
|
||||||
{
|
{
|
||||||
if (size())
|
if (size())
|
||||||
{
|
{
|
||||||
@ -309,14 +312,10 @@ inline SLListBase::const_iterator SLListBase::begin() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const SLListBase::const_iterator& SLListBase::end() const
|
inline const Foam::SLListBase::const_iterator& Foam::SLListBase::end() const
|
||||||
{
|
{
|
||||||
return endConstIter;
|
return endConstIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user