MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenImageIO / ParamValue_getitem

Function ParamValue_getitem

src/python/py_paramvalue.cpp:66–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66object ParamValue_getitem(const ParamValue& self, int n) {
67 if (n >= self.nvalues()) {
68 PyErr_SetString(PyExc_IndexError, "ParamValue index out of range");
69 throw_error_already_set();
70 }
71
72 TypeDesc t = self.type();
73
74#define ParamValue_convert_dispatch(TYPE) \
75 case TypeDesc::TYPE: \
76 return ParamValue_convert(t,n,(CType<TypeDesc::TYPE>::type*)self.data());
77
78 switch (t.basetype) {
79 ParamValue_convert_dispatch(UCHAR)
80 ParamValue_convert_dispatch(CHAR)
81 ParamValue_convert_dispatch(USHORT)
82 ParamValue_convert_dispatch(SHORT)
83 ParamValue_convert_dispatch(UINT)
84 ParamValue_convert_dispatch(INT)
85 ParamValue_convert_dispatch(ULONGLONG)
86 ParamValue_convert_dispatch(LONGLONG)
87#ifdef _HALF_H_
88 ParamValue_convert_dispatch(HALF)
89#endif
90 ParamValue_convert_dispatch(FLOAT)
91 ParamValue_convert_dispatch(DOUBLE)
92 case TypeDesc::STRING:
93 return ParamValue_convert(t, n, (ustring*)self.data());
94 default: return object();
95 }
96
97#undef ParamValue_convert_dispatch
98}
99
100
101static std::string

Callers 1

ParamValue_valueFunction · 0.85

Calls 3

ParamValue_convertFunction · 0.85
typeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected