1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 An output stream for calculating SHA1 digests.
33 \*---------------------------------------------------------------------------*/
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Class sha1streambuf Declaration
51 \*---------------------------------------------------------------------------*/
53 //- A streambuf class for calculating SHA1 digests
60 //- This does all the work and has its own buffering
63 friend class osha1stream;
77 //- Process unbuffered
78 virtual std::streamsize xsputn(const char* str, std::streamsize n)
86 /*---------------------------------------------------------------------------*\
87 Class osha1stream Declaration
88 \*---------------------------------------------------------------------------*/
90 //- A basic output stream for calculating SHA1 digests
93 virtual public std::ios,
114 //- This hides both signatures of std::basic_ios::rdbuf()
115 sha1streambuf* rdbuf()
120 //- Full access to the sha1
129 /*---------------------------------------------------------------------------*\
130 Class OSHA1stream Declaration
131 \*---------------------------------------------------------------------------*/
133 //- The output stream for calculating SHA1 digests
139 // Private Member Functions
141 //- Disallow default bitwise copy construct
142 OSHA1stream(const OSHA1stream&);
144 //- Disallow default bitwise assignment
145 void operator=(const OSHA1stream&);
151 //- Construct and set stream status
154 streamFormat format=ASCII,
155 versionNumber version=currentVersion
161 "OSHA1stream.sinkFile_",
171 delete &dynamic_cast<osha1stream&>(stdStream());
179 //- Full access to the sha1
182 return dynamic_cast<osha1stream&>(stdStream()).sha1();
185 //- Return SHA1::Digest for the data processed until now
186 Foam::SHA1Digest digest()
188 return sha1().digest();
193 //- Clear the SHA1 calculation
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 } // End namespace Foam
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 // ************************************************************************* //