GLSL Struct 1.4.0
glslstruct
Loading...
Searching...
No Matches
glslstruct::struct_type Class Reference

struct type container More...

#include <struct_type.hpp>

Inheritance diagram for glslstruct::struct_type:
[legend]
Collaboration diagram for glslstruct::struct_type:
[legend]

Public Member Functions

 struct_type (const mstd::ordered_map< std::string, var_data > &values, size_t size) noexcept
 constructor with struct values and type size
 struct_type (const struct_type &other) noexcept
 default copy constructor
 struct_type (struct_type &&other) noexcept
 default move constructor
 ~struct_type () noexcept override
 default destructor
struct_typeoperator= (const struct_type &other) noexcept
 default copy assign operator
struct_typeoperator= (struct_type &&other) noexcept
 default move assign operator
template<type_visitor T>
void accept (T &visitor) const
 accept function for type visitors
bool contains (std::string_view name) const noexcept
 returns true if struct type contains variable of given name
const mstd::ordered_map< std::string, var_data > & get_variables () const noexcept
 returns map with all values
mstd::ordered_map< std::string, var_dataget_top_level_variables () const noexcept
 returns map with all top level values
std::string to_string () const noexcept override
 converts type to string
Public Member Functions inherited from glslstruct::type< struct_type >
bool operator!= (const base_type &other) const noexcept
 default not equal operator
_GLSL_STRUCT_CONSTEXPR20 type (const size_t size) noexcept
 constructor with type size
virtual _GLSL_STRUCT_CONSTEXPR20 ~type () noexcept override=default
 default destructor
_GLSL_STRUCT_CONSTEXPR17 typeoperator= (const type &other) noexcept=default
 default copy assign operator
void accept (T &visitor) const
 accept function for type visitors
bool operator== (const base_type &other) const noexcept override
 equal operator
Public Member Functions inherited from glslstruct::base_type
 base_type (size_t size) noexcept
 constructor with type size
 base_type (const base_type &other) noexcept
 default copy constructor
 base_type (base_type &&other) noexcept
 default move constructor
virtual ~base_type () noexcept
 default virtual destructor
base_typeoperator= (const base_type &other) noexcept
 default copy assignment operator
base_typeoperator= (base_type &&other) noexcept
 default move assignment operator
template<type_visitor T>
void accept (T &visitor) const
 accept function for type_visitors
bool operator!= (const base_type &other) const noexcept
 default not equal operator
size_t get_size () const noexcept
 returns size of type

Private Types

using base_type = type

Private Attributes

mstd::ordered_map< std::string, var_data_variables
 map with all values of struct

Friends

struct std::hash< struct_type >
bool operator== (const struct_type &lhs, const struct_type &rhs)
 checks if two struct types are equal
bool operator!= (const struct_type &lhs, const struct_type &rhs)
 checks if two struct types are not equal

Additional Inherited Members

Protected Member Functions inherited from glslstruct::type< struct_type >
void _accept (const mstd::function_view< void(const scalar_type &)> scalarVisit, const mstd::function_view< void(const vec_type &)> vecVisit, const mstd::function_view< void(const mat_type &)> matVisit, const mstd::function_view< void(const struct_type &)> structVisit, const mstd::function_view< void(const array_type &)> arrayVisit) const override
 accept function overload
Protected Member Functions inherited from glslstruct::base_type
virtual void _accept (mstd::function_view< void(const scalar_type &)> scalarVisit, mstd::function_view< void(const vec_type &)> vecVisit, mstd::function_view< void(const mat_type &)> matVisit, mstd::function_view< void(const struct_type &)> structVisit, mstd::function_view< void(const array_type &)> arrayVisit) const =0
 accept function for type visitors

Detailed Description

struct type container

Member Typedef Documentation

◆ base_type

Constructor & Destructor Documentation

◆ struct_type() [1/3]

struct_type::struct_type ( const mstd::ordered_map< std::string, var_data > & values,
size_t size )
noexcept

constructor with struct values and type size

◆ struct_type() [2/3]

struct_type::struct_type ( const struct_type & other)
defaultnoexcept

default copy constructor

◆ struct_type() [3/3]

struct_type::struct_type ( struct_type && other)
defaultnoexcept

default move constructor

◆ ~struct_type()

struct_type::~struct_type ( )
overridedefaultnoexcept

default destructor

Member Function Documentation

◆ accept()

template<type_visitor T>
void glslstruct::struct_type::accept ( T & visitor) const
inline

accept function for type visitors

◆ contains()

bool struct_type::contains ( std::string_view name) const
nodiscardnoexcept

returns true if struct type contains variable of given name

◆ get_top_level_variables()

mstd::ordered_map< std::string, var_data > struct_type::get_top_level_variables ( ) const
nodiscardnoexcept

returns map with all top level values

◆ get_variables()

const mstd::ordered_map< std::string, var_data > & struct_type::get_variables ( ) const
nodiscardnoexcept

returns map with all values

◆ operator=() [1/2]

struct_type & struct_type::operator= ( const struct_type & other)
defaultnoexcept

default copy assign operator

◆ operator=() [2/2]

struct_type & struct_type::operator= ( struct_type && other)
defaultnoexcept

default move assign operator

◆ to_string()

std::string struct_type::to_string ( ) const
nodiscardoverridevirtualnoexcept

converts type to string

Implements glslstruct::base_type.

◆ operator!=

bool operator!= ( const struct_type & lhs,
const struct_type & rhs )
friend

checks if two struct types are not equal

◆ operator==

bool operator== ( const struct_type & lhs,
const struct_type & rhs )
friend

checks if two struct types are equal

◆ std::hash< struct_type >

friend struct std::hash< struct_type >
friend

Member Data Documentation

◆ _variables

mstd::ordered_map<std::string, var_data> glslstruct::struct_type::_variables
private

map with all values of struct