Skip to content

Commit

Permalink
* More lowercasing of some stuff I had missed earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
harrand committed Jan 20, 2023
1 parent 970dfbd commit ca733d3
Show file tree
Hide file tree
Showing 35 changed files with 135 additions and 135 deletions.
2 changes: 1 addition & 1 deletion demo/core/engine_info_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

int main()
{
constexpr tz::EngineInfo info = tz::info();
constexpr tz::engine_info info = tz::info();
tz::report("Engine Info: %s", info.to_string().c_str());
}
4 changes: 2 additions & 2 deletions demo/gl/vk2/vk2_triangle_demo_large.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ int main()
},
.logical_device = &ldev,
}};
tz::BasicList<const DescriptorLayout*> alloc_layout_list;
tz::basic_list<const DescriptorLayout*> alloc_layout_list;
for(std::size_t i = 0; i < swapchain.get_images().size(); i++)
{
alloc_layout_list.add(&dlayout);
Expand Down Expand Up @@ -325,7 +325,7 @@ int main()
.pipeline = &graphics_pipeline,
.pipeline_context = PipelineContext::graphics
});
tz::BasicList<const DescriptorSet*> sets;
tz::basic_list<const DescriptorSet*> sets;
sets.resize(dpool_alloc.sets.length());
std::transform(dpool_alloc.sets.begin(), dpool_alloc.sets.end(), sets.begin(), [](const DescriptorSet& set){return &set;});

Expand Down
4 changes: 2 additions & 2 deletions demo/gl/vk2/vk2_triangle_demo_medium.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ int main()
},
.logical_device = &ldev,
}};
tz::BasicList<const DescriptorLayout*> alloc_layout_list;
tz::basic_list<const DescriptorLayout*> alloc_layout_list;
for(std::size_t i = 0; i < swapchain.get_images().size(); i++)
{
alloc_layout_list.add(&dlayout);
Expand Down Expand Up @@ -302,7 +302,7 @@ int main()
.pipeline = &graphics_pipeline,
.pipeline_context = PipelineContext::graphics
});
tz::BasicList<const DescriptorSet*> sets;
tz::basic_list<const DescriptorSet*> sets;
sets.resize(dpool_alloc.sets.length());
std::transform(dpool_alloc.sets.begin(), dpool_alloc.sets.end(), sets.begin(), [](const DescriptorSet& set){return &set;});

