STYLE: promote ListPolicy to Foam namespace

- previously under Foam::Detail::ListPolicy, now as Foam::ListPolicy
This commit is contained in:
Mark Olesen 2025-04-03 14:51:41 +02:00
parent eb56c75c4b
commit f13a05375c
17 changed files with 32 additions and 39 deletions

View File

@ -1,3 +1,3 @@
Test-List.C
Test-List.cxx
EXE = $(FOAM_USER_APPBIN)/Test-List

View File

@ -75,8 +75,6 @@ public:
namespace Detail
{
namespace ListPolicy
{
@ -84,7 +82,6 @@ namespace ListPolicy
template<> struct short_length<short> : std::integral_constant<int,20> {};
} // End namespace ListPolicy
} // End namespace Detail
} // End namespace Foam
@ -119,9 +116,9 @@ Ostream& printListOutputType(const char* what)
Info<< what
<< " (contiguous="
<< is_contiguous_v<T> << " no_linebreak="
<< Detail::ListPolicy::no_linebreak<T>::value
<< ListPolicy::no_linebreak<T>::value
<< " short_length="
<< Detail::ListPolicy::short_length<T>::value << ')';
<< ListPolicy::short_length<T>::value << ')';
return Info;
}

View File

@ -610,11 +610,11 @@ struct Hash<PackedList<Width>> : PackedList<Width>::hasher {};
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
//- Write List to Ostream, as per UList::writeList() with default length.
// The default short-length is given by Detail::ListPolicy::short_length
// The default short-length is given by Foam::ListPolicy::short_length
template<unsigned Width>
Ostream& operator<<(Ostream& os, const PackedList<Width>& list)
{
return list.writeList(os, Detail::ListPolicy::short_length<void>::value);
return list.writeList(os, Foam::ListPolicy::short_length<void>::value);
}

View File

@ -136,7 +136,7 @@ Foam::Ostream& Foam::CircularBuffer<T>::writeList
||
(
(len <= shortLen)
&& (is_contiguous_v<T> || Detail::ListPolicy::no_linebreak<T>::value)
&& (is_contiguous_v<T> || Foam::ListPolicy::no_linebreak<T>::value)
)
)
{

View File

@ -542,7 +542,7 @@ Istream& operator>>(Istream& is, CompactListList<T>& list)
template<class T>
Ostream& operator<<(Ostream& os, const CompactListList<T>& list)
{
return list.writeList(os, Detail::ListPolicy::short_length<T>::value);
return list.writeList(os, Foam::ListPolicy::short_length<T>::value);
}

View File

@ -379,7 +379,7 @@ Foam::HashSet<Key, Hash>::operator-=(const HashSet<Key, Hash>& rhs)
template<class Key, class Hash>
Foam::Ostream& Foam::operator<<(Ostream& os, const HashSet<Key, Hash>& rhs)
{
return rhs.writeKeys(os, Detail::ListPolicy::short_length<Key>::value);
return rhs.writeKeys(os, Foam::ListPolicy::short_length<Key>::value);
}

View File

@ -397,11 +397,11 @@ public:
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
//- Write List to Ostream, as per UList::writeList() with default length.
// The default short-length is given by Detail::ListPolicy::short_length
// The default short-length is given by Foam::ListPolicy::short_length
template<class T, class Addr>
Ostream& operator<<(Ostream& os, const IndirectListBase<T, Addr>& list)
{
return list.writeList(os, Detail::ListPolicy::short_length<T>::value);
return list.writeList(os, Foam::ListPolicy::short_length<T>::value);
}

View File

@ -80,7 +80,7 @@ Foam::Ostream& Foam::IndirectListBase<T, Addr>::writeList
||
(
(len <= shortLen)
&& (is_contiguous_v<T> || Detail::ListPolicy::no_linebreak<T>::value)
&& (is_contiguous_v<T> || Foam::ListPolicy::no_linebreak<T>::value)
)
)
{

View File

@ -594,11 +594,11 @@ Istream& operator>>(Istream& is, FixedList<T, N>& list)
//- Write List to Ostream, as per FixedList::writeList() with default length.
// The default short-length is given by Detail::ListPolicy::short_length
// The default short-length is given by Foam::ListPolicy::short_length
template<class T, unsigned N>
Ostream& operator<<(Ostream& os, const FixedList<T, N>& list)
{
return list.writeList(os, Detail::ListPolicy::short_length<T>::value);
return list.writeList(os, Foam::ListPolicy::short_length<T>::value);
}

View File

@ -106,7 +106,7 @@ Foam::Ostream& Foam::FixedList<T, N>::writeList
||
(
(N <= unsigned(shortLen))
&& (is_contiguous_v<T> || Detail::ListPolicy::no_linebreak<T>::value)
&& (is_contiguous_v<T> || Foam::ListPolicy::no_linebreak<T>::value)
)
)
{

View File

@ -682,11 +682,11 @@ Istream& operator>>(Istream& is, UList<T>& list)
//- Write List to Ostream, as per UList::writeList() with default length.
// The default short-length is given by Detail::ListPolicy::short_length
// The default short-length is given by Foam::ListPolicy::short_length
template<class T>
Ostream& operator<<(Ostream& os, const UList<T>& list)
{
return list.writeList(os, Detail::ListPolicy::short_length<T>::value);
return list.writeList(os, Foam::ListPolicy::short_length<T>::value);
}
//- Write std::vector to Ostream. ASCII only, no line-breaks

View File

@ -127,7 +127,7 @@ Foam::Ostream& Foam::UList<T>::writeList
||
(
(len <= shortLen)
&& (is_contiguous_v<T> || Detail::ListPolicy::no_linebreak<T>::value)
&& (is_contiguous_v<T> || Foam::ListPolicy::no_linebreak<T>::value)
)
)
{

View File

@ -24,7 +24,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Namespace
Foam::Detail::ListPolicy
Foam::ListPolicy
Description
Additional compile-time controls of List behaviour
@ -46,8 +46,6 @@ class keyType;
class word;
class wordRe;
namespace Detail
{
namespace ListPolicy
{
@ -126,7 +124,6 @@ enum uniformity check_uniformity(InputIt first, InputIt last)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace ListPolicy
} // End namespace Detail
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -34,7 +34,7 @@ bool Foam::expressions::exprValueFieldTag::empty() const noexcept
{
return
(
uniformity_ == Foam::Detail::ListPolicy::uniformity::EMPTY
uniformity_ == Foam::ListPolicy::uniformity::EMPTY
);
}
@ -43,7 +43,7 @@ bool Foam::expressions::exprValueFieldTag::is_uniform() const noexcept
{
return
(
uniformity_ == Foam::Detail::ListPolicy::uniformity::UNIFORM
uniformity_ == Foam::ListPolicy::uniformity::UNIFORM
);
}
@ -52,9 +52,9 @@ bool Foam::expressions::exprValueFieldTag::is_nonuniform() const noexcept
{
return
(
uniformity_ == Foam::Detail::ListPolicy::uniformity::NONUNIFORM
uniformity_ == Foam::ListPolicy::uniformity::NONUNIFORM
// Extra safety for direct reductions?
// || uniformity_ == Foam::Detail::ListPolicy::uniformity::MIXED
// || uniformity_ == Foam::ListPolicy::uniformity::MIXED
);
}
@ -68,14 +68,14 @@ Foam::expressions::exprValueFieldTag::value() const noexcept
void Foam::expressions::exprValueFieldTag::set_empty()
{
uniformity_ = Foam::Detail::ListPolicy::uniformity::EMPTY;
uniformity_ = Foam::ListPolicy::uniformity::EMPTY;
value_ = Foam::zero{};
}
void Foam::expressions::exprValueFieldTag::set_nouniform()
{
uniformity_ = Foam::Detail::ListPolicy::uniformity::NONUNIFORM;
uniformity_ = Foam::ListPolicy::uniformity::NONUNIFORM;
value_ = Foam::zero{};
}
@ -145,7 +145,7 @@ void Foam::expressions::exprValueFieldTag::reduce()
(
shape == static_cast<bitmask_type>
(
Foam::Detail::ListPolicy::uniformity::EMPTY
Foam::ListPolicy::uniformity::EMPTY
)
)
{
@ -156,7 +156,7 @@ void Foam::expressions::exprValueFieldTag::reduce()
(
shape == static_cast<bitmask_type>
(
Foam::Detail::ListPolicy::uniformity::UNIFORM
Foam::ListPolicy::uniformity::UNIFORM
)
)
{

View File

@ -57,7 +57,7 @@ class exprValueFieldTag
// Private Data
//- Uniformity of field (0: empty, 1: uniform, 2: non-uniform, ...)
// Values as per internal enum Foam::Detail::ListPolicy::uniformity
// Values as per internal enum Foam::ListPolicy::uniformity
int uniformity_{};
//- Representative (uniform) type/value for the field
@ -134,8 +134,7 @@ public:
template<class Type>
void set(const Type* first, const Type* last)
{
uniformity_ =
Foam::Detail::ListPolicy::check_uniformity(first, last);
uniformity_ = Foam::ListPolicy::check_uniformity(first, last);
if (first != last) // or uniformity_ != EMPTY
{
@ -152,7 +151,7 @@ public:
template<class Type>
void set_value(const Type& val)
{
uniformity_ = Foam::Detail::ListPolicy::uniformity::UNIFORM;
uniformity_ = Foam::ListPolicy::uniformity::UNIFORM;
value_.set<Type>(val);
}

View File

@ -621,11 +621,11 @@ Istream& operator>>(Istream& is, Matrix<Form, Type>& mat)
//- Write Matrix to Ostream, as per Matrix::writeMatrix() with
//- default length, which is given by Detail::ListPolicy::short_length
//- default length, which is given by Foam::ListPolicy::short_length
template<class Form, class Type>
Ostream& operator<<(Ostream& os, const Matrix<Form, Type>& mat)
{
return mat.writeMatrix(os, Detail::ListPolicy::short_length<Type>::value);
return mat.writeMatrix(os, Foam::ListPolicy::short_length<Type>::value);
}

View File

@ -395,7 +395,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const labelRanges& list)
return list.writeList
(
os,
Detail::ListPolicy::short_length<labelRange>::value
Foam::ListPolicy::short_length<labelRange>::value
);
}