HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
c-paramlist.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenImageIO project.
2 // SPDX-License-Identifier: BSD-3-Clause
3 // https://github.com/OpenImageIO/oiio
4 
5 #pragma once
6 
7 #include <OpenImageIO/export.h>
8 
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 /// OIIO_ParamValue holds a parameter and a pointer to its value(s)
16 ///
17 /// Nomenclature: if you have an array of 4 colors for each of 15 points...
18 /// - There are 15 VALUES
19 /// - Each value has an array of 4 ELEMENTS, each of which is a color
20 /// - A color has 3 COMPONENTS (R, G, B)
21 ///
23 
29 };
30 
31 /// Construct a new OIIO_ParamValue
33 OIIO_ParamValue_new(const char* name, OIIO_TypeDesc type, int nvalues,
34  int interp, const void* value, bool copy);
35 
36 /// Construct a new OIIO_ParamValue by parsing the given string
37 ///
38 /// Equivalent C++: `new ParamValue(name, type, string)`
39 ///
42  const char* string);
43 
44 /// Make a copy of the given OIIO_ParamValue
45 ///
46 /// Equivalent C++: `new ParamValue(*pv)`
47 ///
50 
51 /// Delete a OIIO_ParamValue
52 ///
53 /// Equivalent C++: `delete pv`
54 ///
55 OIIOC_API void
57 
58 ///
59 /// Equivalent C++: `pv->init(name, type, nvalues, interp, value, copy)`
60 ///
61 OIIOC_API void
63  int nvalues, int interp, const void* value, bool copy);
64 
65 ///
66 /// Equivalent C++: `pv->name()`
67 ///
68 OIIOC_API const char*
70 
71 ///
72 /// Equivalent C++: `pv->type()`
73 ///
76 
77 ///
78 /// Equivalent C++: `pv->nvalues()`
79 ///
80 OIIOC_API int
82 
83 ///
84 /// Equivalent C++: `pv->data()`
85 ///
86 OIIOC_API const void*
88 
89 ///
90 /// Equivalent C++: `pv->datasize()`
91 ///
92 OIIOC_API int
94 
95 ///
96 /// Equivalent C++: `pv->interp()`
97 ///
98 OIIOC_API int
100 
101 ///
102 /// Equivalent C++: `pv->is_nonlocal()`
103 ///
104 OIIOC_API bool
106 
107 /// Retrive an integer, with converstions from a wide variety of type
108 /// cases, including unsigned, short, byte. Not float. It will retrive
109 /// from a string, but only if the string is entirely a valid int
110 /// format. Unconvertible types return the default value.
111 ///
112 /// Equivalent C++: `pv->get_int(defaultval)`
113 ///
114 OIIOC_API int
115 OIIO_ParamValue_get_int(const OIIO_ParamValue* pv, int defaultval);
116 
117 /// Retrive an integer, with converstions from a wide variety of type
118 /// cases, including unsigned, short, byte. Not float. It will retrive
119 /// from a string, but only if the string is entirely a valid int
120 /// format. Unconvertible types return the default value.
121 ///
122 /// Equivalent C++: `pv->get_int_indexed(index, defaultval)`
123 ///
124 OIIOC_API int
126  int defaultval);
127 
128 /// Retrive a float, with converstions from a wide variety of type
129 /// cases, including integers. It will retrive from a string, but only
130 /// if the string is entirely a valid float format. Unconvertible types
131 /// return the default value.
132 ///
133 /// Equivalent C++: `pv->get_float(defaultval)`
134 ///
135 OIIOC_API float
136 OIIO_ParamValue_get_float(const OIIO_ParamValue* pv, float defaultval);
137 
138 /// Retrive a float, with converstions from a wide variety of type
139 /// cases, including integers. It will retrive from a string, but only
140 /// if the string is entirely a valid float format. Unconvertible types
141 /// return the default value.
142 ///
143 /// Equivalent C++: `pv->get_float_indexed(index, defaultval)`
144 ///
145 OIIOC_API float
147  float defaultval);
148 
149 /// Convert any type to a string value. An optional maximum number of
150 /// elements is also passed. In the case of a single string, just the
151 /// string directly is returned. But for an array of strings, the array
152 /// is returned as one string that's a comma-separated list of double-
153 /// quoted, escaped strings.
154 /// @param pv The ParamValue to get the string from
155 /// @param max_num_strings The maximum number of strings to get
156 /// @param buffer Caller-provided storage to put the string(s) into
157 /// @param buffer_len The length of the string storage. If the generated string
158 /// is longer than buffer_len it will be truncated to fit.
159 OIIOC_API void
160 OIIO_ParamValue_get_string(const OIIO_ParamValue* pv, int max_num_strings,
161  char* buffer, int buffer_len);
162 
163 /// Convert any type to a string value. An optional maximum number of
164 /// elements is also passed. In the case of a single string, just the
165 /// string directly is returned. But for an array of strings, the array
166 /// is returned as one string that's a comma-separated list of double-
167 /// quoted, escaped strings.
168 /// @param pv The ParamValue to get the string from
169 /// @param index The index into the array to get the string for
170 /// @param buffer Caller-provided storage to put the string(s) into
171 /// @param buffer_len The length of the string storage. If the generated string
172 /// is longer than buffer_len it will be truncated to fit.
173 OIIOC_API void
175  char* buffer, int buffer_len);
176 
177 
178 #ifdef __cplusplus
179 }
180 #endif
OIIOC_API void OIIO_ParamValue_delete(const OIIO_ParamValue *pv)
OIIOC_API int OIIO_ParamValue_datasize(const OIIO_ParamValue *pv)
OIIO_ParamValue_Interp
Definition: c-paramlist.h:24
OIIOC_API OIIO_TypeDesc OIIO_ParamValue_type(const OIIO_ParamValue *pv)
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
#define OIIOC_API
Definition: export.h:77
OIIOC_API void OIIO_ParamValue_get_string(const OIIO_ParamValue *pv, int max_num_strings, char *buffer, int buffer_len)
OIIOC_API int OIIO_ParamValue_get_int_indexed(const OIIO_ParamValue *pv, int index, int defaultval)
OIIOC_API OIIO_ParamValue * OIIO_ParamValue_from_string(const char *name, OIIO_TypeDesc type, const char *string)
OIIOC_API OIIO_ParamValue * OIIO_ParamValue_copy(OIIO_ParamValue *pv)
Definition: core.h:760
OIIOC_API int OIIO_ParamValue_get_int(const OIIO_ParamValue *pv, int defaultval)
OIIOC_API float OIIO_ParamValue_get_float(const OIIO_ParamValue *pv, float defaultval)
OIIOC_API const char * OIIO_ParamValue_name(const OIIO_ParamValue *pv)
OIIOC_API OIIO_ParamValue * OIIO_ParamValue_new(const char *name, OIIO_TypeDesc type, int nvalues, int interp, const void *value, bool copy)
Construct a new OIIO_ParamValue.
GLuint const GLchar * name
Definition: glcorearb.h:786
OIIOC_API void OIIO_ParamValue_get_string_indexed(const OIIO_ParamValue *pv, int index, char *buffer, int buffer_len)
OIIOC_API void OIIO_ParamValue_init(OIIO_ParamValue *pv, const char *name, OIIO_TypeDesc type, int nvalues, int interp, const void *value, bool copy)
GLuint index
Definition: glcorearb.h:786
struct OIIO_ParamValue OIIO_ParamValue
Definition: c-paramlist.h:22
Definition: core.h:1131
OIIOC_API int OIIO_ParamValue_nvalues(const OIIO_ParamValue *pv)
OIIOC_API int OIIO_ParamValue_interp(const OIIO_ParamValue *pv)
type
Definition: core.h:1059
OIIOC_API bool OIIO_ParamValue_is_nonlocal(const OIIO_ParamValue *pv)
OIIOC_API float OIIO_ParamValue_get_float_indexed(const OIIO_ParamValue *pv, int index, float defaultval)
OIIOC_API const void * OIIO_ParamValue_data(const OIIO_ParamValue *pv)