Expand Down
18 changes: 9 additions & 9 deletions src/tz/core/data/basic_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace tz
* @tparam Allocator Allocator type.
*/
template<typename T, typename Allocator = std::allocator<T>>
class BasicList
class basic_list
{
private:
using UnderlyingList = std::vector<T, Allocator>;
Expand All @@ -27,14 +27,14 @@ namespace tz
using ConstIterator = typename UnderlyingList::const_iterator;

/**
* Construct a BasicList using existing elements via copy.
* Construct a basic_list using existing elements via copy.
*/
BasicList(std::initializer_list<T> elements):
basic_list(std::initializer_list<T> elements):
elements(elements){}
/**
* Construct an empty BasicList.
* Construct an empty basic_list.
*/
BasicList() = default;
basic_list() = default;

/**
* Retrieve a span over the entire list.
Expand Down Expand Up @@ -113,7 +113,7 @@ namespace tz
* Copy the elements of another list to the end of this list.
* @param other Second list whose elements should be appended to the end of this list.
*/
void append(const BasicList<T>& other)
void append(const basic_list<T>& other)
{
this->elements.insert(this->elements.end(), other.elements.begin(), other.elements.end());
}
Expand Down Expand Up @@ -210,7 +210,7 @@ namespace tz
*/
const T& operator[](std::size_t index) const
{
tz::assert(this->length() > index, "tz::BasicList<T>::operator[%zu]: Out of range (length = %zu)", index, this->length());
tz::assert(this->length() > index, "tz::basic_list<T>::operator[%zu]: Out of range (length = %zu)", index, this->length());
return this->elements[index];
}

Expand All @@ -222,11 +222,11 @@ namespace tz
*/
T& operator[](std::size_t index)
{
tz::assert(this->length() > index, "tz::BasicList<T>::operator[%zu]: Out of range (length = %zu)", index, this->length());
tz::assert(this->length() > index, "tz::basic_list<T>::operator[%zu]: Out of range (length = %zu)", index, this->length());
return this->elements[index];
}

auto operator<=>(const tz::BasicList<T, Allocator>& rhs) const = default;
auto operator<=>(const tz::basic_list<T, Allocator>& rhs) const = default;

/**
* Erase the element at the given position.
Expand Down
20 changes: 10 additions & 10 deletions src/tz/core/data/enum_field.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ namespace tz
* @tparam E Enum class type.
*/
template<tz::enum_class E>
class EnumField
class enum_field
{
public:
/**
* Create an empty field.
*/
constexpr EnumField() = default;
constexpr enum_field() = default;
/**
* Create a field from the provided values.
*/
constexpr EnumField(std::initializer_list<E> types);
constexpr enum_field(std::initializer_list<E> types);
/**
* Create a field from a single value.
*/
constexpr EnumField(E type);
constexpr ~EnumField() = default;
constexpr enum_field(E type);
constexpr ~enum_field() = default;
/**
* Query as to whether the field contains the given value.
* @note The value is only contained if the exact value was inserted into the field, not if the field contains elements forming a bitwise equivalent.
Expand All @@ -41,7 +41,7 @@ namespace tz
* Query as to whether the field contains each element within another field.
* @return True if for each element `x` in the parameter field, `this->contains(x)`, otherwise false.
*/
bool contains(const EnumField<E>& field) const;
bool contains(const enum_field<E>& field) const;
/**
* Retrieve the number of elements within the field.
* @return number of elements within the field.
Expand All @@ -57,17 +57,17 @@ namespace tz
* @param type Element to add to the field.
* @return This.
*/
EnumField<E>& operator|=(E type);
enum_field<E>& operator|=(E type);
/**
* Add a field to another field. If this field contains 'C' and other field is comprised of 'A | B', this field will become 'C | A | B'.
*/
EnumField<E>& operator|=(const EnumField<E>& field);
enum_field<E>& operator|=(const enum_field<E>& field);
/**
* Create a copy of this field, but with the parameter element added. The cumulative value `C` of the field becomes `C | E`.
* @param type Element to add to the new field.
* @return A copy of this.
*/
EnumField<E> operator|(E type) const;
enum_field<E> operator|(E type) const;
/**
* Remove the enum value from the field, if it exists.
*/
Expand Down Expand Up @@ -104,7 +104,7 @@ namespace tz
* Query as to whether the elements of the field exactly match that of another field. This may return false even if the cumulative values are equivalent.
* @return True if fields contain same elements, otherwise false.
*/
bool operator==(const EnumField<E>& rhs) const = default;
bool operator==(const enum_field<E>& rhs) const = default;
/**
* Retrieve the cumulative value of the field.
*/
Expand Down
36 changes: 18 additions & 18 deletions src/tz/core/data/enum_field.inl
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
namespace tz
{
template<tz::enum_class E>
constexpr EnumField<E>::EnumField(E type):
constexpr enum_field<E>::enum_field(E type):
elements(type)
{}

template<tz::enum_class E>
constexpr EnumField<E>::EnumField(std::initializer_list<E> types):
constexpr enum_field<E>::enum_field(std::initializer_list<E> types):
elements(types)
{}

template<tz::enum_class E>
bool EnumField<E>::contains(E type) const
bool enum_field<E>::contains(E type) const
{
return std::find(this->elements.begin(), this->elements.end(), type) != this->elements.end();
}

template<tz::enum_class E>
bool EnumField<E>::contains(const EnumField<E>& field) const
bool enum_field<E>::contains(const enum_field<E>& field) const
{
for(E type : field.elements)
{
Expand All @@ -32,19 +32,19 @@ namespace tz
}

template<tz::enum_class E>
std::size_t EnumField<E>::count() const
std::size_t enum_field<E>::count() const
{
return this->elements.size();
}

template<tz::enum_class E>
bool EnumField<E>::empty() const
bool enum_field<E>::empty() const
{
return this->count() == 0;
}

template<tz::enum_class E>
EnumField<E>& EnumField<E>::operator|=(E type)
enum_field<E>& enum_field<E>::operator|=(E type)
{
{
this->elements.push_back(type);
Expand All @@ -53,7 +53,7 @@ namespace tz
}

template<tz::enum_class E>
EnumField<E>& EnumField<E>::operator|=(const EnumField<E>& field)
enum_field<E>& enum_field<E>::operator|=(const enum_field<E>& field)
{
for(E val : field)
{
Expand All @@ -63,56 +63,56 @@ namespace tz
}

template<tz::enum_class E>
EnumField<E> EnumField<E>::operator|(E type) const
enum_field<E> enum_field<E>::operator|(E type) const
{
EnumField<E> cpy = *this;
enum_field<E> cpy = *this;
return cpy |= type;
}

template<tz::enum_class E>
void EnumField<E>::remove(E type)
void enum_field<E>::remove(E type)
{
this->elements.erase(std::remove(this->elements.begin(), this->elements.end(), type), this->elements.end());
}

template<tz::enum_class E>
auto EnumField<E>::begin() const
auto enum_field<E>::begin() const
{
return this->elements.begin();
}

template<tz::enum_class E>
auto EnumField<E>::begin()
auto enum_field<E>::begin()
{
return this->elements.begin();
}

template<tz::enum_class E>
auto EnumField<E>::end() const
auto enum_field<E>::end() const
{
return this->elements.end();
}

template<tz::enum_class E>
auto EnumField<E>::end()
auto enum_field<E>::end()
{
return this->elements.end();
}

template<tz::enum_class E>
const E& EnumField<E>::front() const
const E& enum_field<E>::front() const
{
return this->elements.front();
}

template<tz::enum_class E>
const E& EnumField<E>::back() const
const E& enum_field<E>::back() const
{
return this->elements.back();
}

template<tz::enum_class E>
EnumField<E>::operator E() const
enum_field<E>::operator E() const
{
using UnderlyingType = std::underlying_type_t<E>;
if(this->elements.empty())
Expand Down
8 changes: 4 additions & 4 deletions src/tz/core/data/grid_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ namespace tz
* @ingroup tz_core_data
* A view into an array representing a flattened grid of data.
*
* Elements are interpreted as a tightly-packed array of rows. Each element is expected to be equivalent to a T[N]. For example, GridView on an RGBA32 image might be a `GridView<std::byte, 4>`.
* Elements are interpreted as a tightly-packed array of rows. Each element is expected to be equivalent to a T[N]. For example, grid_view on an RGBA32 image might be a `grid_view<std::byte, 4>`.
* @tparam T Underlying type of the element.
* @tparam N number of T's per element. Default 1.
*/
template<typename T, std::size_t N = 1>
class GridView
class grid_view
{
public:
/**
* Create a view over an existing array of grid data.
* @param data View over grid data.
* @param dimensions {x, y} where x is number of columns, and y is number of rows.
*/
GridView(std::span<T> data, tz::vec2ui dimensions);
grid_view(std::span<T> data, tz::vec2ui dimensions);
/**
* Create a view over an existing array of square grid data.
* @param data View over grid data.
* @param length Represents the number of columns and rows.
*/
GridView(std::span<T> data, unsigned int length);
grid_view(std::span<T> data, unsigned int length);
/**
* Retrieve the dimensions of the grid, in elements.
* @return {width, height}.
Expand Down
20 changes: 10 additions & 10 deletions src/tz/core/data/grid_view.inl
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,44 @@
namespace tz
{
template<typename T, std::size_t N>
GridView<T, N>::GridView(std::span<T> data, tz::vec2ui dimensions):
grid_view<T, N>::grid_view(std::span<T> data, tz::vec2ui dimensions):
data(data),
dimensions(dimensions)
{
if(this->data.size_bytes() < (this->dimensions[0] * this->dimensions[1] * sizeof(T) * N))
{
tz::report("GridView passed a span of unexpected size. View is %ux%u where each element is %zu bytes, for a expected buffer size of %zu, but buffer provided has %zu bytes.", this->dimensions[0], this->dimensions[1], sizeof(T) * N, (this->dimensions[0] * this->dimensions[1] * sizeof(T) * N), this->data.size_bytes());
tz::report("grid_view passed a span of unexpected size. View is %ux%u where each element is %zu bytes, for a expected buffer size of %zu, but buffer provided has %zu bytes.", this->dimensions[0], this->dimensions[1], sizeof(T) * N, (this->dimensions[0] * this->dimensions[1] * sizeof(T) * N), this->data.size_bytes());
}
}

template<typename T, std::size_t N>
GridView<T, N>::GridView(std::span<T> data, unsigned int length):
GridView<T, N>(data, {length, length}){}
grid_view<T, N>::grid_view(std::span<T> data, unsigned int length):
grid_view<T, N>(data, {length, length}){}

template<typename T, std::size_t N>
tz::vec2ui GridView<T, N>::get_dimensions() const
tz::vec2ui grid_view<T, N>::get_dimensions() const
{
return this->dimensions;
}

template<typename T, std::size_t N>
std::span<T> GridView<T, N>::span()
std::span<T> grid_view<T, N>::span()
{
return this->data;
}

template<typename T, std::size_t N>
std::span<const T> GridView<T, N>::span() const
std::span<const T> grid_view<T, N>::span() const
{
return this->data;
}

template<typename T, std::size_t N>
std::conditional_t<N == 1, T&, std::span<T>> GridView<T, N>::operator()(unsigned int x, unsigned int y)
std::conditional_t<N == 1, T&, std::span<T>> grid_view<T, N>::operator()(unsigned int x, unsigned int y)
{
std::size_t idx = ((y * this->dimensions[0]) + x) * N;
tz::assert(x < this->dimensions[0] && y < this->dimensions[1], "GridView access out of bounds. Dimensions = {%u, %u} must be > {%u, %u} which was requested", this->dimensions[0], this->dimensions[1], x, y);
tz::assert(idx < this->data.size(), "GridView access out of bounds. About to invoke UB.");
tz::assert(x < this->dimensions[0] && y < this->dimensions[1], "grid_view access out of bounds. Dimensions = {%u, %u} must be > {%u, %u} which was requested", this->dimensions[0], this->dimensions[1], x, y);
tz::assert(idx < this->data.size(), "grid_view access out of bounds. About to invoke UB.");
if constexpr(N == 1)
{
return this->data[idx];
Expand Down
2 changes: 1 addition & 1 deletion src/tz/core/data/polymorphic_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace tz
private:
using SmartPointer = std::unique_ptr<T>;
using SmartPointerConst = std::unique_ptr<const T>;
BasicList<SmartPointer, Allocator> elements;
basic_list<SmartPointer, Allocator> elements;
};

template<typename T>
Expand Down
Loading

0 comments on commit ca733d3

Please sign in to comment.