XRootD
Loading...
Searching...
No Matches
XrdCksCalc.hh
Go to the documentation of this file.
1#ifndef __XRDCKSCALC_HH__
2#define __XRDCKSCALC_HH__
3/******************************************************************************/
4/* */
5/* X r d C k s C a l c . h h */
6/* */
7/* (c) 2011 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* All Rights Reserved */
9/* Produced by Andrew Hanushevsky for Stanford University under contract */
10/* DE-AC02-76-SFO0515 with the Department of Energy */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
38
40{
41public:
42
43//------------------------------------------------------------------------------
52//------------------------------------------------------------------------------
53
54virtual char *Calc(const char *Buff, int BLen)
55 {Init(); Update(Buff, BLen); return Final();}
56
57//------------------------------------------------------------------------------
65//------------------------------------------------------------------------------
66
67virtual bool Combinable() {return false;}
68
69//------------------------------------------------------------------------------
82//------------------------------------------------------------------------------
83
84virtual
85const char* Combine(const char *Cksum, int DLen) {return 0;};
86
87//------------------------------------------------------------------------------
101//------------------------------------------------------------------------------
102
103virtual
104const char* Combine(const char* Cksum1, const char* Cksum2, int DLen)
105 {return 0;};
106
107//------------------------------------------------------------------------------
113//------------------------------------------------------------------------------
114
115virtual char *Current() {return Final();}
116
117//------------------------------------------------------------------------------
122//------------------------------------------------------------------------------
123
124virtual char *Final() = 0;
125
126//------------------------------------------------------------------------------
129//------------------------------------------------------------------------------
130
131virtual void Init() = 0;
132
133//------------------------------------------------------------------------------
137//------------------------------------------------------------------------------
138virtual
140
141//------------------------------------------------------------------------------
143//------------------------------------------------------------------------------
144
145virtual void Recycle() {delete this;}
146
147//------------------------------------------------------------------------------
155//------------------------------------------------------------------------------
156
157virtual const char *Type(int &csSize) = 0;
158
159//------------------------------------------------------------------------------
165//------------------------------------------------------------------------------
166
167virtual void Update(const char *Buff, int BLen) = 0;
168
169//------------------------------------------------------------------------------
171//------------------------------------------------------------------------------
172
174
175//------------------------------------------------------------------------------
177//------------------------------------------------------------------------------
178
179virtual ~XrdCksCalc() {}
180};
181
182/******************************************************************************/
183/* C h e c k s u m O b j e c t C r e a t o r */
184/******************************************************************************/
185
186//------------------------------------------------------------------------------
200//------------------------------------------------------------------------------
201
207
208//------------------------------------------------------------------------------
214//------------------------------------------------------------------------------
215
221#endif
virtual bool Combinable()
Definition XrdCksCalc.hh:67
virtual void Update(const char *Buff, int BLen)=0
virtual const char * Combine(const char *Cksum, int DLen)
Definition XrdCksCalc.hh:85
virtual char * Current()
virtual const char * Combine(const char *Cksum1, const char *Cksum2, int DLen)
virtual void Recycle()
Recycle the checksum object as it is no longer needed. A default is given.
virtual XrdCksCalc * New()=0
virtual char * Calc(const char *Buff, int BLen)
Definition XrdCksCalc.hh:54
virtual void Init()=0
virtual const char * Type(int &csSize)=0
virtual ~XrdCksCalc()
Destructor.
virtual char * Final()=0
XrdCksCalc()
Constructor.