@@ -72,6 +72,111 @@ static bool isInstanceOf2( T &t, const char *n )
72
72
73
73
} // namespace Detail
74
74
75
+ // ////////////////////////////////////////////////////////////////////////
76
+ // RunTimeTypedWrapper
77
+ // ////////////////////////////////////////////////////////////////////////
78
+
79
+ template <typename T>
80
+ RunTimeTypedWrapper<T>::RunTimeTypedWrapper( PyObject *self )
81
+ : RefCountedWrapper<T>( self )
82
+ {
83
+ }
84
+
85
+ template <typename T>
86
+ template <typename Arg1>
87
+ RunTimeTypedWrapper<T>::RunTimeTypedWrapper( PyObject *self, Arg1 arg1 )
88
+ : RefCountedWrapper<T>( self, arg1 )
89
+ {
90
+ }
91
+
92
+ template <typename T>
93
+ template <typename Arg1, typename Arg2>
94
+ RunTimeTypedWrapper<T>::RunTimeTypedWrapper( PyObject *self, Arg1 arg1, Arg2 arg2 )
95
+ : RefCountedWrapper<T>( self, arg1, arg2 )
96
+ {
97
+ }
98
+
99
+ template <typename T>
100
+ template <typename Arg1, typename Arg2, typename Arg3>
101
+ RunTimeTypedWrapper<T>::RunTimeTypedWrapper( PyObject *self, Arg1 arg1, Arg2 arg2, Arg3 arg3 )
102
+ : RefCountedWrapper<T>( self, arg1, arg2, arg3 )
103
+ {
104
+ }
105
+
106
+ template <typename T>
107
+ IECore::TypeId RunTimeTypedWrapper<T>::typeId() const
108
+ {
109
+ if ( this ->isSubclassed () )
110
+ {
111
+ IECorePython::ScopedGILLock gilLock;
112
+ if ( boost::python::object f = this ->methodOverride ( " typeId" ) )
113
+ {
114
+ boost::python::object res = f ();
115
+ return boost::python::extract<IECore::TypeId>( res );
116
+ }
117
+ }
118
+ return T::typeId ();
119
+ }
120
+
121
+ template <typename T>
122
+ const char *RunTimeTypedWrapper<T>::typeName() const
123
+ {
124
+ if ( this ->isSubclassed () )
125
+ {
126
+ IECorePython::ScopedGILLock gilLock;
127
+ if ( boost::python::object f = this ->methodOverride ( " typeName" ) )
128
+ {
129
+ boost::python::object res = f ();
130
+ return boost::python::extract<const char *>( res );
131
+ }
132
+ }
133
+ return T::typeName ();
134
+ }
135
+
136
+ template <typename T>
137
+ bool RunTimeTypedWrapper<T>::isInstanceOf( IECore::TypeId typeId ) const
138
+ {
139
+ if ( T::isInstanceOf ( typeId ) )
140
+ {
141
+ return true ;
142
+ }
143
+
144
+ if ( this ->isSubclassed () )
145
+ {
146
+ IECorePython::ScopedGILLock gilLock;
147
+ if ( boost::python::object f = this ->methodOverride ( " isInstanceOf" ) )
148
+ {
149
+ boost::python::object res = f ( typeId );
150
+ return boost::python::extract<bool >( res );
151
+ }
152
+ }
153
+ return false ;
154
+ }
155
+
156
+ template <typename T>
157
+ bool RunTimeTypedWrapper<T>::isInstanceOf( const char *typeName ) const
158
+ {
159
+ if ( T::isInstanceOf ( typeName ) )
160
+ {
161
+ return true ;
162
+ }
163
+
164
+ if ( this ->isSubclassed () )
165
+ {
166
+ IECorePython::ScopedGILLock gilLock;
167
+ if ( boost::python::object f = this ->methodOverride ( " isInstanceOf" ) )
168
+ {
169
+ boost::python::object res = f ( typeName );
170
+ return boost::python::extract<bool >( res );
171
+ }
172
+ }
173
+ return false ;
174
+ }
175
+
176
+ // ////////////////////////////////////////////////////////////////////////
177
+ // RunTimeTypedClass
178
+ // ////////////////////////////////////////////////////////////////////////
179
+
75
180
template <typename T, typename Ptr>
76
181
RunTimeTypedClass<T, Ptr>::RunTimeTypedClass( const char *docString )
77
182
: BaseClass( Detail::nameWithoutNamespace( T::staticTypeName() ), docString )
0 commit comments