xrootd
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 
40 {
41 public:
42 
43 //------------------------------------------------------------------------------
52 //------------------------------------------------------------------------------
53 
54 virtual char *Calc(const char *Buff, int BLen)
55  {Init(); Update(Buff, BLen); return Final();}
56 
57 //------------------------------------------------------------------------------
63 //------------------------------------------------------------------------------
64 
65 virtual char *Current() {return Final();}
66 
67 //------------------------------------------------------------------------------
72 //------------------------------------------------------------------------------
73 
74 virtual char *Final() = 0;
75 
76 //------------------------------------------------------------------------------
79 //------------------------------------------------------------------------------
80 
81 virtual void Init() = 0;
82 
83 //------------------------------------------------------------------------------
87 //------------------------------------------------------------------------------
88 virtual
89 XrdCksCalc *New() = 0;
90 
91 //------------------------------------------------------------------------------
93 //------------------------------------------------------------------------------
94 
95 virtual void Recycle() {delete this;}
96 
97 //------------------------------------------------------------------------------
105 //------------------------------------------------------------------------------
106 
107 virtual const char *Type(int &csSize) = 0;
108 
109 //------------------------------------------------------------------------------
115 //------------------------------------------------------------------------------
116 
117 virtual void Update(const char *Buff, int BLen) = 0;
118 
119 //------------------------------------------------------------------------------
121 //------------------------------------------------------------------------------
122 
124 
125 //------------------------------------------------------------------------------
127 //------------------------------------------------------------------------------
128 
129 virtual ~XrdCksCalc() {}
130 };
131 
132 /******************************************************************************/
133 /* C h e c k s u m O b j e c t C r e a t o r */
134 /******************************************************************************/
135 
136 //------------------------------------------------------------------------------
150 //------------------------------------------------------------------------------
151 
158 //------------------------------------------------------------------------------
164 //------------------------------------------------------------------------------
165 
171 #endif
virtual void Recycle()
Recycle the checksum object as it is no longer needed. A default is given.
Definition: XrdCksCalc.hh:95
virtual char * Final()=0
Definition: XrdCksCalc.hh:39
virtual void Init()=0
virtual ~XrdCksCalc()
Destructor.
Definition: XrdCksCalc.hh:129
virtual char * Calc(const char *Buff, int BLen)
Definition: XrdCksCalc.hh:54
virtual XrdCksCalc * New()=0
virtual const char * Type(int &csSize)=0
XrdCksCalc()
Constructor.
Definition: XrdCksCalc.hh:123
virtual void Update(const char *Buff, int BLen)=0
virtual char * Current()
Definition: XrdCksCalc.hh:65