HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
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>
26
class
HOM_PtrOrNull
27
{
28
public
:
29
HOM_PtrOrNull
(
T
*
pointer
= NULL)
30
:
myPointer
(
pointer
)
31
{}
32
33
T
*
myPointer
;
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);
43
$1 =
HOM_PtrOrNull<Type>
(
44
SWIG_IsOK(succeeded) ?
static_cast<
Type *
>
(
result
) : NULL);
45
}
46
%enddef
47
#endif
48
49
#endif
SOP_AttribCreate_2_0Enums::Type
Type
Definition:
SOP_AttribCreate-2.0.proto.h:90
result
**But if you need a result
Definition:
thread.h:613
OBJ_MatchTransform::T
pointer
GLenum void ** pointer
Definition:
glcorearb.h:810
HOM_PtrOrNull::myPointer
T * myPointer
Definition:
HOM_PtrOrNull.h:33
HOM_PtrOrNull::HOM_PtrOrNull
HOM_PtrOrNull(T *pointer=NULL)
Definition:
HOM_PtrOrNull.h:29
HOM_PtrOrNull
Definition:
HOM_PtrOrNull.h:26
HOM
HOM_PtrOrNull.h
Generated on Tue Dec 24 2024 02:40:31 for HDK by
1.8.6