// Copyright (C) 2021 Jérôme "Lynix" Leclercq (lynix680@gmail.com) // This file is part of the "Nazara Engine - Shader module" // For conditions of distribution and use, see copyright notice in Config.hpp #include #include #include #include namespace Nz::ShaderAst { template AttributeValue::AttributeValue(T value) : m_value(std::move(value)) { } template AttributeValue::AttributeValue(ExpressionPtr expr) { assert(expr); m_value = std::move(expr); } template ExpressionPtr&& AttributeValue::GetExpression() && { if (!IsExpression()) throw std::runtime_error("excepted expression"); return std::get(std::move(m_value)); } template const ExpressionPtr& AttributeValue::GetExpression() const & { if (!IsExpression()) throw std::runtime_error("excepted expression"); assert(std::get(m_value)); return std::get(m_value); } template const T& AttributeValue::GetResultingValue() const { if (!IsResultingValue()) throw std::runtime_error("excepted resulting value"); return std::get(m_value); } template bool AttributeValue::IsExpression() const { return std::holds_alternative(m_value); } template bool AttributeValue::IsResultingValue() const { return std::holds_alternative(m_value); } template bool AttributeValue::HasValue() const { return !std::holds_alternative(m_value); } } #include