rotgen/include/rotgen/format/dynamic.hpp
Jules Pénuchot 648dd768ee Adding clang-format configuration file and formatting all source files
Co-authored-by: Jules Pénuchot <jules@penuchot.com>
Co-authored-by: Joel FALCOU <jfalcou@codereckons.com>

See merge request oss/rotgen!41
2025-10-14 16:19:03 +02:00

51 lines
1.3 KiB
C++

//==================================================================================================
/*
ROTGEN - Runtime Overlay for Eigen
Copyright : CODE RECKONS
SPDX-License-Identifier: BSL-1.0
*/
//==================================================================================================
#pragma once
#include <rotgen/config.hpp>
#include <memory>
#include <string>
namespace rotgen
{
class ROTGEN_EXPORT ioformat
{
private:
struct payload;
std::unique_ptr<payload> storage_;
public:
ioformat(int precision,
int flags = 0,
std::string const& coeffSeparator = " ",
std::string const& rowSeparator = "\n",
std::string const& rowPrefix = "",
std::string const& rowSuffix = "",
std::string const& matPrefix = "",
std::string const& matSuffix = "",
char fill = ' ');
~ioformat();
std::unique_ptr<payload> const& storage() const { return storage_; }
};
template<typename M> struct format
{
format(M const& m, ioformat const& f) : matrix_(m), format_(f) {}
M const& matrix_;
ioformat const& format_;
};
template<typename M>
std::ostream& operator<<(std::ostream& os, format<M> const& f)
{
return os << format{f.matrix_.base(), f.format_};
}
}