xrootd
XrdClCheckSumManager.hh
Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 // Copyright (c) 2012 by European Organization for Nuclear Research (CERN)
00003 // Author: Lukasz Janyst <ljanyst@cern.ch>
00004 //------------------------------------------------------------------------------
00005 // XRootD is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU Lesser General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // XRootD is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public License
00016 // along with XRootD.  If not, see <http://www.gnu.org/licenses/>.
00017 //------------------------------------------------------------------------------
00018 
00019 #ifndef __XRD_CL_CHECK_SUM_MANAGER_HH__
00020 #define __XRD_CL_CHECK_SUM_MANAGER_HH__
00021 
00022 #include <map>
00023 #include <string>
00024 #include "XrdSys/XrdSysPthread.hh"
00025 #include "XrdCks/XrdCksData.hh"
00026 
00027 class XrdCksLoader;
00028 class XrdCksCalc;
00029 
00030 namespace XrdCl
00031 {
00032   //----------------------------------------------------------------------------
00034   //----------------------------------------------------------------------------
00035   class CheckSumManager
00036   {
00037     public:
00038       //------------------------------------------------------------------------
00040       //------------------------------------------------------------------------
00041       CheckSumManager();
00042 
00043       //------------------------------------------------------------------------
00044       // Destructor
00045       //------------------------------------------------------------------------
00046       virtual ~CheckSumManager();
00047 
00048       //------------------------------------------------------------------------
00054       //------------------------------------------------------------------------
00055       XrdCksCalc *GetCalculator( const std::string &algName );
00056 
00057       //------------------------------------------------------------------------
00059       //------------------------------------------------------------------------
00060       bool Calculate( XrdCksData        &result,
00061                       const std::string &algName,
00062                       const std::string &filePath );
00063 
00064     private:
00065       typedef std::map<std::string, XrdCksCalc*> CalcMap;
00066       CalcMap       pCalculators;
00067       XrdCksLoader *pLoader;
00068       XrdSysMutex   pMutex;
00069   };
00070 }
00071 
00072 #endif // __XRD_CL_CHECK_SUM_MANAGER_HH__