-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFieldList.h
More file actions
90 lines (77 loc) · 3.09 KB
/
FieldList.h
File metadata and controls
90 lines (77 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
///---------------------------------------------------------------------------------------------------
// file: Fields\FieldList.h
//
// summary: Declares the anisotropy list class
//
// Copyright (c) 2018 Alexander Neumann.
//
// author: Alexander
// date: 14.06.2018
#ifndef INC_FieldList_H
#define INC_FieldList_H
///---------------------------------------------------------------------------------------------------
#pragma once
#include <string_view>
#include <string>
#include <MyCEL/types/static_map.hpp>
//Forward Declare all Fields
template <typename prec>
class ZeroField;
template <typename prec>
class ConstantField;
template <typename prec>
class LissajousField;
template <typename prec>
class RectangularField;
template <typename prec>
class SinusoidalField;
template <typename prec>
class TriangularField;
template <typename prec>
class SincField;
template <typename prec>
class ModulatedSincField;
template <typename prec>
class SequenceField;
template <typename Field>
class FieldTraits;
namespace Properties
{
namespace
{
using namespace std::literals::string_view_literals;
}
/// <summary> Values that represent the used fields. </summary>
enum class IField {Field_Zero=1,Field_Constant, Field_Sinusoidal, Field_Lissajous,Field_Triangular, Field_Rectangular,Field_Sinc ,Field_Modsinc,Field_Sequence};
/// <summary> Map used to change the IField enum to a string and vice versa. </summary>
inline constexpr MyCEL::static_map<IField, std::string_view, 9> IFieldMap { { {
{ IField::Field_Zero, "none"sv },
{ IField::Field_Constant, "constant"sv },
{ IField::Field_Sinusoidal, "sinusoidal"sv },
{ IField::Field_Lissajous, "lissajous"sv },
{ IField::Field_Triangular,"triangular"sv },
{ IField::Field_Rectangular,"rectangular"sv },
{ IField::Field_Sinc,"sinc"sv },
{ IField::Field_Modsinc,"modsinc"sv },
{ IField::Field_Sequence,"sequence"sv },
} }};
inline constexpr auto IFieldValues{ IFieldMap.get_key_array() };
template<typename T>
T from_string(const std::string&);
template<IField value>
struct FieldSelector;
///-------------------------------------------------------------------------------------------------
/// <summary> Gets the enum IField from a string. </summary>
///
/// <param name="FieldString"> The string to transform </param>
///
/// <returns> An Enum representing the string </returns>
///-------------------------------------------------------------------------------------------------
template<>
IField from_string<IField>(const std::string& FieldString);
std::string to_string(const IField& field);
IField from_string(std::string_view, IField&);
std::string to_string(const IField& field);
}
#endif // INC_FieldList_H
// end of Fields\FieldList.h