ATLAS Offline Software
Base64Codec.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 // @file Base64Codec.cxx
5 // Header for base64 encoding/decoding functions
6 // @author Shaun Roe
7 // @date November 2019
8 
9 #include "CoralBase/Blob.h"
10 #include "CxxUtils/base64.h"
11 
12 #include <cstring> //memcpy
13 
14 
15 
16 namespace IOVDbNamespace{
17  std::string
19  //Blob::startingAddress returns a const void *, so cast to byte size
20  const auto *const address = static_cast<const unsigned char *>(blob.startingAddress());
21  const unsigned int nBytes = blob.size();
22  return CxxUtils::base64_encode(address, nBytes);
23  }
24 
26  base64Decode(const std::string & base64String){
27  const auto &charVec = CxxUtils::base64_decode(base64String);
28  coral::Blob blob(charVec.size());
29  memcpy(blob.startingAddress(), charVec.data(), charVec.size());
30  return blob;
31  }
32 }
IOVDbNamespace::base64Encode
std::string base64Encode(const coral::Blob &blob)
Definition: Base64Codec.cxx:18
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
IOVDbNamespace::base64Decode
coral::Blob base64Decode(const std::string &base64String)
Definition: Base64Codec.cxx:26
CxxUtils::base64_decode
std::vector< unsigned char > base64_decode(const std::string &)
Definition: base64.cxx:97
base64.h
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
CxxUtils::base64_encode
std::string base64_encode(const unsigned char *, unsigned int)
Definition: base64.cxx:55
CaloCondBlobAlgs_fillNoiseFromASCII.blob
blob
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:96
IOVDbNamespace
Definition: Base64Codec.cxx:16