Example class inheriting from Metadata and adding a member. This is used in unit tests.
More...
#include <metadata.h>
Example class inheriting from Metadata and adding a member. This is used in unit tests.
◆ MetadataTest() [1/2]
lbcrypto::MetadataTest::MetadataTest |
( |
| ) |
|
|
inline |
◆ ~MetadataTest()
virtual lbcrypto::MetadataTest::~MetadataTest |
( |
| ) |
|
|
inlinevirtual |
◆ MetadataTest() [2/2]
lbcrypto::MetadataTest::MetadataTest |
( |
const MetadataTest & |
mdata | ) |
|
|
inline |
◆ Clone()
std::shared_ptr<Metadata> lbcrypto::MetadataTest::Clone |
( |
| ) |
const |
|
inlinevirtual |
This method creates a new MetadataTest object.
Since Ciphertexts have a map of shared_ptr<Metadata>, whenever we retrieve the contents of the map, we actually get the shared pointer and we do not create a new object.
If we do want to create a new object (e.g., because we want to modify it only for a new Ciphertext), we can use the Clone method.
Reimplemented from lbcrypto::Metadata.
◆ CloneMetadata()
template<class Element >
static const shared_ptr<MetadataTest> lbcrypto::MetadataTest::CloneMetadata |
( |
ConstCiphertext< Element > |
ciphertext | ) |
|
|
inlinestatic |
This static method retrieves a MetadataTest object from a Ciphertext, and clones it so we can further modify it.
- Parameters
-
ciphertext | the ciphertext whose metadata to retrieve. |
◆ GetMetadata() [1/2]
string lbcrypto::MetadataTest::GetMetadata |
( |
| ) |
const |
|
inline |
This method returns the (only) value stored in this Metadata container
◆ GetMetadata() [2/2]
template<class Element >
static const shared_ptr<MetadataTest> lbcrypto::MetadataTest::GetMetadata |
( |
ConstCiphertext< Element > |
ciphertext | ) |
|
|
inlinestatic |
This static method retrieves a MetadataTest object from a Ciphertext, without cloning it. This means that any modifications on the MetadataTest object will affect the original Ciphertext we retrieved the metadata from.
- Parameters
-
ciphertext | the ciphertext whose metadata to retrieve. |
◆ load()
template<class Archive >
void lbcrypto::MetadataTest::load |
( |
Archive & |
ar, |
|
|
std::uint32_t const |
version |
|
) |
| |
|
inline |
load method for serialization
◆ operator==()
bool lbcrypto::MetadataTest::operator== |
( |
const Metadata & |
mdata | ) |
const |
|
inlinevirtual |
Defines how to check equality between objects of this class.
Reimplemented from lbcrypto::Metadata.
◆ print()
std::ostream& lbcrypto::MetadataTest::print |
( |
std::ostream & |
out | ) |
const |
|
inlinevirtual |
Defines how to print the contents of objects of this class.
Reimplemented from lbcrypto::Metadata.
◆ save()
template<class Archive >
void lbcrypto::MetadataTest::save |
( |
Archive & |
ar, |
|
|
std::uint32_t const |
version |
|
) |
| const |
|
inline |
save method for serialization
◆ SetMetadata()
void lbcrypto::MetadataTest::SetMetadata |
( |
string |
str | ) |
|
|
inline |
Setter method for the only value stored in this Metadata container.
◆ StoreMetadata()
template<class Element >
static void lbcrypto::MetadataTest::StoreMetadata |
( |
Ciphertext< Element > |
ciphertext, |
|
|
shared_ptr< MetadataTest > |
mdata |
|
) |
| |
|
inlinestatic |
This static method stores a MetadataTest object to a Ciphertext. If the Ciphertext already has another MetadataTest object stored in its map, it will get overwritten by this MetadataTest object.
Whenever we want to modify the metadata of a ciphertext, it is recommended to (1) clone the MetadataTest object from another ciphertext or create a new MetadataTest object with make_shared<MetadataTest>(), (2) modify it using the Setter methods of MetadataTest, and (3) store it to the ciphertext we want using this method.
- Parameters
-
ciphertext | the ciphertext whose metadata to retrieve. |
The documentation for this class was generated from the following file: