Cleanup: fewer iostreams related includes from BLI/BKE headers
Including <iostream> or similar headers is quite expensive, since it also pulls in things like <locale> and so on. In many BLI headers, iostreams are only used to implement some sort of "debug print", or an operator<< for ostream. Change some of the commonly used places to instead include <iosfwd>, which is the standard way of forward-declaring iostreams related classes, and move the actual debug-print / operator<< implementations into .cc files. This is not done for templated classes though (it would be possible to provide explicit operator<< instantiations somewhere in the source file, but that would lead to hard-to-figure-out linker error whenever someone would add a different template type). There, where possible, I changed from full <iostream> include to only the needed <ostream> part. For Span<T>, I just removed print_as_lines since it's not used by anything. It could be moved into a .cc file using a similar approach as above if needed. Doing full blender build changes include counts this way: - <iostream> 1986 -> 978 - <sstream> 2880 -> 925 It does not affect the total build time much though, mostly because towards the end of it there's just several CPU cores finishing compiling OpenVDB related source files. Pull Request: https://projects.blender.org/blender/blender/pulls/111046
This commit is contained in:
committed by
Gitea
parent
f50da4040f
commit
acbd952abf
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
|
||||
#include "AS_asset_catalog.hh"
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include "BLI_path_util.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::asset_system {
|
||||
|
||||
const char AssetCatalogPath::SEPARATOR = '/';
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <optional>
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* \ingroup bke
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <iosfwd>
|
||||
#include <mutex>
|
||||
|
||||
#include "BLI_bounds_types.hh"
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_enum_types.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::bke {
|
||||
|
||||
using namespace io::serialize;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
#include "BLI_resource_scope.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::bke::anonymous_attribute_inferencing {
|
||||
namespace aal = nodes::aal;
|
||||
using nodes::NodeDeclaration;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "IMB_imbuf_types.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::bke::paint::canvas {
|
||||
static TexPaintSlot *get_active_slot(Object *ob)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
|
||||
#include "pbvh_uv_islands.hh"
|
||||
|
||||
#include <iostream>
|
||||
#include <optional>
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::bke::pbvh::uv_islands {
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_enum_types.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::bke::sim {
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "BLI_index_range.hh"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include <ostream>
|
||||
#include <iosfwd>
|
||||
|
||||
namespace blender::bits {
|
||||
|
||||
@@ -234,15 +234,8 @@ class MutableBitRef {
|
||||
}
|
||||
};
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &stream, const BitRef &bit)
|
||||
{
|
||||
return stream << (bit ? "1" : "0");
|
||||
}
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &stream, const MutableBitRef &bit)
|
||||
{
|
||||
return stream << BitRef(bit);
|
||||
}
|
||||
std::ostream &operator<<(std::ostream &stream, const BitRef &bit);
|
||||
std::ostream &operator<<(std::ostream &stream, const MutableBitRef &bit);
|
||||
|
||||
} // namespace blender::bits
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
|
||||
#include "BLI_math_color.h"
|
||||
|
||||
|
||||
@@ -637,22 +637,9 @@ class CPPType : NonCopyable, NonMovable {
|
||||
print_(value, ss);
|
||||
}
|
||||
|
||||
std::string to_string(const void *value) const
|
||||
{
|
||||
std::stringstream ss;
|
||||
this->print(value, ss);
|
||||
return ss.str();
|
||||
}
|
||||
std::string to_string(const void *value) const;
|
||||
|
||||
void print_or_default(const void *value, std::stringstream &ss, StringRef default_value) const
|
||||
{
|
||||
if (this->is_printable()) {
|
||||
this->print(value, ss);
|
||||
}
|
||||
else {
|
||||
ss << default_value;
|
||||
}
|
||||
}
|
||||
void print_or_default(const void *value, std::stringstream &ss, StringRef default_value) const;
|
||||
|
||||
bool is_equal(const void *a, const void *b) const
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "BLI_cpp_type.hh"
|
||||
#include "BLI_utildefines.h"
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::cpp_type_util {
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
#include "BLI_dot_export_attribute_enums.hh"
|
||||
|
||||
#include <iosfwd>
|
||||
#include <optional>
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::dot {
|
||||
|
||||
|
||||
@@ -303,26 +303,7 @@ class HashTableStats {
|
||||
removed_load_factor_ = (float)removed_amount_ / (float)capacity_;
|
||||
}
|
||||
|
||||
void print(StringRef name = "")
|
||||
{
|
||||
std::cout << "Hash Table Stats: " << name << "\n";
|
||||
std::cout << " Address: " << address_ << "\n";
|
||||
std::cout << " Total Slots: " << capacity_ << "\n";
|
||||
std::cout << " Occupied Slots: " << size_ << " (" << load_factor_ * 100.0f << " %)\n";
|
||||
std::cout << " Removed Slots: " << removed_amount_ << " (" << removed_load_factor_ * 100.0f
|
||||
<< " %)\n";
|
||||
|
||||
char memory_size_str[BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE];
|
||||
BLI_str_format_byte_unit(memory_size_str, size_in_bytes_, true);
|
||||
std::cout << " Size: ~" << memory_size_str << "\n";
|
||||
std::cout << " Size per Slot: " << size_per_element_ << " bytes\n";
|
||||
|
||||
std::cout << " Average Collisions: " << average_collisions_ << "\n";
|
||||
for (int64_t collision_count : keys_by_collision_count_.index_range()) {
|
||||
std::cout << " " << collision_count
|
||||
<< " Collisions: " << keys_by_collision_count_[collision_count] << "\n";
|
||||
}
|
||||
}
|
||||
void print(StringRef name = "") const;
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -38,9 +38,8 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <iosfwd>
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
@@ -324,11 +323,7 @@ class IndexRange {
|
||||
return IndexRange(start_ + n, size_);
|
||||
}
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &stream, IndexRange range)
|
||||
{
|
||||
stream << "[" << range.start() << ", " << range.one_after_last() << ")";
|
||||
return stream;
|
||||
}
|
||||
friend std::ostream &operator<<(std::ostream &stream, IndexRange range);
|
||||
};
|
||||
|
||||
struct AlignedIndexRanges {
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "BLI_array.hh"
|
||||
#include "BLI_dot_export.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace blender {
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* This design allows some function overloads to be more efficient with certain types.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
|
||||
#include "BLI_math_base.hh"
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* the fastest and more correct option.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
|
||||
#include "BLI_math_angle_types.hh"
|
||||
#include "BLI_math_base.hh"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* - Curve Tangent-Space: X-left, Y-up, Z-forward
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <iosfwd>
|
||||
|
||||
#include "BLI_math_base.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
@@ -88,20 +88,7 @@ class Axis {
|
||||
/** Avoid hell. */
|
||||
explicit operator bool() const = delete;
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &stream, const Axis axis)
|
||||
{
|
||||
switch (axis.axis_) {
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return stream << "Invalid Axis";
|
||||
case Value::X:
|
||||
return stream << 'X';
|
||||
case Value::Y:
|
||||
return stream << 'Y';
|
||||
case Value::Z:
|
||||
return stream << 'Z';
|
||||
}
|
||||
}
|
||||
friend std::ostream &operator<<(std::ostream &stream, const Axis axis);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -190,21 +177,7 @@ class AxisSigned {
|
||||
/** Avoid hell. */
|
||||
explicit operator bool() const = delete;
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &stream, const AxisSigned axis)
|
||||
{
|
||||
switch (axis.axis_) {
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return stream << "Invalid AxisSigned";
|
||||
case Value::X_POS:
|
||||
case Value::Y_POS:
|
||||
case Value::Z_POS:
|
||||
case Value::X_NEG:
|
||||
case Value::Y_NEG:
|
||||
case Value::Z_NEG:
|
||||
return stream << axis.axis() << (axis.sign() == -1 ? '-' : '+');
|
||||
}
|
||||
}
|
||||
friend std::ostream &operator<<(std::ostream &stream, const AxisSigned axis);
|
||||
};
|
||||
|
||||
constexpr static bool operator<=(const Axis::Value a, const Axis::Value b)
|
||||
@@ -417,10 +390,7 @@ struct CartesianBasis {
|
||||
return axes.z;
|
||||
}
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &stream, const CartesianBasis &rot)
|
||||
{
|
||||
return stream << "CartesianBasis" << rot.axes;
|
||||
}
|
||||
friend std::ostream &operator<<(std::ostream &stream, const CartesianBasis &rot);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* eg: `Euler3 my_euler(EulerOrder::XYZ); my_euler = my_quaternion:`
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
|
||||
#include "BLI_math_angle_types.hh"
|
||||
#include "BLI_math_base.hh"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <type_traits>
|
||||
|
||||
#include "BLI_math_vector_types.hh"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* \ingroup bli
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
|
||||
#include "BLI_math_angle_types.hh"
|
||||
#include "BLI_math_base.hh"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <type_traits>
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#ifdef WITH_GMP
|
||||
|
||||
# include <iostream>
|
||||
# include <iosfwd>
|
||||
|
||||
# include "BLI_array.hh"
|
||||
# include "BLI_index_range.hh"
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
* `serialize`/`deserialize` methods should be implemented.
|
||||
*/
|
||||
|
||||
#include <ostream>
|
||||
#include <iosfwd>
|
||||
|
||||
#include "BLI_map.hh"
|
||||
#include "BLI_string_ref.hh"
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -449,29 +448,6 @@ template<typename T> class Span {
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
/**
|
||||
* A debug utility to print the content of the Span. Every element will be printed on a
|
||||
* separate line using the given callback.
|
||||
*/
|
||||
template<typename PrintLineF> void print_as_lines(std::string name, PrintLineF print_line) const
|
||||
{
|
||||
std::cout << "Span: " << name << " \tSize:" << size_ << '\n';
|
||||
for (const T &value : *this) {
|
||||
std::cout << " ";
|
||||
print_line(value);
|
||||
std::cout << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A debug utility to print the content of the span. Every element be printed on a separate
|
||||
* line.
|
||||
*/
|
||||
void print_as_lines(std::string name) const
|
||||
{
|
||||
this->print_as_lines(name, [](const T &value) { std::cout << value; });
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
@@ -571,17 +570,8 @@ constexpr StringRef::StringRef(std::string_view view)
|
||||
/** \name Operator Overloads
|
||||
* \{ */
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &stream, StringRef ref)
|
||||
{
|
||||
stream << std::string(ref);
|
||||
return stream;
|
||||
}
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &stream, StringRefNull ref)
|
||||
{
|
||||
stream << std::string(ref.data(), size_t(ref.size()));
|
||||
return stream;
|
||||
}
|
||||
std::ostream &operator<<(std::ostream &stream, StringRef ref);
|
||||
std::ostream &operator<<(std::ostream &stream, StringRefNull ref);
|
||||
|
||||
/**
|
||||
* Adding two #StringRefs will allocate an std::string.
|
||||
|
||||
@@ -57,7 +57,8 @@ bool BLI_uuid_parse_string(bUUID *uuid, const char *buffer) ATTR_NONNULL();
|
||||
}
|
||||
|
||||
# include <initializer_list>
|
||||
# include <ostream>
|
||||
# include <iosfwd>
|
||||
# include <string>
|
||||
|
||||
/** Output the UUID as formatted ASCII string, see #BLI_uuid_format(). */
|
||||
std::ostream &operator<<(std::ostream &stream, bUUID uuid);
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
#include "BLI_allocator.hh"
|
||||
@@ -36,7 +35,6 @@
|
||||
#include "BLI_math_base.h"
|
||||
#include "BLI_memory_utils.hh"
|
||||
#include "BLI_span.hh"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_string_ref.hh"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
@@ -44,6 +42,15 @@
|
||||
|
||||
namespace blender {
|
||||
|
||||
namespace internal {
|
||||
void vector_print_stats(StringRef name,
|
||||
void *address,
|
||||
int64_t size,
|
||||
int64_t capacity,
|
||||
int64_t inlineCapacity,
|
||||
int64_t memorySize);
|
||||
}
|
||||
|
||||
template<
|
||||
/**
|
||||
* Type of the values stored in this vector. It has to be movable.
|
||||
@@ -978,15 +985,8 @@ class Vector {
|
||||
*/
|
||||
void print_stats(StringRef name = "") const
|
||||
{
|
||||
std::cout << "Vector Stats: " << name << "\n";
|
||||
std::cout << " Address: " << this << "\n";
|
||||
std::cout << " Elements: " << this->size() << "\n";
|
||||
std::cout << " Capacity: " << (capacity_end_ - begin_) << "\n";
|
||||
std::cout << " Inline Capacity: " << InlineBufferCapacity << "\n";
|
||||
|
||||
char memory_size_str[BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE];
|
||||
BLI_str_format_byte_unit(memory_size_str, sizeof(*this), true);
|
||||
std::cout << " Size on Stack: " << memory_size_str << "\n";
|
||||
internal::vector_print_stats(
|
||||
name, this, this->size(), capacity_end_ - begin_, InlineBufferCapacity, sizeof(*this));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -1071,6 +1071,10 @@ template<typename T> class VArraySpan final : public Span<T> {
|
||||
}
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
void print_mutable_varray_span_warning();
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as #VArraySpan, but for a mutable span.
|
||||
* The important thing to note is that when changing this span, the results might not be
|
||||
@@ -1141,7 +1145,7 @@ template<typename T> class MutableVArraySpan final : public MutableSpan<T> {
|
||||
if (varray_) {
|
||||
if (show_not_saved_warning_) {
|
||||
if (!save_has_been_called_) {
|
||||
std::cout << "Warning: Call `save()` to make sure that changes persist in all cases.\n";
|
||||
internal::print_mutable_varray_span_warning();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ set(SRC
|
||||
intern/array_utils.cc
|
||||
intern/astar.c
|
||||
intern/atomic_disjoint_set.cc
|
||||
intern/bit_ref.cc
|
||||
intern/bit_span.cc
|
||||
intern/bitmap.c
|
||||
intern/bitmap_draw_2d.c
|
||||
@@ -56,6 +57,7 @@ set(SRC
|
||||
intern/cache_mutex.cc
|
||||
intern/compute_context.cc
|
||||
intern/convexhull_2d.c
|
||||
intern/cpp_type.cc
|
||||
intern/cpp_types.cc
|
||||
intern/delaunay_2d.cc
|
||||
intern/dot_export.cc
|
||||
@@ -78,8 +80,10 @@ set(SRC
|
||||
intern/hash_md5.c
|
||||
intern/hash_mm2a.c
|
||||
intern/hash_mm3.c
|
||||
intern/hash_tables.cc
|
||||
intern/implicit_sharing.cc
|
||||
intern/index_mask.cc
|
||||
intern/index_range.cc
|
||||
intern/jitter_2d.c
|
||||
intern/kdtree_1d.c
|
||||
intern/kdtree_2d.c
|
||||
@@ -92,6 +96,7 @@ set(SRC
|
||||
intern/math_base.c
|
||||
intern/math_base_inline.c
|
||||
intern/math_base_safe_inline.c
|
||||
intern/math_basis_types.cc
|
||||
intern/math_bits_inline.c
|
||||
intern/math_boolean.cc
|
||||
intern/math_color.c
|
||||
@@ -135,6 +140,7 @@ set(SRC
|
||||
intern/storage.c
|
||||
intern/string.c
|
||||
intern/string_cursor_utf8.c
|
||||
intern/string_ref.cc
|
||||
intern/string_search.cc
|
||||
intern/string_utf8.c
|
||||
intern/string_utils.c
|
||||
@@ -151,6 +157,8 @@ set(SRC
|
||||
intern/timeit.cc
|
||||
intern/uuid.cc
|
||||
intern/uvproject.c
|
||||
intern/vector.cc
|
||||
intern/virtual_array.cc
|
||||
intern/voronoi_2d.c
|
||||
intern/voxel.c
|
||||
intern/winstuff.c
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "BLI_color.hh"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace blender {
|
||||
|
||||
std::ostream &operator<<(std::ostream &stream, const eAlpha &space)
|
||||
@@ -40,4 +42,23 @@ std::ostream &operator<<(std::ostream &stream, const eSpace &space)
|
||||
return stream;
|
||||
}
|
||||
|
||||
template<typename ChannelStorageType, eSpace Space, eAlpha Alpha>
|
||||
std::ostream &operator<<(std::ostream &stream,
|
||||
const ColorRGBA<ChannelStorageType, Space, Alpha> &c)
|
||||
{
|
||||
stream << Space << Alpha << "(" << c.r << ", " << c.g << ", " << c.b << ", " << c.a << ")";
|
||||
return stream;
|
||||
}
|
||||
|
||||
template std::ostream &operator<<(
|
||||
std::ostream &stream, const ColorRGBA<float, eSpace::SceneLinear, eAlpha::Premultiplied> &c);
|
||||
template std::ostream &operator<<(
|
||||
std::ostream &stream, const ColorRGBA<float, eSpace::SceneLinear, eAlpha::Straight> &c);
|
||||
template std::ostream &operator<<(
|
||||
std::ostream &stream,
|
||||
const ColorRGBA<uint8_t, eSpace::SceneLinearByteEncoded, eAlpha::Premultiplied> &c);
|
||||
template std::ostream &operator<<(
|
||||
std::ostream &stream,
|
||||
const ColorRGBA<uint8_t, eSpace::SceneLinearByteEncoded, eAlpha::Straight> &c);
|
||||
|
||||
} // namespace blender
|
||||
|
||||
21
source/blender/blenlib/intern/bit_ref.cc
Normal file
21
source/blender/blenlib/intern/bit_ref.cc
Normal file
@@ -0,0 +1,21 @@
|
||||
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_bit_ref.hh"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace blender::bits {
|
||||
|
||||
std::ostream &operator<<(std::ostream &stream, const BitRef &bit)
|
||||
{
|
||||
return stream << (bit ? '1' : '0');
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &stream, const MutableBitRef &bit)
|
||||
{
|
||||
return stream << BitRef(bit);
|
||||
}
|
||||
|
||||
} // namespace blender::bits
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "BLI_bit_span.hh"
|
||||
#include "BLI_bit_span_ops.hh"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace blender::bits {
|
||||
|
||||
void MutableBitSpan::set_all()
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "BLI_compute_context.hh"
|
||||
#include "BLI_hash_md5.h"
|
||||
#include <sstream>
|
||||
|
||||
namespace blender {
|
||||
|
||||
|
||||
30
source/blender/blenlib/intern/cpp_type.cc
Normal file
30
source/blender/blenlib/intern/cpp_type.cc
Normal file
@@ -0,0 +1,30 @@
|
||||
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_cpp_type.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace blender {
|
||||
|
||||
std::string CPPType::to_string(const void *value) const
|
||||
{
|
||||
std::stringstream ss;
|
||||
this->print(value, ss);
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
void CPPType::print_or_default(const void *value,
|
||||
std::stringstream &ss,
|
||||
StringRef default_value) const
|
||||
{
|
||||
if (this->is_printable()) {
|
||||
this->print(value, ss);
|
||||
}
|
||||
else {
|
||||
ss << default_value;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace blender
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include "BLI_dot_export.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::dot {
|
||||
|
||||
/* Graph Building
|
||||
|
||||
29
source/blender/blenlib/intern/hash_tables.cc
Normal file
29
source/blender/blenlib/intern/hash_tables.cc
Normal file
@@ -0,0 +1,29 @@
|
||||
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_hash_tables.hh"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
void blender::HashTableStats::print(StringRef name) const
|
||||
{
|
||||
std::cout << "Hash Table Stats: " << name << "\n";
|
||||
std::cout << " Address: " << address_ << "\n";
|
||||
std::cout << " Total Slots: " << capacity_ << "\n";
|
||||
std::cout << " Occupied Slots: " << size_ << " (" << load_factor_ * 100.0f << " %)\n";
|
||||
std::cout << " Removed Slots: " << removed_amount_ << " (" << removed_load_factor_ * 100.0f
|
||||
<< " %)\n";
|
||||
|
||||
char memory_size_str[BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE];
|
||||
BLI_str_format_byte_unit(memory_size_str, size_in_bytes_, true);
|
||||
std::cout << " Size: ~" << memory_size_str << "\n";
|
||||
std::cout << " Size per Slot: " << size_per_element_ << " bytes\n";
|
||||
|
||||
std::cout << " Average Collisions: " << average_collisions_ << "\n";
|
||||
for (int64_t collision_count : keys_by_collision_count_.index_range()) {
|
||||
std::cout << " " << collision_count
|
||||
<< " Collisions: " << keys_by_collision_count_[collision_count] << "\n";
|
||||
}
|
||||
}
|
||||
17
source/blender/blenlib/intern/index_range.cc
Normal file
17
source/blender/blenlib/intern/index_range.cc
Normal file
@@ -0,0 +1,17 @@
|
||||
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_index_range.hh"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace blender {
|
||||
|
||||
std::ostream &operator<<(std::ostream &stream, IndexRange range)
|
||||
{
|
||||
stream << '[' << range.start() << ", " << range.one_after_last() << ')';
|
||||
return stream;
|
||||
}
|
||||
|
||||
} // namespace blender
|
||||
45
source/blender/blenlib/intern/math_basis_types.cc
Normal file
45
source/blender/blenlib/intern/math_basis_types.cc
Normal file
@@ -0,0 +1,45 @@
|
||||
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_math_basis_types.hh"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace blender::math {
|
||||
|
||||
std::ostream &operator<<(std::ostream &stream, const Axis axis)
|
||||
{
|
||||
switch (axis.axis_) {
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return stream << "Invalid Axis";
|
||||
case Axis::Value::X:
|
||||
return stream << 'X';
|
||||
case Axis::Value::Y:
|
||||
return stream << 'Y';
|
||||
case Axis::Value::Z:
|
||||
return stream << 'Z';
|
||||
}
|
||||
}
|
||||
std::ostream &operator<<(std::ostream &stream, const AxisSigned axis)
|
||||
{
|
||||
switch (axis.axis_) {
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return stream << "Invalid AxisSigned";
|
||||
case AxisSigned::Value::X_POS:
|
||||
case AxisSigned::Value::Y_POS:
|
||||
case AxisSigned::Value::Z_POS:
|
||||
case AxisSigned::Value::X_NEG:
|
||||
case AxisSigned::Value::Y_NEG:
|
||||
case AxisSigned::Value::Z_NEG:
|
||||
return stream << axis.axis() << (axis.sign() == -1 ? '-' : '+');
|
||||
}
|
||||
}
|
||||
std::ostream &operator<<(std::ostream &stream, const CartesianBasis &rot)
|
||||
{
|
||||
return stream << "CartesianBasis" << rot.axes;
|
||||
}
|
||||
|
||||
} // namespace blender::math
|
||||
23
source/blender/blenlib/intern/string_ref.cc
Normal file
23
source/blender/blenlib/intern/string_ref.cc
Normal file
@@ -0,0 +1,23 @@
|
||||
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_string_ref.hh"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace blender {
|
||||
|
||||
std::ostream &operator<<(std::ostream &stream, StringRef ref)
|
||||
{
|
||||
stream << std::string(ref);
|
||||
return stream;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &stream, StringRefNull ref)
|
||||
{
|
||||
stream << std::string(ref.data(), size_t(ref.size()));
|
||||
return stream;
|
||||
}
|
||||
|
||||
}
|
||||
26
source/blender/blenlib/intern/vector.cc
Normal file
26
source/blender/blenlib/intern/vector.cc
Normal file
@@ -0,0 +1,26 @@
|
||||
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
void blender::internal::vector_print_stats(StringRef name,
|
||||
void *address,
|
||||
int64_t size,
|
||||
int64_t capacity,
|
||||
int64_t inlineCapacity,
|
||||
int64_t memorySize)
|
||||
{
|
||||
std::cout << "Vector Stats: " << name << "\n";
|
||||
std::cout << " Address: " << address << "\n";
|
||||
std::cout << " Elements: " << size << "\n";
|
||||
std::cout << " Capacity: " << capacity << "\n";
|
||||
std::cout << " Inline Capacity: " << inlineCapacity << "\n";
|
||||
|
||||
char memory_size_str[BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE];
|
||||
BLI_str_format_byte_unit(memory_size_str, memorySize, true);
|
||||
std::cout << " Size on Stack: " << memory_size_str << "\n";
|
||||
}
|
||||
12
source/blender/blenlib/intern/virtual_array.cc
Normal file
12
source/blender/blenlib/intern/virtual_array.cc
Normal file
@@ -0,0 +1,12 @@
|
||||
/* SPDX-FileCopyrightText: 2023 Blender Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_virtual_array.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
void blender::internal::print_mutable_varray_span_warning()
|
||||
{
|
||||
std::cout << "Warning: Call `save()` to make sure that changes persist in all cases.\n";
|
||||
}
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "COM_shader_operation.hh"
|
||||
#include "COM_utilities.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::realtime_compositor {
|
||||
|
||||
using namespace nodes::derived_node_tree_types;
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "intern/node/deg_node_operation.h"
|
||||
#include "intern/node/deg_node_time.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace deg = blender::deg;
|
||||
namespace dot = blender::dot;
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
#include "eevee_private.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using blender::gpu::shader::StageInterfaceInfo;
|
||||
|
||||
void eevee_shader_material_create_info_amend(GPUMaterial *gpumat,
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#include "eevee_shader_shared.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::eevee {
|
||||
|
||||
class Instance;
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "eevee_instance.hh"
|
||||
#include "eevee_reflection_probes.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace blender::eevee {
|
||||
|
||||
void ReflectionProbeModule::init()
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#include "gpencil_shader.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace blender::draw::greasepencil {
|
||||
|
||||
ShaderModule *ShaderModule::g_shader_module = nullptr;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "draw_shader_shared.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
#if defined(DEBUG) || defined(WITH_DRAW_DEBUG)
|
||||
# define DRAW_DEBUG
|
||||
|
||||
@@ -55,6 +55,8 @@
|
||||
|
||||
#include "intern/gpu_codegen.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::draw {
|
||||
using namespace blender::draw;
|
||||
using namespace blender::draw::command;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "BKE_global.h"
|
||||
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
#include "draw_texture_pool.h"
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
#include "CLG_log.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
static CLG_LogRef LOG = {"ed.asset"};
|
||||
|
||||
namespace blender::ed::asset::index {
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
#include "AS_asset_catalog_path.hh"
|
||||
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#include "UI_interface.hh"
|
||||
|
||||
#include "BLI_string.h"
|
||||
|
||||
namespace blender::ui {
|
||||
|
||||
DragInfo::DragInfo(const wmDrag &drag, const wmEvent &event, const DropLocation drop_location)
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "UI_abstract_view.hh"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace blender::ui {
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
#include "node_intern.hh" /* own include */
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <sstream>
|
||||
|
||||
namespace geo_log = blender::nodes::geo_eval_log;
|
||||
using blender::bke::bNodeTreeZone;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* \ingroup spoutliner
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "tree_element_label.hh"
|
||||
#include "tree_element_overrides.hh"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace blender::ed::outliner {
|
||||
|
||||
class OverrideRNAPathTreeBuilder {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
#include "spreadsheet_row_filter.hh"
|
||||
#include "spreadsheet_row_filter_ui.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using namespace blender;
|
||||
using namespace blender::ed::spreadsheet;
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "spreadsheet_row_filter.hh"
|
||||
#include "spreadsheet_row_filter_ui.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using namespace blender;
|
||||
using namespace blender::ed::spreadsheet;
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include "FN_lazy_function_graph.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::fn::lazy_function {
|
||||
|
||||
Graph::~Graph()
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
*/
|
||||
|
||||
#include <mutex>
|
||||
#include <sstream>
|
||||
|
||||
#include "BLI_compute_context.hh"
|
||||
#include "BLI_enumerable_thread_specific.hh"
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "BLI_dot_export.hh"
|
||||
#include "BLI_stack.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::fn::multi_function {
|
||||
|
||||
void InstructionCursor::set_next(Procedure &procedure, Instruction *new_instruction) const
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_math_base.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "GPU_batch.h"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BLI_math_matrix.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_string_utils.h"
|
||||
|
||||
#include "GPU_capabilities.h"
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "gl_shader.hh"
|
||||
#include "gl_shader_interface.hh"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using namespace blender;
|
||||
using namespace blender::gpu;
|
||||
using namespace blender::gpu::shader;
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include "gpencil_io.h"
|
||||
#include "gpencil_io_export_pdf.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace blender ::io ::gpencil {
|
||||
|
||||
static void error_handler(HPDF_STATUS error_no, HPDF_STATUS detail_no, void * /*user_data*/)
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "BLI_math_vector.h"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_span.hh"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "DNA_gpencil_legacy_types.h"
|
||||
|
||||
@@ -28,6 +29,8 @@
|
||||
|
||||
#include "nanosvg.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using blender::MutableSpan;
|
||||
|
||||
namespace blender::io::gpencil {
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#include "ply_file_buffer.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace blender::io::ply {
|
||||
|
||||
FileBuffer::FileBuffer(const char *filepath, size_t buffer_chunk_size)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "BLI_fileops.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
|
||||
static inline bool is_newline(char ch)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "testing/testing.h"
|
||||
#include "tests/blendfile_loading_base_test.h"
|
||||
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "BKE_appdir.h"
|
||||
#include "BKE_blender_version.h"
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <sstream>
|
||||
|
||||
#include "BKE_attribute.hh"
|
||||
#include "BKE_blender_version.h"
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "obj_export_io.hh"
|
||||
#include "obj_export_mtl.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace blender::io::obj {
|
||||
|
||||
class OBJCurve;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <charconv>
|
||||
#include <iostream>
|
||||
|
||||
namespace blender::io::obj {
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "obj_import_mtl.hh"
|
||||
#include "obj_import_string_utils.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace blender::io::obj {
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "node_function_util.hh"
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::nodes::node_fn_value_to_string_cc {
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <sstream>
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user