14 #ifndef LBCRYPTO_CRYPTO_METADATA_H 15 #define LBCRYPTO_CRYPTO_METADATA_H 43 virtual std::shared_ptr<Metadata>
Clone()
const {
44 return std::make_shared<Metadata>();
59 return !(*
this == mdata);
66 virtual std::ostream&
print(std::ostream& out)
const {
67 out <<
"[ ]" << std::endl;
83 template <
class Archive>
84 void save(Archive& ar, std::uint32_t
const version)
const {}
89 template <
class Archive>
90 void load(Archive& ar, std::uint32_t
const version) {
93 "serialized object version " + std::to_string(version) +
94 " is from a later version of the library");
141 std::shared_ptr<Metadata>
Clone()
const {
142 auto mdata = std::make_shared<MetadataTest>();
143 mdata->m_s = this->m_s;
165 }
catch (
const std::bad_cast& e) {
168 "Tried to downcast an object of different class to MetadataTest");
175 std::ostream&
print(std::ostream& out)
const {
176 out <<
"[ " << m_s <<
" ]";
183 template <
class Archive>
184 void save(Archive& ar, std::uint32_t
const version)
const {
185 ar(cereal::base_class<Metadata>(
this));
186 ar(cereal::make_nvp(
"str", m_s));
192 template <
class Archive>
193 void load(Archive& ar, std::uint32_t
const version) {
196 "serialized object version " + std::to_string(version) +
197 " is from a later version of the library");
199 ar(cereal::base_class<Metadata>(
this));
200 ar(cereal::make_nvp(
"str", m_s));
210 template <
class Element>
212 ConstCiphertext<Element> ciphertext) {
213 auto it = ciphertext->FindMetadataByKey(
"test");
215 if (ciphertext->MetadataFound(it)) {
217 ciphertext->GetMetadata(it)->Clone());
221 "Attempt to access metadata (MetadataTest) that has not been set.");
233 template <
class Element>
235 ConstCiphertext<Element> ciphertext) {
236 auto it = ciphertext->FindMetadataByKey(
"test");
238 if (ciphertext->MetadataFound(it)) {
240 ciphertext->GetMetadata(it));
244 "Attempt to access metadata (MetadataTest) that has not been set.");
263 template <
class Element>
265 shared_ptr<MetadataTest> mdata) {
266 ciphertext->SetMetadataByKey(
"test", mdata);
Definition: exception.h:147
Definition: binfhecontext.h:36
Definition: exception.h:90