ATLAS Offline Software
Loading...
Searching...
No Matches
Database
IOVDbSvc
src
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
18
base64Encode
(
const
coral::Blob & blob){
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
25
coral::Blob
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
}
base64.h
CxxUtils::base64_decode
std::vector< unsigned char > base64_decode(const std::string &)
Definition
base64.cxx:97
CxxUtils::base64_encode
std::string base64_encode(const unsigned char *, unsigned int)
Definition
base64.cxx:55
IOVDbNamespace
Definition
Base64Codec.cxx:16
IOVDbNamespace::base64Decode
coral::Blob base64Decode(const std::string &base64String)
Definition
Base64Codec.cxx:26
IOVDbNamespace::base64Encode
std::string base64Encode(const coral::Blob &blob)
Definition
Base64Codec.cxx:18
Generated on
for ATLAS Offline Software by
1.14.0