mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 13:55:58 +08:00
Add missing headers and replace size_t with std::size_t.
This commit is contained in:
parent
53e7a2d726
commit
5fd66d53ad
@ -5,6 +5,9 @@
|
|||||||
#ifndef slic3r_ProfilesSharingUtils_hpp_
|
#ifndef slic3r_ProfilesSharingUtils_hpp_
|
||||||
#define slic3r_ProfilesSharingUtils_hpp_
|
#define slic3r_ProfilesSharingUtils_hpp_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "Config.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
std::string get_json_printer_models(PrinterTechnology printer_technology);
|
std::string get_json_printer_models(PrinterTechnology printer_technology);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "DirectoriesUtils.hpp"
|
#include "DirectoriesUtils.hpp"
|
||||||
#include "../libslic3r.h"
|
#include "../libslic3r.h"
|
||||||
|
|
||||||
|
#include <boost/filesystem/path.hpp>
|
||||||
#include <boost/log/trivial.hpp>
|
#include <boost/log/trivial.hpp>
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include "JsonUtils.hpp"
|
#include "JsonUtils.hpp"
|
||||||
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
|
#include <regex>
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
//
|
//
|
||||||
// Return the size of the palette, in bytes
|
// Return the size of the palette, in bytes
|
||||||
//
|
//
|
||||||
size_t size_in_bytes_cpu() const;
|
std::size_t size_in_bytes_cpu() const;
|
||||||
|
|
||||||
static const ColorRange DUMMY_COLOR_RANGE;
|
static const ColorRange DUMMY_COLOR_RANGE;
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ private:
|
|||||||
//
|
//
|
||||||
// Count of different values passed to update()
|
// Count of different values passed to update()
|
||||||
//
|
//
|
||||||
size_t m_count{ 0 };
|
std::size_t m_count{ 0 };
|
||||||
|
|
||||||
//
|
//
|
||||||
// Use the passed value to update the range.
|
// Use the passed value to update the range.
|
||||||
@ -104,4 +104,4 @@ private:
|
|||||||
|
|
||||||
} // namespace libvgcode
|
} // namespace libvgcode
|
||||||
|
|
||||||
#endif // VGCODE_COLORRANGE_HPP
|
#endif // VGCODE_COLORRANGE_HPP
|
||||||
|
@ -72,7 +72,7 @@ using AABox = std::array<Vec3, 2>;
|
|||||||
// [0] -> min
|
// [0] -> min
|
||||||
// [1] -> max
|
// [1] -> max
|
||||||
//
|
//
|
||||||
using Interval = std::array<size_t, 2>;
|
using Interval = std::array<std::size_t, 2>;
|
||||||
|
|
||||||
//
|
//
|
||||||
// View types
|
// View types
|
||||||
@ -95,7 +95,7 @@ enum class EViewType : uint8_t
|
|||||||
COUNT
|
COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr size_t VIEW_TYPES_COUNT = static_cast<size_t>(EViewType::COUNT);
|
static constexpr std::size_t VIEW_TYPES_COUNT = static_cast<std::size_t>(EViewType::COUNT);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Move types
|
// Move types
|
||||||
@ -116,7 +116,7 @@ enum class EMoveType : uint8_t
|
|||||||
COUNT
|
COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr size_t MOVE_TYPES_COUNT = static_cast<size_t>(EMoveType::COUNT);
|
static constexpr std::size_t MOVE_TYPES_COUNT = static_cast<std::size_t>(EMoveType::COUNT);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extrusion roles
|
// Extrusion roles
|
||||||
@ -141,7 +141,7 @@ enum class EGCodeExtrusionRole : uint8_t
|
|||||||
COUNT
|
COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr size_t GCODE_EXTRUSION_ROLES_COUNT = static_cast<size_t>(EGCodeExtrusionRole::COUNT);
|
static constexpr std::size_t GCODE_EXTRUSION_ROLES_COUNT = static_cast<std::size_t>(EGCodeExtrusionRole::COUNT);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Option types
|
// Option types
|
||||||
@ -164,7 +164,7 @@ enum class EOptionType : uint8_t
|
|||||||
COUNT
|
COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr size_t OPTION_TYPES_COUNT = static_cast<size_t>(EOptionType::COUNT);
|
static constexpr std::size_t OPTION_TYPES_COUNT = static_cast<std::size_t>(EOptionType::COUNT);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Time modes
|
// Time modes
|
||||||
@ -176,7 +176,7 @@ enum class ETimeMode : uint8_t
|
|||||||
COUNT
|
COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr size_t TIME_MODES_COUNT = static_cast<size_t>(ETimeMode::COUNT);
|
static constexpr std::size_t TIME_MODES_COUNT = static_cast<std::size_t>(ETimeMode::COUNT);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Color range types
|
// Color range types
|
||||||
@ -188,7 +188,7 @@ enum class EColorRangeType : uint8_t
|
|||||||
COUNT
|
COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr size_t COLOR_RANGE_TYPES_COUNT = static_cast<size_t>(EColorRangeType::COUNT);
|
static constexpr std::size_t COLOR_RANGE_TYPES_COUNT = static_cast<std::size_t>(EColorRangeType::COUNT);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Predefined colors
|
// Predefined colors
|
||||||
|
@ -20,22 +20,22 @@ template<typename T = unsigned long long>
|
|||||||
struct BitSet
|
struct BitSet
|
||||||
{
|
{
|
||||||
BitSet() = default;
|
BitSet() = default;
|
||||||
BitSet(size_t size) : size(size), blocks(1 + (size / (sizeof(T) * 8))) { clear(); }
|
BitSet(std::size_t size) : size(size), blocks(1 + (size / (sizeof(T) * 8))) { clear(); }
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
for (size_t i = 0; i < blocks.size(); ++i) {
|
for (std::size_t i = 0; i < blocks.size(); ++i) {
|
||||||
blocks[i] &= T(0);
|
blocks[i] &= T(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAll() {
|
void setAll() {
|
||||||
for (size_t i = 0; i < blocks.size(); ++i) {
|
for (std::size_t i = 0; i < blocks.size(); ++i) {
|
||||||
blocks[i] |= ~T(0);
|
blocks[i] |= ~T(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//return true if bit changed
|
//return true if bit changed
|
||||||
bool set(size_t index) {
|
bool set(std::size_t index) {
|
||||||
const auto [block_idx, bit_idx] = get_coords(index);
|
const auto [block_idx, bit_idx] = get_coords(index);
|
||||||
const T mask = (T(1) << bit_idx);
|
const T mask = (T(1) << bit_idx);
|
||||||
bool flip = mask ^ blocks[block_idx];
|
bool flip = mask ^ blocks[block_idx];
|
||||||
@ -44,7 +44,7 @@ struct BitSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
//return true if bit changed
|
//return true if bit changed
|
||||||
bool reset(size_t index) {
|
bool reset(std::size_t index) {
|
||||||
const auto [block_idx, bit_idx] = get_coords(index);
|
const auto [block_idx, bit_idx] = get_coords(index);
|
||||||
const T mask = (T(1) << bit_idx);
|
const T mask = (T(1) << bit_idx);
|
||||||
const bool flip = mask ^ blocks[block_idx];
|
const bool flip = mask ^ blocks[block_idx];
|
||||||
@ -52,7 +52,7 @@ struct BitSet
|
|||||||
return flip;
|
return flip;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator [] (size_t index) const {
|
bool operator [] (std::size_t index) const {
|
||||||
const auto [block_idx, bit_idx] = get_coords(index);
|
const auto [block_idx, bit_idx] = get_coords(index);
|
||||||
return ((blocks[block_idx] >> bit_idx) & 1) != 0;
|
return ((blocks[block_idx] >> bit_idx) & 1) != 0;
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ struct BitSet
|
|||||||
template<typename U>
|
template<typename U>
|
||||||
BitSet& operator &= (const BitSet<U>& other) {
|
BitSet& operator &= (const BitSet<U>& other) {
|
||||||
static_assert(sizeof(T) == sizeof(U), "Type1 and Type2 must be of the same size.");
|
static_assert(sizeof(T) == sizeof(U), "Type1 and Type2 must be of the same size.");
|
||||||
for (size_t i = 0; i < blocks.size(); ++i) {
|
for (std::size_t i = 0; i < blocks.size(); ++i) {
|
||||||
blocks[i] &= other.blocks[i];
|
blocks[i] &= other.blocks[i];
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
@ -68,7 +68,7 @@ struct BitSet
|
|||||||
|
|
||||||
// Atomic set operation (enabled only for atomic types), return true if bit changed
|
// Atomic set operation (enabled only for atomic types), return true if bit changed
|
||||||
template<typename U = T>
|
template<typename U = T>
|
||||||
inline typename std::enable_if<is_atomic<U>, bool>::type set_atomic(size_t index) {
|
inline typename std::enable_if<is_atomic<U>, bool>::type set_atomic(std::size_t index) {
|
||||||
const auto [block_idx, bit_idx] = get_coords(index);
|
const auto [block_idx, bit_idx] = get_coords(index);
|
||||||
const T mask = static_cast<T>(1) << bit_idx;
|
const T mask = static_cast<T>(1) << bit_idx;
|
||||||
const T oldval = blocks[block_idx].fetch_or(mask, std::memory_order_relaxed);
|
const T oldval = blocks[block_idx].fetch_or(mask, std::memory_order_relaxed);
|
||||||
@ -77,27 +77,27 @@ struct BitSet
|
|||||||
|
|
||||||
// Atomic reset operation (enabled only for atomic types), return true if bit changed
|
// Atomic reset operation (enabled only for atomic types), return true if bit changed
|
||||||
template<typename U = T>
|
template<typename U = T>
|
||||||
inline typename std::enable_if<is_atomic<U>, bool>::type reset_atomic(size_t index) {
|
inline typename std::enable_if<is_atomic<U>, bool>::type reset_atomic(std::size_t index) {
|
||||||
const auto [block_idx, bit_idx] = get_coords(index);
|
const auto [block_idx, bit_idx] = get_coords(index);
|
||||||
const T mask = ~(static_cast<T>(1) << bit_idx);
|
const T mask = ~(static_cast<T>(1) << bit_idx);
|
||||||
const T oldval = blocks[block_idx].fetch_and(mask, std::memory_order_relaxed);
|
const T oldval = blocks[block_idx].fetch_and(mask, std::memory_order_relaxed);
|
||||||
return oldval ^ (oldval and mask);
|
return oldval ^ (oldval and mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<size_t, size_t> get_coords(size_t index) const {
|
std::pair<std::size_t, std::size_t> get_coords(std::size_t index) const {
|
||||||
const size_t block_idx = index / (sizeof(T) * 8);
|
const std::size_t block_idx = index / (sizeof(T) * 8);
|
||||||
const size_t bit_idx = index % (sizeof(T) * 8);
|
const std::size_t bit_idx = index % (sizeof(T) * 8);
|
||||||
return { block_idx, bit_idx };
|
return { block_idx, bit_idx };
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size_in_bytes_cpu() const {
|
std::size_t size_in_bytes_cpu() const {
|
||||||
return blocks.size() * sizeof(T);
|
return blocks.size() * sizeof(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size{ 0 };
|
std::size_t size{ 0 };
|
||||||
std::vector<T> blocks{ 0 };
|
std::vector<T> blocks{ 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace libvgcode
|
} // namespace libvgcode
|
||||||
|
|
||||||
#endif // VGCODE_BITSET_HPP
|
#endif // VGCODE_BITSET_HPP
|
||||||
|
@ -12,7 +12,7 @@ void ExtrusionRoles::add(EGCodeExtrusionRole role, const std::array<float, TIME_
|
|||||||
if (role_it == m_items.end())
|
if (role_it == m_items.end())
|
||||||
role_it = m_items.insert(std::make_pair(role, Item())).first;
|
role_it = m_items.insert(std::make_pair(role, Item())).first;
|
||||||
|
|
||||||
for (size_t i = 0; i < TIME_MODES_COUNT; ++i) {
|
for (std::size_t i = 0; i < TIME_MODES_COUNT; ++i) {
|
||||||
role_it->second.times[i] += times[i];
|
role_it->second.times[i] += times[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ float ExtrusionRoles::get_time(EGCodeExtrusionRole role, ETimeMode mode) const
|
|||||||
if (role_it == m_items.end())
|
if (role_it == m_items.end())
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
return (mode < ETimeMode::COUNT) ? role_it->second.times[static_cast<size_t>(mode)] : 0.0f;
|
return (mode < ETimeMode::COUNT) ? role_it->second.times[static_cast<std::size_t>(mode)] : 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace libvgcode
|
} // namespace libvgcode
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
|
|
||||||
void add(EGCodeExtrusionRole role, const std::array<float, TIME_MODES_COUNT>& times);
|
void add(EGCodeExtrusionRole role, const std::array<float, TIME_MODES_COUNT>& times);
|
||||||
|
|
||||||
size_t get_roles_count() const { return m_items.size(); }
|
std::size_t get_roles_count() const { return m_items.size(); }
|
||||||
std::vector<EGCodeExtrusionRole> get_roles() const;
|
std::vector<EGCodeExtrusionRole> get_roles() const;
|
||||||
float get_time(EGCodeExtrusionRole role, ETimeMode mode) const;
|
float get_time(EGCodeExtrusionRole role, ETimeMode mode) const;
|
||||||
|
|
||||||
|
@ -18,29 +18,29 @@ public:
|
|||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
bool empty() const { return m_items.empty(); }
|
bool empty() const { return m_items.empty(); }
|
||||||
size_t count() const { return m_items.size(); }
|
std::size_t count() const { return m_items.size(); }
|
||||||
|
|
||||||
std::vector<float> get_times(ETimeMode mode) const;
|
std::vector<float> get_times(ETimeMode mode) const;
|
||||||
std::vector<float> get_zs() const;
|
std::vector<float> get_zs() const;
|
||||||
|
|
||||||
float get_layer_time(ETimeMode mode, size_t layer_id) const {
|
float get_layer_time(ETimeMode mode, std::size_t layer_id) const {
|
||||||
return (mode < ETimeMode::COUNT&& layer_id < m_items.size()) ?
|
return (mode < ETimeMode::COUNT&& layer_id < m_items.size()) ?
|
||||||
m_items[layer_id].times[static_cast<size_t>(mode)] : 0.0f;
|
m_items[layer_id].times[static_cast<std::size_t>(mode)] : 0.0f;
|
||||||
}
|
}
|
||||||
float get_layer_z(size_t layer_id) const {
|
float get_layer_z(std::size_t layer_id) const {
|
||||||
return (layer_id < m_items.size()) ? m_items[layer_id].z : 0.0f;
|
return (layer_id < m_items.size()) ? m_items[layer_id].z : 0.0f;
|
||||||
}
|
}
|
||||||
size_t get_layer_id_at(float z) const;
|
std::size_t get_layer_id_at(float z) const;
|
||||||
|
|
||||||
const Interval& get_view_range() const { return m_view_range.get(); }
|
const Interval& get_view_range() const { return m_view_range.get(); }
|
||||||
void set_view_range(const Interval& range) { set_view_range(range[0], range[1]); }
|
void set_view_range(const Interval& range) { set_view_range(range[0], range[1]); }
|
||||||
void set_view_range(Interval::value_type min, Interval::value_type max) { m_view_range.set(min, max); }
|
void set_view_range(Interval::value_type min, Interval::value_type max) { m_view_range.set(min, max); }
|
||||||
|
|
||||||
bool layer_contains_colorprint_options(size_t layer_id) const {
|
bool layer_contains_colorprint_options(std::size_t layer_id) const {
|
||||||
return (layer_id < m_items.size()) ? m_items[layer_id].contains_colorprint_options : false;
|
return (layer_id < m_items.size()) ? m_items[layer_id].contains_colorprint_options : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size_in_bytes_cpu() const;
|
std::size_t size_in_bytes_cpu() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Item
|
struct Item
|
||||||
@ -57,4 +57,4 @@ private:
|
|||||||
|
|
||||||
} // namespace libvgcode
|
} // namespace libvgcode
|
||||||
|
|
||||||
#endif // VGCODE_LAYERS_HPP
|
#endif // VGCODE_LAYERS_HPP
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "libslic3r/Config.hpp"
|
#include "libslic3r/Config.hpp"
|
||||||
|
|
||||||
#include <boost/nowide/fstream.hpp>
|
#include <boost/nowide/fstream.hpp>
|
||||||
|
#include <boost/nowide/convert.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/log/trivial.hpp>
|
#include <boost/log/trivial.hpp>
|
||||||
#include <boost/dll/runtime_symbol_info.hpp>
|
#include <boost/dll/runtime_symbol_info.hpp>
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "libslic3r/AppConfig.hpp"
|
#include "libslic3r/AppConfig.hpp"
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <condition_variable>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
@ -89,4 +90,4 @@ private:
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "slic3r/GUI/UserAccount.hpp"
|
#include "slic3r/GUI/UserAccount.hpp"
|
||||||
|
|
||||||
#include <boost/log/trivial.hpp>
|
#include <boost/log/trivial.hpp>
|
||||||
|
#include <boost/nowide/convert.hpp>
|
||||||
#include <boost/property_tree/ptree.hpp>
|
#include <boost/property_tree/ptree.hpp>
|
||||||
#include <boost/property_tree/json_parser.hpp>
|
#include <boost/property_tree/json_parser.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user