![]() |
Blaze 3.9
|
Serialization of dense and sparse vectors. More...
#include <blaze/math/Aliases.h>
#include <blaze/math/constraints/Vector.h>
#include <blaze/math/Exception.h>
#include <blaze/math/expressions/DenseVector.h>
#include <blaze/math/expressions/SparseVector.h>
#include <blaze/math/expressions/Vector.h>
#include <blaze/math/serialization/TypeValueMapping.h>
#include <blaze/math/typetraits/IsDenseVector.h>
#include <blaze/math/typetraits/IsResizable.h>
#include <blaze/util/Assert.h>
#include <blaze/util/EnableIf.h>
#include <blaze/util/Types.h>
Go to the source code of this file.
Classes | |
class | blaze::VectorSerializer |
Serializer for dense and sparse vectors. More... | |
Functions | |
template<typename Archive , typename VT , bool TF> | |
void | blaze::serialize (Archive &archive, const Vector< VT, TF > &vec) |
Serializes the given vector and writes it to the archive. More... | |
template<typename Archive , typename VT , bool TF> | |
void | blaze::deserialize (Archive &archive, Vector< VT, TF > &vec) |
Deserializes a vector from the given archive. More... | |
Serialization of dense and sparse vectors.
Copyright (C) 2012-2020 Klaus Iglberger - All Rights Reserved
This file is part of the Blaze library. You can redistribute it and/or modify it under the terms of the New (Revised) BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
void blaze::deserialize | ( | Archive & | archive, |
Vector< VT, TF > & | vec | ||
) |
Deserializes a vector from the given archive.
archive | The archive to be read from. |
vec | The vector to be deserialized. |
std::runtime_error | Vector could not be deserialized. |
The deserialize() function converts the portable, binary representation contained in the given archive into the given vector type. For a detailed example that demonstrates the (de-)serialization process of vectors, see the serialize() function.
void blaze::serialize | ( | Archive & | archive, |
const Vector< VT, TF > & | vec | ||
) |
Serializes the given vector and writes it to the archive.
archive | The archive to be written. |
vec | The vector to be serialized. |
std::runtime_error | Error during serialization. |
The serialize() function converts the given vector into a portable, binary representation. The following example demonstrates the (de-)serialization process of vectors:
As the example demonstrates, the vector serialization offers an enormous flexibility. However, several actions result in errors:
In case an error is encountered during (de-)serialization, a std::runtime_exception is thrown.