NVIDIA Iray API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
identifier.h
Go to the documentation of this file.
1
//*****************************************************************************
2
// Copyright 1986, 2014 NVIDIA Corporation. All rights reserved.
3
//*****************************************************************************
6
//*****************************************************************************
7
8
#ifndef MI_NEURAYLIB_IDENTIFIER_H
9
#define MI_NEURAYLIB_IDENTIFIER_H
10
11
#include <
mi/base/types.h
>
12
13
namespace
mi {
14
19
enum
Identifier_name
{
21
HND_TRIANGLE
,
22
HND_POLY
,
23
HND_SURFACE
,
24
HND_CURVE
,
25
HND_CURVE_SEGMENT
,
26
HND_TEXTURE_SURFACE
,
27
HND_SCENE_GRAPH_VERSION,
28
HND_SCENE_GRAPH_NODE,
29
HND_SCENE_GRAPH_OBJECT_NODE,
30
HND_SCENE_GRAPH_LIGHT_NODE,
31
HND_SCENE_GRAPH_MESH,
32
HND_SCENE_GRAPH_MATERIAL,
33
HND_SCENE_GRAPH_DECAL_NODE
34
};
35
36
template
<
typename
T>
struct
Invalid_identifier { };
37
template
<>
struct
Invalid_identifier<
Uint32
>
38
{
39
static
inline
Uint32
value( ) {
return
0xffffffff; }
40
};
41
42
template
<>
struct
Invalid_identifier<
Uint64
>
43
{
44
static
inline
Uint64
value( ) {
return
0xffffffffffffffffull; }
45
};
46
50
template
<Identifier_name name,
typename
Int_type = U
int
32>
51
struct
Identifier_struct
52
{
54
Int_type
m_id
;
55
};
56
60
template
<Identifier_name name,
typename
Int_type = U
int
32>
61
class
Identifier
:
public
Identifier_struct
<name, Int_type>
62
{
63
public
:
65
Identifier
( ) { this->
m_id
= Invalid_identifier<Int_type>::value(); }
66
68
explicit
Identifier
( Int_type h ) { this->
m_id
= h; }
69
71
Identifier
(
Identifier_struct<name, Int_type>
h ) { this->
m_id
= h.
m_id
; }
72
74
operator
Int_type()
const
{
return
this->
m_id
; }
75
77
Int_type
operator*
()
const
{
return
this->
m_id
; }
78
80
bool
is_valid
( )
const
{
return
this->
m_id
!= Invalid_identifier<Int_type>::value(); }
81
83
Identifier
&
operator++
() { ++this->
m_id
;
return
*
this
; }
84
86
Identifier
operator++
(
int
) {
Identifier
h(*
this
); ++this->
m_id
;
return
h; }
87
89
Identifier
&
operator--
() { --this->
m_id
;
return
*
this
; }
90
92
Identifier
operator--
(
int
) {
Identifier
h(*
this
); --this->
m_id
;
return
h; }
93
95
bool
operator<
(
const
Identifier
&other )
const
{
return
this->
m_id
< other.
m_id
; }
96
98
bool
operator<=
(
const
Identifier
&other )
const
{
return
this->
m_id
<= other.
m_id
; }
99
101
bool
operator>
(
const
Identifier
&other )
const
{
return
this->
m_id
> other.
m_id
; }
102
104
bool
operator>=
(
const
Identifier
&other )
const
{
return
this->
m_id
>= other.
m_id
; }
105
};
106
110
typedef
Identifier_struct<HND_TRIANGLE>
Triangle_handle_struct
;
111
115
typedef
Identifier_struct<HND_POLY>
Polygon_handle_struct
;
116
120
typedef
Identifier_struct<HND_SURFACE>
Surface_handle_struct
;
121
125
typedef
Identifier_struct<HND_CURVE>
Curve_handle_struct
;
126
130
typedef
Identifier_struct<HND_CURVE_SEGMENT>
Curve_segment_handle_struct
;
131
135
typedef
Identifier_struct<HND_TEXTURE_SURFACE>
Texture_surface_handle_struct
;
136
140
typedef
Identifier<HND_TRIANGLE>
Triangle_handle
;
141
145
typedef
Identifier<HND_POLY>
Polygon_handle
;
146
150
typedef
Identifier<HND_SURFACE>
Surface_handle
;
151
155
typedef
Identifier<HND_CURVE>
Curve_handle
;
156
160
typedef
Identifier<HND_CURVE_SEGMENT>
Curve_segment_handle
;
161
165
typedef
Identifier<HND_TEXTURE_SURFACE>
Texture_surface_handle
;
166
// end group mi_neuray
168
169
}
// namespace mi
170
171
#endif // MI_NEURAYLIB_IDENTIFIER_H
mi
neuraylib
identifier.h
Generated on Tue Aug 12 2014 15:28:34. Build 221133.3991, Doxygen 1.8.4