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