mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Expose getBounds().
This commit is contained in:
@@ -19,7 +19,8 @@ namespace
|
||||
inline constexpr pair_to_range_t pair_to_range{};
|
||||
}
|
||||
|
||||
Disk::Disk() {}
|
||||
Disk::Disk():
|
||||
image(std::make_shared<Image>()){}
|
||||
|
||||
Disk::Disk(
|
||||
const std::shared_ptr<const Image>& image, const DiskLayout& diskLayout):
|
||||
|
||||
@@ -313,24 +313,6 @@ DiskLayout::DiskLayout(unsigned numCylinders,
|
||||
{
|
||||
}
|
||||
|
||||
static DiskLayout::LayoutBounds getBounds(std::ranges::view auto keys)
|
||||
{
|
||||
DiskLayout::LayoutBounds r{.minCylinder = INT_MAX,
|
||||
.maxCylinder = INT_MIN,
|
||||
.minHead = INT_MAX,
|
||||
.maxHead = INT_MIN};
|
||||
|
||||
for (const auto& ch : keys)
|
||||
{
|
||||
r.minCylinder = std::min<int>(r.minCylinder, ch.cylinder);
|
||||
r.maxCylinder = std::max<int>(r.maxCylinder, ch.cylinder);
|
||||
r.minHead = std::min<int>(r.minHead, ch.head);
|
||||
r.maxHead = std::max<int>(r.maxHead, ch.head);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
DiskLayout::LayoutBounds DiskLayout::getPhysicalBounds() const
|
||||
{
|
||||
return getBounds(std::views::keys(layoutByPhysicalLocation));
|
||||
|
||||
@@ -148,6 +148,24 @@ public:
|
||||
int minCylinder, maxCylinder, minHead, maxHead;
|
||||
};
|
||||
|
||||
static LayoutBounds getBounds(std::ranges::view auto keys)
|
||||
{
|
||||
LayoutBounds r{.minCylinder = INT_MAX,
|
||||
.maxCylinder = INT_MIN,
|
||||
.minHead = INT_MAX,
|
||||
.maxHead = INT_MIN};
|
||||
|
||||
for (const auto& ch : keys)
|
||||
{
|
||||
r.minCylinder = std::min<int>(r.minCylinder, ch.cylinder);
|
||||
r.maxCylinder = std::max<int>(r.maxCylinder, ch.cylinder);
|
||||
r.minHead = std::min<int>(r.minHead, ch.head);
|
||||
r.maxHead = std::max<int>(r.maxHead, ch.head);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
LayoutBounds getPhysicalBounds() const;
|
||||
LayoutBounds getLogicalBounds() const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user