PALISADE Lattice Crypto Library  1.11.9
A lattice crypto library for software engineers by software engineers.
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
lbcrypto::MetadataTest Class Reference

Example class inheriting from Metadata and adding a member. This is used in unit tests. More...

#include <metadata.h>

Inheritance diagram for lbcrypto::MetadataTest:
Inheritance graph
[legend]
Collaboration diagram for lbcrypto::MetadataTest:
Collaboration graph
[legend]

Public Member Functions

 MetadataTest ()
 
virtual ~MetadataTest ()
 
 MetadataTest (const MetadataTest &mdata)
 
std::shared_ptr< MetadataClone () const
 
void SetMetadata (string str)
 
string GetMetadata () const
 
bool operator== (const Metadata &mdata) const
 
std::ostream & print (std::ostream &out) const
 
template<class Archive >
void save (Archive &ar, std::uint32_t const version) const
 
template<class Archive >
void load (Archive &ar, std::uint32_t const version)
 

Static Public Member Functions

template<class Element >
static const shared_ptr< MetadataTestCloneMetadata (ConstCiphertext< Element > ciphertext)
 
template<class Element >
static const shared_ptr< MetadataTestGetMetadata (ConstCiphertext< Element > ciphertext)
 
template<class Element >
static void StoreMetadata (Ciphertext< Element > ciphertext, shared_ptr< MetadataTest > mdata)
 

Protected Attributes

string m_s
 

Detailed Description

Example class inheriting from Metadata and adding a member. This is used in unit tests.

Constructor & Destructor Documentation

◆ MetadataTest() [1/2]

lbcrypto::MetadataTest::MetadataTest ( )
inline

Default constructor

◆ ~MetadataTest()

virtual lbcrypto::MetadataTest::~MetadataTest ( )
inlinevirtual

Destructor

◆ MetadataTest() [2/2]

lbcrypto::MetadataTest::MetadataTest ( const MetadataTest mdata)
inline

Copy constructor

Member Function Documentation

◆ 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
ciphertextthe 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
ciphertextthe 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
ciphertextthe ciphertext whose metadata to retrieve.

The documentation for this class was generated from the following file: