Files
openfoam/src/OpenFOAM/primitives/ints/uint16/uint16.H
Mark Olesen d88272f031 ENH: relocate zero_one to pTraits, allows reuse for scalar clamping
ENH: add pTraits and IO for std::int8_t

STYLE: cull some implicitly available includes

- pTraits.H is included by label/scalar etc
- zero.H is included by UList

STYLE: cull redundant forward declarations for Istream/Ostream
2023-02-27 15:41:25 +01:00

86 lines
2.5 KiB
C++

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Primitive
uint16_t
Description
16bit unsigned integer. I/O is done as an int32.
SourceFiles
uint16.C
\*---------------------------------------------------------------------------*/
#ifndef Foam_primitives_uint16_H
#define Foam_primitives_uint16_H
#include <cstdint>
#include "direction.H"
#include "pTraits.H"
#include "word.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- A word representation of uint16 value
inline word name(const uint16_t val)
{
return word(std::to_string(int(val)), false); // Needs no stripping
}
//- A word representation of uint16 value
template<>
struct nameOp<uint16_t>
{
word operator()(const uint16_t val) const
{
return word(std::to_string(int(val)), false); // Needs no stripping
}
};
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Istream& operator>>(Istream& is, uint16_t& val);
Ostream& operator<<(Ostream& os, const uint16_t val);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //