Browse Source

Minor improvements

Hovsep Papoyan 1 year ago
parent
commit
6c3c556c36

+ 8 - 7
src/AssociativeContainerOfOpaqueTypes.cc

@@ -4,26 +4,27 @@ namespace openfhe
 {
 
 UnorderedMapFromIndexToDCRTPoly::UnorderedMapFromIndexToDCRTPoly(
-    std::unordered_map<uint32_t, lbcrypto::DCRTPoly> indexToDCRTPolyUnorderedMap)
+    std::unordered_map<uint32_t, lbcrypto::DCRTPoly>&& indexToDCRTPolyUnorderedMap) noexcept
     : m_indexToDCRTPolyUnorderedMap(std::move(indexToDCRTPolyUnorderedMap))
 { }
-std::unordered_map<uint32_t, lbcrypto::DCRTPoly>& UnorderedMapFromIndexToDCRTPoly::GetInternal()
+std::unordered_map<uint32_t, lbcrypto::DCRTPoly>&
+    UnorderedMapFromIndexToDCRTPoly::GetInternal() noexcept
 {
     return m_indexToDCRTPolyUnorderedMap;
 }
 
 MapFromIndexToEvalKey::MapFromIndexToEvalKey(
-    const std::shared_ptr<std::map<uint32_t, std::shared_ptr<EvalKeyImpl>>>
-    sharedPtrToindexToEvalKeyDCRTPolyMap)
-    : m_sharedPtrToindexToEvalKeyDCRTPolyMap(sharedPtrToindexToEvalKeyDCRTPolyMap)
+    std::shared_ptr<std::map<uint32_t, std::shared_ptr<EvalKeyImpl>>>&&
+    sharedPtrToindexToEvalKeyDCRTPolyMap) noexcept
+    : m_sharedPtrToindexToEvalKeyDCRTPolyMap(std::move(sharedPtrToindexToEvalKeyDCRTPolyMap))
 { }
 const std::map<uint32_t, std::shared_ptr<EvalKeyImpl>>&
-    MapFromIndexToEvalKey::GetInternalMap() const
+    MapFromIndexToEvalKey::GetInternalMap() const noexcept
 {
     return *m_sharedPtrToindexToEvalKeyDCRTPolyMap;
 }
 std::shared_ptr<std::map<uint32_t, std::shared_ptr<EvalKeyImpl>>>
-    MapFromIndexToEvalKey::GetInternal() const
+    MapFromIndexToEvalKey::GetInternal() const noexcept
 {
     return m_sharedPtrToindexToEvalKeyDCRTPolyMap;
 }

+ 8 - 8
src/AssociativeContainerOfOpaqueTypes.h

@@ -18,9 +18,9 @@ class UnorderedMapFromIndexToDCRTPoly final
 {
     std::unordered_map<uint32_t, lbcrypto::DCRTPoly> m_indexToDCRTPolyUnorderedMap;
 public:
-    explicit UnorderedMapFromIndexToDCRTPoly(
-        std::unordered_map<uint32_t, lbcrypto::DCRTPoly> indexToDCRTPolyUnorderedMap);
-    [[nodiscard]] std::unordered_map<uint32_t, lbcrypto::DCRTPoly>& GetInternal();
+    UnorderedMapFromIndexToDCRTPoly(
+        std::unordered_map<uint32_t, lbcrypto::DCRTPoly>&& indexToDCRTPolyUnorderedMap) noexcept;
+    [[nodiscard]] std::unordered_map<uint32_t, lbcrypto::DCRTPoly>& GetInternal() noexcept;
 };
 
 using EvalKeyImpl = lbcrypto::EvalKeyImpl<lbcrypto::DCRTPoly>;
@@ -30,12 +30,12 @@ class MapFromIndexToEvalKey final
     std::shared_ptr<std::map<uint32_t, std::shared_ptr<EvalKeyImpl>>>
         m_sharedPtrToindexToEvalKeyDCRTPolyMap;
 public:
-    explicit MapFromIndexToEvalKey(
-        const std::shared_ptr<std::map<uint32_t, std::shared_ptr<EvalKeyImpl>>>
-        indexToEvalKeyDCRTPolyMap);
-    [[nodiscard]] const std::map<uint32_t, std::shared_ptr<EvalKeyImpl>>& GetInternalMap() const;
+    MapFromIndexToEvalKey(std::shared_ptr<std::map<uint32_t, std::shared_ptr<EvalKeyImpl>>>&&
+        indexToEvalKeyDCRTPolyMap) noexcept;
+    [[nodiscard]] const std::map<uint32_t, std::shared_ptr<EvalKeyImpl>>&
+        GetInternalMap() const noexcept;
     [[nodiscard]] std::shared_ptr<std::map<uint32_t, std::shared_ptr<EvalKeyImpl>>>
-	      GetInternal() const;
+        GetInternal() const noexcept;
 };
 
 class MapFromStringToVectorOfEvalKeys final

+ 3 - 3
src/Ciphertext.cc

@@ -5,10 +5,10 @@
 namespace openfhe
 {
 
-CiphertextDCRTPoly::CiphertextDCRTPoly(const std::shared_ptr<CiphertextImpl>& ciphertext)
-    : m_ciphertext(ciphertext)
+CiphertextDCRTPoly::CiphertextDCRTPoly(std::shared_ptr<CiphertextImpl>&& ciphertext) noexcept
+    : m_ciphertext(std::move(ciphertext))
 { }
-std::shared_ptr<CiphertextImpl> CiphertextDCRTPoly::GetInternal() const
+std::shared_ptr<CiphertextImpl> CiphertextDCRTPoly::GetInternal() const noexcept
 {
     return m_ciphertext;
 }

+ 2 - 2
src/Ciphertext.h

@@ -20,13 +20,13 @@ public:
         CiphertextDCRTPoly& ciphertext, const SerialMode serialMode);
 
     CiphertextDCRTPoly() = default;
-    explicit CiphertextDCRTPoly(const std::shared_ptr<CiphertextImpl>& ciphertext);
+    CiphertextDCRTPoly(std::shared_ptr<CiphertextImpl>&& ciphertext) noexcept;
     CiphertextDCRTPoly(const CiphertextDCRTPoly&) = delete;
     CiphertextDCRTPoly(CiphertextDCRTPoly&&) = delete;
     CiphertextDCRTPoly& operator=(const CiphertextDCRTPoly&) = delete;
     CiphertextDCRTPoly& operator=(CiphertextDCRTPoly&&) = delete;
 
-    [[nodiscard]] std::shared_ptr<CiphertextImpl> GetInternal() const;
+    [[nodiscard]] std::shared_ptr<CiphertextImpl> GetInternal() const noexcept;
 };
 
 // Generator functions

+ 3 - 3
src/CryptoContext.cc

@@ -549,7 +549,7 @@ std::unique_ptr<DecryptResult> CryptoContextDCRTPoly::DecryptByPrivateKeyAndCiph
     std::shared_ptr<PlaintextImpl> p;
     std::unique_ptr<DecryptResult> res = std::make_unique<DecryptResult>(
     m_cryptoContextImplSharedPtr->Decrypt(privateKey.GetInternal(), ciphertext.GetInternal(), &p));
