uvgVPCCenc 1.2.0
uvgVPCCenc is an open-source real-time V-PCC encoder library written in C++ from scratch.
Loading...
Searching...
No Matches
parameterManager.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 * This file is part of uvgVPCCenc V-PCC encoder.
3 *
4 * Copyright (c) 2024, Tampere University, ITU/ISO/IEC, project contributors
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without modification,
8 * are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:
9 *
10 * * Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 * * Redistributions in binary form must reproduce the above copyright notice, this
14 * list of conditions and the following disclaimer in the documentation and/or
15 * other materials provided with the distribution.
16 *
17 * * Neither the name of Tampere University, ITU/ISO/IEC nor the names of its
18 * contributors may be used to endorse or promote products derived from
19 * this software without specific prior written permission.
20 *
21 * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
26 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 * INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON
29 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
32 ****************************************************************************/
33
35
36#pragma once
37
38#include <cstddef>
39#include <stdexcept>
40#include <string>
41#include <unordered_map>
42
43namespace uvgutils {
44
46
49 std::string possibleValues;
51 bool inPreset = false;
52
53 ParameterInfo(const ParameterType& type, const std::string& possibleValues, bool* parameterPtr)
55 if (type != BOOL) {
56 throw std::runtime_error(
57 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
58 "parameterType is: '" +
59 std::to_string(type) +
60 "' while the type of the parameter variable is BOOL (0). The corresponding variable name is not known, but here are its "
61 "possible values :'" +
62 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
63 }
64 }
67 if (type != INT) {
68 throw std::runtime_error(
69 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
70 "parameterType is: '" +
71 std::to_string(type) +
72 "' while the type of the parameter variable is INT (1). The corresponding variable name is not known, but here are its "
73 "possible values :'" +
74 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
75 }
76 }
77 ParameterInfo(const ParameterType& type, const std::string& possibleValues, size_t* parameterPtr)
79 if (type != UINT) {
80 throw std::runtime_error(
81 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
82 "parameterType is: '" +
83 std::to_string(type) +
84 "' while the type of the parameter variable is UINT (2). The corresponding variable name is not known, but here are its "
85 "possible values :'" +
86 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
87 }
88 }
89 ParameterInfo(const ParameterType& type, const std::string& possibleValues, std::string* parameterPtr)
91 if (type != STRING) {
92 throw std::runtime_error(
93 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
94 "parameterType is: '" +
95 std::to_string(type) +
96 "' while the type of the parameter variable is STRING (3). The corresponding variable name is not known, but here are its "
97 "possible values :'" +
98 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
99 }
100 }
101 ParameterInfo(const ParameterType& type, const std::string& possibleValues, float* parameterPtr)
103 if (type != FLOAT) {
104 throw std::runtime_error(
105 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
106 "parameterType is: '" +
107 std::to_string(type) +
108 "' while the type of the parameter variable is FLOAT (4). The corresponding variable name is not known, but here are its "
109 "possible values :'" +
110 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
111 }
112 }
113 ParameterInfo(const ParameterType& type, const std::string& possibleValues, double* parameterPtr)
115 if (type != DOUBLE) {
116 throw std::runtime_error(
117 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
118 "parameterType is: '" +
119 std::to_string(type) +
120 "' while the type of the parameter variable is DOUBLE (5). The corresponding variable name is not known, but here are its "
121 "possible values :'" +
122 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
123 }
124 }
125};
126
127using ParameterMap = std::unordered_map<std::string, ParameterInfo>;
128
129void setParameterValue(ParameterMap& parameterMap, const std::string& parameterName, const std::string& parameterValue,
130 bool fromPreset);
131
132} // namespace uvgutils
Definition jobManagement.hpp:50
void setParameterValue(ParameterMap &parameterMap, const std::string &parameterName, const std::string &parameterValue, bool fromPreset)
Definition parameterManager.cpp:169
ParameterType
Definition parameterManager.hpp:45
@ INT
Definition parameterManager.hpp:45
@ STRING
Definition parameterManager.hpp:45
@ FLOAT
Definition parameterManager.hpp:45
@ UINT
Definition parameterManager.hpp:45
@ DOUBLE
Definition parameterManager.hpp:45
@ BOOL
Definition parameterManager.hpp:45
std::unordered_map< std::string, ParameterInfo > ParameterMap
Definition parameterManager.hpp:127
Definition parameterManager.hpp:47
std::string possibleValues
Definition parameterManager.hpp:49
ParameterInfo(const ParameterType &type, const std::string &possibleValues, size_t *parameterPtr)
Definition parameterManager.hpp:77
ParameterInfo(const ParameterType &type, const std::string &possibleValues, float *parameterPtr)
Definition parameterManager.hpp:101
ParameterInfo(const ParameterType &type, const std::string &possibleValues, int *parameterPtr)
Definition parameterManager.hpp:65
ParameterInfo(const ParameterType &type, const std::string &possibleValues, bool *parameterPtr)
Definition parameterManager.hpp:53
bool inPreset
Definition parameterManager.hpp:51
void * parameterPtr
Definition parameterManager.hpp:50
ParameterInfo(const ParameterType &type, const std::string &possibleValues, std::string *parameterPtr)
Definition parameterManager.hpp:89
ParameterInfo(const ParameterType &type, const std::string &possibleValues, double *parameterPtr)
Definition parameterManager.hpp:113
ParameterType type
Definition parameterManager.hpp:48