HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_PtrOrNull.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  * This class is used to tell swig that a function can accept any object
8  * without raising a TypeError exception. The result is a pointer to the
9  * desired type if an object of that type was actually passed in, or null
10  * otherwise.
11  *
12  * Use this class as follows:
13  *
14  * bool isNode(HOM_PtrOrNull<HOM_Node> node)
15  * {
16  * return (node.myPointer != NULL);
17  * }
18  */
19 
20 #ifndef __HOM_PtrOrNull_h__
21 #define __HOM_PtrOrNull_h__
22 
23 #include <string.h>
24 
25 template <typename T>
27 {
28 public:
31  {}
32 
34 };
35 
36 #ifdef SWIG
37 // This macro adds a typemap to convert swig interpreter objects into
38 // HOM_PtrOrNull<Type> objects.
39 %define %add_ptr_or_null_typemap(Type)
40 %typemap(in) HOM_PtrOrNull<Type> {
41  void *result = NULL;
42  int succeeded = SWIG_ConvertPtr($input, &result, SWIGTYPE_p_ ## Type, 0);
44  SWIG_IsOK(succeeded) ? static_cast<Type *>(result) : NULL);
45 }
46 %enddef
47 #endif
48 
49 #endif
**But if you need a result
Definition: thread.h:613
GLenum void ** pointer
Definition: glcorearb.h:810
HOM_PtrOrNull(T *pointer=NULL)
Definition: HOM_PtrOrNull.h:29