-    plaintext = p;
+    plaintext = std::move(p);
     return res;
 }
 std::unique_ptr<DecryptResult> CryptoContextDCRTPoly::DecryptByCiphertextAndPrivateKey(
@@ -559,7 +559,7 @@ std::unique_ptr<DecryptResult> CryptoContextDCRTPoly::DecryptByCiphertextAndPriv
     std::shared_ptr<PlaintextImpl> p;
     std::unique_ptr<DecryptResult> res = std::make_unique<DecryptResult>(
     m_cryptoContextImplSharedPtr->Decrypt(ciphertext.GetInternal(), privateKey.GetInternal(), &p));
-    plaintext = p;
+    plaintext = std::move(p);
     return res;
 }
 std::unique_ptr<DecryptResult> CryptoContextDCRTPoly::MultipartyDecryptFusion(
@@ -568,7 +568,7 @@ std::unique_ptr<DecryptResult> CryptoContextDCRTPoly::MultipartyDecryptFusion(
     std::shared_ptr<PlaintextImpl> p;
     std::unique_ptr<DecryptResult> res = std::make_unique<DecryptResult>(
     m_cryptoContextImplSharedPtr->MultipartyDecryptFusion(partialCiphertextVec.GetInternal(), &p));
-    plaintext = p;
+    plaintext = std::move(p);
     return res;
 }
 uint32_t CryptoContextDCRTPoly::GetRingDimension() const

+ 1 - 1
src/CryptoParametersBase.cc

@@ -6,7 +6,7 @@ namespace openfhe
 {
 
 CryptoParametersBaseDCRTPoly::CryptoParametersBaseDCRTPoly(
-    const std::shared_ptr<CryptoParametersBase>& cryptoParametersBase)
+    const std::shared_ptr<CryptoParametersBase>& cryptoParametersBase) noexcept
     : m_cryptoParametersBase(cryptoParametersBase)
 { }
 

+ 2 - 2
src/CryptoParametersBase.h

@@ -20,8 +20,8 @@ class CryptoParametersBaseDCRTPoly final
     std::shared_ptr<CryptoParametersBase> m_cryptoParametersBase;
 public:
     CryptoParametersBaseDCRTPoly() = default;
-    explicit CryptoParametersBaseDCRTPoly(
-        const std::shared_ptr<CryptoParametersBase>& cryptoParametersBase);
+    CryptoParametersBaseDCRTPoly(
+        const std::shared_ptr<CryptoParametersBase>& cryptoParametersBase) noexcept;
     CryptoParametersBaseDCRTPoly(const CryptoParametersBaseDCRTPoly&) = delete;
     CryptoParametersBaseDCRTPoly(CryptoParametersBaseDCRTPoly&&) = delete;
     CryptoParametersBaseDCRTPoly& operator=(const CryptoParametersBaseDCRTPoly&) = delete;

+ 2 - 2
src/DCRTPoly.cc

@@ -7,10 +7,10 @@ DCRTPoly::DCRTPoly(lbcrypto::DCRTPoly&& poly) noexcept
     : m_poly(std::move(poly))
 { }
 
-DCRTPolyParams::DCRTPolyParams(const std::shared_ptr<lbcrypto::DCRTPoly::Params>& params)
+DCRTPolyParams::DCRTPolyParams(const std::shared_ptr<lbcrypto::DCRTPoly::Params>& params) noexcept
     : m_params(params)
 { }
-std::shared_ptr<lbcrypto::DCRTPoly::Params> DCRTPolyParams::GetInternal() const
+std::shared_ptr<lbcrypto::DCRTPoly::Params> DCRTPolyParams::GetInternal() const noexcept
 {
     return m_params;
 }

+ 3 - 3
src/DCRTPoly.h

@@ -9,7 +9,7 @@ class DCRTPoly final
 {
     lbcrypto::DCRTPoly m_poly;
 public:
-    explicit DCRTPoly(lbcrypto::DCRTPoly&& poly) noexcept;
+    DCRTPoly(lbcrypto::DCRTPoly&& poly) noexcept;
     DCRTPoly(const DCRTPoly&) = delete;
     DCRTPoly(DCRTPoly&&) = delete;
     DCRTPoly& operator=(const DCRTPoly&) = delete;
@@ -21,13 +21,13 @@ class DCRTPolyParams final
     std::shared_ptr<lbcrypto::DCRTPoly::Params> m_params;
 public:
     DCRTPolyParams() = default;
-    explicit DCRTPolyParams(const std::shared_ptr<lbcrypto::DCRTPoly::Params>& params);
+    DCRTPolyParams(const std::shared_ptr<lbcrypto::DCRTPoly::Params>& params) noexcept;
     DCRTPolyParams(const DCRTPolyParams&) = delete;
     DCRTPolyParams(DCRTPolyParams&&) = delete;
     DCRTPolyParams& operator=(const DCRTPolyParams&) = delete;
     DCRTPolyParams& operator=(DCRTPolyParams&&) = delete;
 
-    [[nodiscard]] std::shared_ptr<lbcrypto::DCRTPoly::Params> GetInternal() const;
+    [[nodiscard]] std::shared_ptr<lbcrypto::DCRTPoly::Params> GetInternal() const noexcept;
 };
 
 // Generator functions

+ 2 - 2
src/DecryptResult.cc

@@ -3,8 +3,8 @@
 namespace openfhe
 {
 
-DecryptResult::DecryptResult(const lbcrypto::DecryptResult decryptResult)
-    : m_decryptResult(decryptResult)
+DecryptResult::DecryptResult(lbcrypto::DecryptResult&& decryptResult) noexcept
+    : m_decryptResult(std::move(decryptResult))
 { }
 
 } // openfhe

+ 1 - 1
src/DecryptResult.h

@@ -9,7 +9,7 @@ class DecryptResult final
 {
 	lbcrypto::DecryptResult m_decryptResult;
 public:
-    explicit DecryptResult(const lbcrypto::DecryptResult decryptResult);
+    DecryptResult(lbcrypto::DecryptResult&& decryptResult) noexcept;
     DecryptResult(const DecryptResult&) = delete;
     DecryptResult(DecryptResult&&) = delete;
     DecryptResult& operator=(const DecryptResult&) = delete;

+ 2 - 2
src/EncodingParams.cc

@@ -5,10 +5,10 @@
 namespace openfhe
 {
 
-EncodingParams::EncodingParams(const std::shared_ptr<EncodingParamsImpl>& encodingParams)
+EncodingParams::EncodingParams(const std::shared_ptr<EncodingParamsImpl>& encodingParams) noexcept
     : m_encodingParams(encodingParams)
 { }
-std::shared_ptr<EncodingParamsImpl> EncodingParams::GetInternal() const
+std::shared_ptr<EncodingParamsImpl> EncodingParams::GetInternal() const noexcept
 {
     return m_encodingParams;
 }

+ 2 - 2
src/EncodingParams.h

@@ -18,13 +18,13 @@ class EncodingParams final
 {
     std::shared_ptr<EncodingParamsImpl> m_encodingParams;
 public:
-    explicit EncodingParams(const std::shared_ptr<EncodingParamsImpl>& encodingParams);
+    EncodingParams(const std::shared_ptr<EncodingParamsImpl>& encodingParams) noexcept;
     EncodingParams(const EncodingParams&) = delete;
     EncodingParams(EncodingParams&&) = delete;
     EncodingParams& operator=(const EncodingParams&) = delete;
     EncodingParams& operator=(EncodingParams&&) = delete;
 
-    [[nodiscard]] std::shared_ptr<EncodingParamsImpl> GetInternal() const;
+    [[nodiscard]] std::shared_ptr<EncodingParamsImpl> GetInternal() const noexcept;
 };
 
 } // openfhe

+ 3 - 3
src/EvalKey.cc

@@ -5,10 +5,10 @@
 namespace openfhe
 {
 
-EvalKeyDCRTPoly::EvalKeyDCRTPoly(const std::shared_ptr<EvalKeyImpl>& evalKey)
-    : m_evalKey(evalKey)
+EvalKeyDCRTPoly::EvalKeyDCRTPoly(std::shared_ptr<EvalKeyImpl>&& evalKey) noexcept
+    : m_evalKey(std::move(evalKey))
 { }
-std::shared_ptr<EvalKeyImpl> EvalKeyDCRTPoly::GetInternal() const
+std::shared_ptr<EvalKeyImpl> EvalKeyDCRTPoly::GetInternal() const noexcept
 {
     return m_evalKey;
 }

+ 2 - 2
src/EvalKey.h

@@ -12,13 +12,13 @@ class EvalKeyDCRTPoly final
 {
     std::shared_ptr<EvalKeyImpl> m_evalKey;
 public:
-    explicit EvalKeyDCRTPoly(const std::shared_ptr<EvalKeyImpl>& evalKey);
+    EvalKeyDCRTPoly(std::shared_ptr<EvalKeyImpl>&& evalKey) noexcept;
     EvalKeyDCRTPoly(const EvalKeyDCRTPoly&) = delete;
     EvalKeyDCRTPoly(EvalKeyDCRTPoly&&) = delete;
     EvalKeyDCRTPoly& operator=(const EvalKeyDCRTPoly&) = delete;
     EvalKeyDCRTPoly& operator=(EvalKeyDCRTPoly&&) = delete;
 
-    [[nodiscard]] std::shared_ptr<EvalKeyImpl> GetInternal() const;
+    [[nodiscard]] std::shared_ptr<EvalKeyImpl> GetInternal() const noexcept;
 };
 
 } // openfhe

+ 3 - 3
src/KeyPair.cc

@@ -8,9 +8,9 @@
 namespace openfhe
 {
 
-KeyPairDCRTPoly::KeyPairDCRTPoly(const KeyPair& keyPair)
-    : m_publicKey(keyPair.publicKey)
-    , m_privateKey(keyPair.secretKey)
+KeyPairDCRTPoly::KeyPairDCRTPoly(KeyPair&& keyPair) noexcept
+    : m_publicKey(std::move(keyPair.publicKey))
+    , m_privateKey(std::move(keyPair.secretKey))
 { }
 std::unique_ptr<PublicKeyDCRTPoly> KeyPairDCRTPoly::GetPublicKey() const
 {

+ 1 - 1
src/KeyPair.h

@@ -27,7 +27,7 @@ class KeyPairDCRTPoly final
     std::shared_ptr<PublicKeyImpl> m_publicKey;
     std::shared_ptr<PrivateKeyImpl> m_privateKey;
 public:
-    explicit KeyPairDCRTPoly(const KeyPair& keyPair);
+    KeyPairDCRTPoly(KeyPair&& keyPair) noexcept;
     KeyPairDCRTPoly(const KeyPairDCRTPoly&) = delete;
     KeyPairDCRTPoly(KeyPairDCRTPoly&&) = delete;
     KeyPairDCRTPoly& operator=(const KeyPairDCRTPoly&) = delete;

+ 3 - 3
src/LWEPrivateKey.cc

@@ -5,10 +5,10 @@
 namespace openfhe
 {
 
-LWEPrivateKey::LWEPrivateKey(const std::shared_ptr<LWEPrivateKeyImpl>& lwePrivateKey)
-    : m_lwePrivateKey(lwePrivateKey)
+LWEPrivateKey::LWEPrivateKey(std::shared_ptr<LWEPrivateKeyImpl>&& lwePrivateKey) noexcept
+    : m_lwePrivateKey(std::move(lwePrivateKey))
 { }
-std::shared_ptr<LWEPrivateKeyImpl> LWEPrivateKey::GetInternal() const
+std::shared_ptr<LWEPrivateKeyImpl> LWEPrivateKey::GetInternal() const noexcept
 {
     return m_lwePrivateKey;
 }

+ 2 - 2
src/LWEPrivateKey.h

@@ -11,13 +11,13 @@ class LWEPrivateKey final
 {
     std::shared_ptr<LWEPrivateKeyImpl> m_lwePrivateKey;
 public:
-    explicit LWEPrivateKey(const std::shared_ptr<LWEPrivateKeyImpl>& lwePrivateKey);
+    LWEPrivateKey(std::shared_ptr<LWEPrivateKeyImpl>&& lwePrivateKey) noexcept;
     LWEPrivateKey(const LWEPrivateKey&) = delete;
     LWEPrivateKey(LWEPrivateKey&&) = delete;
     LWEPrivateKey& operator=(const LWEPrivateKey&) = delete;
     LWEPrivateKey& operator=(LWEPrivateKey&&) = delete;
 
-    [[nodiscard]] std::shared_ptr<LWEPrivateKeyImpl> GetInternal() const;
+    [[nodiscard]] std::shared_ptr<LWEPrivateKeyImpl> GetInternal() const noexcept;
 };
 
 } // openfhe

+ 19 - 19
src/Plaintext.cc

@@ -2,20 +2,20 @@
 
 #include "openfhe/pke/encoding/plaintext.h"
 
-#include "openfhe/src/lib.rs.h" // ComplexPair
+#include "openfhe/src/lib.rs.h"
 
 namespace openfhe
 {
 
-Plaintext::Plaintext(const std::shared_ptr<PlaintextImpl>& plaintext)
-    : m_plaintext(plaintext)
+Plaintext::Plaintext(std::shared_ptr<PlaintextImpl>&& plaintext) noexcept
+    : m_plaintext(std::move(plaintext))
 { }
-Plaintext& Plaintext::operator=(const std::shared_ptr<PlaintextImpl>& plaintext)
+Plaintext& Plaintext::operator=(std::shared_ptr<PlaintextImpl>&& plaintext) noexcept
 {
-    m_plaintext = plaintext;
+    m_plaintext = std::move(plaintext);
     return *this;
 }
-std::shared_ptr<PlaintextImpl> Plaintext::GetInternal() const
+std::shared_ptr<PlaintextImpl> Plaintext::GetInternal() const noexcept
 {
     return m_plaintext;
 }
@@ -23,19 +23,19 @@ void Plaintext::SetLength(const size_t newSize) const
 {
     m_plaintext->SetLength(newSize);
 }
-void Plaintext::SetLevel(const size_t l) const
+void Plaintext::SetLevel(const size_t l) const noexcept
 {
     m_plaintext->SetLevel(l);
 }
-bool Plaintext::IsEncoded() const
+bool Plaintext::IsEncoded() const noexcept
 {
     return m_plaintext->IsEncoded();
 }
-int64_t Plaintext::HighBound() const
+int64_t Plaintext::HighBound() const noexcept
 {
     return m_plaintext->HighBound();
 }
-int64_t Plaintext::LowBound() const
+int64_t Plaintext::LowBound() const noexcept
 {
     return m_plaintext->LowBound();
 }
@@ -49,11 +49,11 @@ rust::String Plaintext::GetString() const
     stream << *m_plaintext;
     return rust::String(stream.str());
 }
-size_t Plaintext::GetLength() const
+size_t Plaintext::GetLength() const noexcept
 {
     return m_plaintext->GetLength();
 }
-size_t Plaintext::GetLevel() const
+size_t Plaintext::GetLevel() const noexcept
 {
     return m_plaintext->GetLevel();
 }
@@ -61,19 +61,19 @@ double Plaintext::GetLogError() const
 {
     return m_plaintext->GetLogError();
 }
-size_t Plaintext::GetNoiseScaleDeg() const
+size_t Plaintext::GetNoiseScaleDeg() const noexcept
 {
     return m_plaintext->GetNoiseScaleDeg();
 }
-double Plaintext::GetScalingFactor() const
+double Plaintext::GetScalingFactor() const noexcept
 {
     return m_plaintext->GetScalingFactor();
 }
-SCHEME Plaintext::GetSchemeID() const
+SCHEME Plaintext::GetSchemeID() const noexcept
 {
     return m_plaintext->GetSchemeID();
 }
-uint32_t Plaintext::GetSlots() const
+uint32_t Plaintext::GetSlots() const noexcept
 {
     return m_plaintext->GetSlots();
 }
@@ -93,15 +93,15 @@ void Plaintext::SetIntVectorValue(const std::vector<int64_t>& val) const
 {
     m_plaintext->SetIntVectorValue(val);
 }
-void Plaintext::SetNoiseScaleDeg(const size_t nsd) const
+void Plaintext::SetNoiseScaleDeg(const size_t nsd) const noexcept
 {
     m_plaintext->SetNoiseScaleDeg(nsd);
 }
-void Plaintext::SetScalingFactor(const double sf) const
+void Plaintext::SetScalingFactor(const double sf) const noexcept
 {
     m_plaintext->SetScalingFactor(sf);
 }
-void Plaintext::SetSlots(const uint32_t s) const
+void Plaintext::SetSlots(const uint32_t s) const noexcept
 {
     m_plaintext->SetSlots(s);
 }

+ 16 - 16
src/Plaintext.h

@@ -19,35 +19,35 @@ class Plaintext final
     std::shared_ptr<PlaintextImpl> m_plaintext;
 public:
     Plaintext() = default;
-    explicit Plaintext(const std::shared_ptr<PlaintextImpl>& plaintext);
+    Plaintext(std::shared_ptr<PlaintextImpl>&& plaintext) noexcept;
     Plaintext(const Plaintext&) = delete;
     Plaintext(Plaintext&&) = delete;
     Plaintext& operator=(const Plaintext&) = delete;
     Plaintext& operator=(Plaintext&&) = delete;
-    Plaintext& operator=(const std::shared_ptr<PlaintextImpl>& plaintext);
+    Plaintext& operator=(std::shared_ptr<PlaintextImpl>&& plaintext) noexcept;
 
-    [[nodiscard]] std::shared_ptr<PlaintextImpl> GetInternal() const;
+    [[nodiscard]] std::shared_ptr<PlaintextImpl> GetInternal() const noexcept;
     void SetLength(const size_t newSize) const;
-    void SetLevel(const size_t l) const;
-    [[nodiscard]] bool IsEncoded() const;
-    [[nodiscard]] int64_t HighBound() const;
-    [[nodiscard]] int64_t LowBound() const;
+    void SetLevel(const size_t l) const noexcept;
+    [[nodiscard]] bool IsEncoded() const noexcept;
+    [[nodiscard]] int64_t HighBound() const noexcept;
+    [[nodiscard]] int64_t LowBound() const noexcept;
     [[nodiscard]] double GetLogPrecision() const;
     [[nodiscard]] rust::String GetString() const;
-    [[nodiscard]] size_t GetLength() const;
-    [[nodiscard]] size_t GetLevel() const;
+    [[nodiscard]] size_t GetLength() const noexcept;
+    [[nodiscard]] size_t GetLevel() const noexcept;
     [[nodiscard]] double GetLogError() const;
-    [[nodiscard]] size_t GetNoiseScaleDeg() const;
-    [[nodiscard]] double GetScalingFactor() const;
-    [[nodiscard]] SCHEME GetSchemeID() const;
-    [[nodiscard]] uint32_t GetSlots() const;
+    [[nodiscard]] size_t GetNoiseScaleDeg() const noexcept;
+    [[nodiscard]] double GetScalingFactor() const noexcept;
+    [[nodiscard]] SCHEME GetSchemeID() const noexcept;
+    [[nodiscard]] uint32_t GetSlots() const noexcept;
     [[nodiscard]] bool Encode() const;
     [[nodiscard]] bool Decode() const;
     void SetFormat(const Format fmt) const;
     void SetIntVectorValue(const std::vector<int64_t>& val) const;
-    void SetNoiseScaleDeg(const size_t nsd) const;
-    void SetScalingFactor(const double sf) const;
-    void SetSlots(const uint32_t s) const;
+    void SetNoiseScaleDeg(const size_t nsd) const noexcept;
+    void SetScalingFactor(const double sf) const noexcept;
+    void SetSlots(const uint32_t s) const noexcept;
     void SetStringValue(const std::string& value) const;
 
     [[nodiscard]] std::unique_ptr<std::vector<ComplexPair>> GetCopyOfCKKSPackedValue() const;

+ 2 - 2
src/PrivateKey.cc

@@ -5,10 +5,10 @@
 namespace openfhe
 {
 
-PrivateKeyDCRTPoly::PrivateKeyDCRTPoly(const std::shared_ptr<PrivateKeyImpl>& privateKey)
+PrivateKeyDCRTPoly::PrivateKeyDCRTPoly(const std::shared_ptr<PrivateKeyImpl>& privateKey) noexcept
     : m_privateKey(privateKey)
 { }
-std::shared_ptr<PrivateKeyImpl> PrivateKeyDCRTPoly::GetInternal() const
+std::shared_ptr<PrivateKeyImpl> PrivateKeyDCRTPoly::GetInternal() const noexcept
 {
     return m_privateKey;
 }

+ 2 - 2
src/PrivateKey.h

@@ -12,13 +12,13 @@ class PrivateKeyDCRTPoly final
 {
     std::shared_ptr<PrivateKeyImpl> m_privateKey;
 public:
-    explicit PrivateKeyDCRTPoly(const std::shared_ptr<PrivateKeyImpl>& privateKey);
+    PrivateKeyDCRTPoly(const std::shared_ptr<PrivateKeyImpl>& privateKey) noexcept;
     PrivateKeyDCRTPoly(const PrivateKeyDCRTPoly&) = delete;
     PrivateKeyDCRTPoly(PrivateKeyDCRTPoly&&) = delete;
     PrivateKeyDCRTPoly& operator=(const PrivateKeyDCRTPoly&) = delete;
     PrivateKeyDCRTPoly& operator=(PrivateKeyDCRTPoly&&) = delete;
 
-    [[nodiscard]] std::shared_ptr<PrivateKeyImpl> GetInternal() const;
+    [[nodiscard]] std::shared_ptr<PrivateKeyImpl> GetInternal() const noexcept;
 };
 
 } // openfhe

+ 2 - 2
src/PublicKey.cc

@@ -5,10 +5,10 @@
 namespace openfhe
 {
 
-PublicKeyDCRTPoly::PublicKeyDCRTPoly(const std::shared_ptr<PublicKeyImpl>& publicKey)
+PublicKeyDCRTPoly::PublicKeyDCRTPoly(const std::shared_ptr<PublicKeyImpl>& publicKey) noexcept
     : m_publicKey(publicKey)
 { }
-std::shared_ptr<PublicKeyImpl> PublicKeyDCRTPoly::GetInternal() const
+std::shared_ptr<PublicKeyImpl> PublicKeyDCRTPoly::GetInternal() const noexcept
 {
     return m_publicKey;
 }

+ 2 - 2
src/PublicKey.h

@@ -20,13 +20,13 @@ public:
         PublicKeyDCRTPoly& publicKey, const SerialMode serialMode);
 
     PublicKeyDCRTPoly() = default;
-    explicit PublicKeyDCRTPoly(const std::shared_ptr<PublicKeyImpl>& publicKey);
+    PublicKeyDCRTPoly(const std::shared_ptr<PublicKeyImpl>& publicKey) noexcept;
     PublicKeyDCRTPoly(const PublicKeyDCRTPoly&) = delete;
     PublicKeyDCRTPoly(PublicKeyDCRTPoly&&) = delete;
     PublicKeyDCRTPoly& operator=(const PublicKeyDCRTPoly&) = delete;
     PublicKeyDCRTPoly& operator=(PublicKeyDCRTPoly&&) = delete;
 
-    [[nodiscard]] std::shared_ptr<PublicKeyImpl> GetInternal() const;
+    [[nodiscard]] std::shared_ptr<PublicKeyImpl> GetInternal() const noexcept;
 };
 
 // Generator functions

+ 1 - 1
src/SchemeBase.cc

@@ -5,7 +5,7 @@
 namespace openfhe
 {
 
-SchemeBaseDCRTPoly::SchemeBaseDCRTPoly(const std::shared_ptr<SchemeBase>& schemeBase)
+SchemeBaseDCRTPoly::SchemeBaseDCRTPoly(const std::shared_ptr<SchemeBase>& schemeBase) noexcept
     : m_schemeBase(schemeBase)
 { }
 

+ 1 - 1
src/SchemeBase.h

@@ -20,7 +20,7 @@ class SchemeBaseDCRTPoly final
     std::shared_ptr<SchemeBase> m_schemeBase;
 public:
     SchemeBaseDCRTPoly() = default;
-    explicit SchemeBaseDCRTPoly(const std::shared_ptr<SchemeBase>& schemeBase);
+    SchemeBaseDCRTPoly(const std::shared_ptr<SchemeBase>& schemeBase) noexcept;
     SchemeBaseDCRTPoly(const SchemeBaseDCRTPoly&) = delete;
     SchemeBaseDCRTPoly(SchemeBaseDCRTPoly&&) = delete;
     SchemeBaseDCRTPoly& operator=(const SchemeBaseDCRTPoly&) = delete;

+ 17 - 13
src/SequenceContainerOfOpaqueTypes.cc

@@ -3,41 +3,45 @@
 namespace openfhe
 {
 
-VectorOfCiphertexts::VectorOfCiphertexts(std::vector<std::shared_ptr<CiphertextImpl>> ciphertexts)
+VectorOfCiphertexts::VectorOfCiphertexts(
+    std::vector<std::shared_ptr<CiphertextImpl>>&& ciphertexts) noexcept
     : m_ciphertexts(std::move(ciphertexts))
 { }
-const std::vector<std::shared_ptr<CiphertextImpl>>& VectorOfCiphertexts::GetInternal() const
+const std::vector<std::shared_ptr<CiphertextImpl>>&
+    VectorOfCiphertexts::GetInternal() const noexcept
 {
     return m_ciphertexts;
 }
-std::vector<std::shared_ptr<CiphertextImpl>>& VectorOfCiphertexts::GetInternal()
+std::vector<std::shared_ptr<CiphertextImpl>>& VectorOfCiphertexts::GetInternal() noexcept
 {
     return m_ciphertexts;
 }
 
 VectorOfVectorOfCiphertexts::VectorOfVectorOfCiphertexts(
-    std::vector<std::vector<std::shared_ptr<CiphertextImpl>>> ciphertexts)
+    std::vector<std::vector<std::shared_ptr<CiphertextImpl>>>&& ciphertexts) noexcept
     : m_ciphertexts(std::move(ciphertexts))
 { }
 std::vector<std::vector<std::shared_ptr<CiphertextImpl>>>&
-    VectorOfVectorOfCiphertexts::GetInternal()
+    VectorOfVectorOfCiphertexts::GetInternal() noexcept
 {
     return m_ciphertexts;
 }
 
-VectorOfPrivateKeys::VectorOfPrivateKeys(std::vector<std::shared_ptr<PrivateKeyImpl>> privateKeys)
+VectorOfPrivateKeys::VectorOfPrivateKeys(
+    std::vector<std::shared_ptr<PrivateKeyImpl>>&& privateKeys) noexcept
     : m_privateKeys(std::move(privateKeys))
 { }
-const std::vector<std::shared_ptr<PrivateKeyImpl>>& VectorOfPrivateKeys::GetInternal() const
+const std::vector<std::shared_ptr<PrivateKeyImpl>>&
+    VectorOfPrivateKeys::GetInternal() const noexcept
 {
     return m_privateKeys;
 }
 
 VectorOfDCRTPolys::VectorOfDCRTPolys(
-    const std::shared_ptr<std::vector<lbcrypto::DCRTPoly>> elements)
-    : m_elements(elements)
+    std::shared_ptr<std::vector<lbcrypto::DCRTPoly>>&& elements) noexcept
+    : m_elements(std::move(elements))
 { }
-std::shared_ptr<std::vector<lbcrypto::DCRTPoly>> VectorOfDCRTPolys::GetInternal() const
+std::shared_ptr<std::vector<lbcrypto::DCRTPoly>> VectorOfDCRTPolys::GetInternal() const noexcept
 {
     return m_elements;
 }
@@ -45,16 +49,16 @@ std::shared_ptr<std::vector<lbcrypto::DCRTPoly>> VectorOfDCRTPolys::GetInternal(
 VectorOfEvalKeys::VectorOfEvalKeys(std::vector<std::shared_ptr<EvalKeyImpl>> evalKeys)
     : m_evalKeys(std::move(evalKeys))
 { }
-const std::vector<std::shared_ptr<EvalKeyImpl>>& VectorOfEvalKeys::GetInternal() const
+const std::vector<std::shared_ptr<EvalKeyImpl>>& VectorOfEvalKeys::GetInternal() const noexcept
 {
     return m_evalKeys;
 }
 
 VectorOfLWECiphertexts::VectorOfLWECiphertexts(
-    std::vector<std::shared_ptr<LWECiphertextImpl>> lweCiphertexts)
+    std::vector<std::shared_ptr<LWECiphertextImpl>>&& lweCiphertexts) noexcept
     : m_lweCiphertexts(std::move(lweCiphertexts))
 { }
-std::vector<std::shared_ptr<LWECiphertextImpl>>& VectorOfLWECiphertexts::GetInternal()
+std::vector<std::shared_ptr<LWECiphertextImpl>>& VectorOfLWECiphertexts::GetInternal() noexcept
 {
     return m_lweCiphertexts;
 }

+ 16 - 15
src/SequenceContainerOfOpaqueTypes.h

@@ -17,18 +17,19 @@ class VectorOfCiphertexts final
 {
     std::vector<std::shared_ptr<CiphertextImpl>> m_ciphertexts;
 public:
-    explicit VectorOfCiphertexts(std::vector<std::shared_ptr<CiphertextImpl>> ciphertexts);
-    [[nodiscard]] const std::vector<std::shared_ptr<CiphertextImpl>>& GetInternal() const;
-    [[nodiscard]] std::vector<std::shared_ptr<CiphertextImpl>>& GetInternal();
+    VectorOfCiphertexts(std::vector<std::shared_ptr<CiphertextImpl>>&& ciphertexts) noexcept;
+    [[nodiscard]] const std::vector<std::shared_ptr<CiphertextImpl>>& GetInternal() const noexcept;
+    [[nodiscard]] std::vector<std::shared_ptr<CiphertextImpl>>& GetInternal() noexcept;
 };
 
 class VectorOfVectorOfCiphertexts final
 {
     std::vector<std::vector<std::shared_ptr<CiphertextImpl>>> m_ciphertexts;
 public:
-    explicit VectorOfVectorOfCiphertexts(
-        std::vector<std::vector<std::shared_ptr<CiphertextImpl>>> ciphertexts);
-    [[nodiscard]] std::vector<std::vector<std::shared_ptr<CiphertextImpl>>>& GetInternal();
+    VectorOfVectorOfCiphertexts(
+        std::vector<std::vector<std::shared_ptr<CiphertextImpl>>>&& ciphertexts) noexcept;
+    [[nodiscard]] std::vector<std::vector<std::shared_ptr<CiphertextImpl>>>&
+        GetInternal() noexcept;
 };
 
 using PrivateKeyImpl = lbcrypto::PrivateKeyImpl<lbcrypto::DCRTPoly>;
@@ -37,16 +38,16 @@ class VectorOfPrivateKeys final
 {
     std::vector<std::shared_ptr<PrivateKeyImpl>> m_privateKeys;
 public:
-    explicit VectorOfPrivateKeys(std::vector<std::shared_ptr<PrivateKeyImpl>> ciphertexts);
-    [[nodiscard]] const std::vector<std::shared_ptr<PrivateKeyImpl>>& GetInternal() const;
+    VectorOfPrivateKeys(std::vector<std::shared_ptr<PrivateKeyImpl>>&& ciphertexts) noexcept;
+    [[nodiscard]] const std::vector<std::shared_ptr<PrivateKeyImpl>>& GetInternal() const noexcept;
 };
 
 class VectorOfDCRTPolys final
 {
     std::shared_ptr<std::vector<lbcrypto::DCRTPoly>> m_elements;
 public:
-    explicit VectorOfDCRTPolys(const std::shared_ptr<std::vector<lbcrypto::DCRTPoly>> elements);
-    [[nodiscard]] std::shared_ptr<std::vector<lbcrypto::DCRTPoly>> GetInternal() const;
+    VectorOfDCRTPolys(std::shared_ptr<std::vector<lbcrypto::DCRTPoly>>&& elements) noexcept;
+    [[nodiscard]] std::shared_ptr<std::vector<lbcrypto::DCRTPoly>> GetInternal() const noexcept;
 };
 
 using EvalKeyImpl = lbcrypto::EvalKeyImpl<lbcrypto::DCRTPoly>;
@@ -55,8 +56,8 @@ class VectorOfEvalKeys final
 {
     std::vector<std::shared_ptr<EvalKeyImpl>> m_evalKeys;
 public:
-    explicit VectorOfEvalKeys(std::vector<std::shared_ptr<EvalKeyImpl>> evalKeys);
-    [[nodiscard]] const std::vector<std::shared_ptr<EvalKeyImpl>>& GetInternal() const;
+    VectorOfEvalKeys(std::vector<std::shared_ptr<EvalKeyImpl>> evalKeys);
+    [[nodiscard]] const std::vector<std::shared_ptr<EvalKeyImpl>>& GetInternal() const noexcept;
 };
 
 using LWECiphertextImpl = lbcrypto::LWECiphertextImpl;
@@ -65,9 +66,9 @@ class VectorOfLWECiphertexts final
 {
     std::vector<std::shared_ptr<LWECiphertextImpl>> m_lweCiphertexts;
 public:
-    explicit VectorOfLWECiphertexts(
-        std::vector<std::shared_ptr<LWECiphertextImpl>> lweCiphertexts);
-    [[nodiscard]] std::vector<std::shared_ptr<LWECiphertextImpl>>& GetInternal();
+    VectorOfLWECiphertexts(
+        std::vector<std::shared_ptr<LWECiphertextImpl>>&& lweCiphertexts) noexcept;
+    [[nodiscard]] std::vector<std::shared_ptr<LWECiphertextImpl>>& GetInternal() noexcept;
 };
 
 } // openfhe