identifier.h File Reference
Description
Simple integer-based handles used by mesh interfaces.
Code Example
identifier.h
//*****************************************************************************
// Copyright 1986, 2016 NVIDIA Corporation. All rights reserved.
//*****************************************************************************
//*****************************************************************************
#ifndef MI_NEURAYLIB_IDENTIFIER_H
#define MI_NEURAYLIB_IDENTIFIER_H
#include <mi/base/types.h>
#include <mi/neuraylib/version.h>
namespace mi {
namespace neuraylib {
enum Identifier_name {
HND_TRIANGLE,
HND_POLY,
HND_SURFACE,
HND_CURVE,
HND_CURVE_SEGMENT,
HND_TEXTURE_SURFACE,
HND_SCENE_GRAPH_VERSION,
HND_SCENE_GRAPH_NODE,
HND_SCENE_GRAPH_OBJECT_NODE,
HND_SCENE_GRAPH_LIGHT_NODE,
HND_SCENE_GRAPH_MESH,
HND_SCENE_GRAPH_MATERIAL,
HND_SCENE_GRAPH_DECAL_NODE
};
template <typename T> struct Invalid_identifier { };
template <> struct Invalid_identifier<Uint32>
{
static inline Uint32 value( ) { return 0xffffffff; }
};
template <> struct Invalid_identifier<Uint64>
{
static inline Uint64 value( ) { return 0xffffffffffffffffull; }
};
template <Identifier_name name, typename Int_type = Uint32>
struct Identifier_struct
{
Int_type m_id;
};
template <Identifier_name name, typename Int_type = Uint32>
class Identifier : public Identifier_struct<name, Int_type>
{
public:
Identifier( ) { this->m_id = Invalid_identifier<Int_type>::value(); }
explicit Identifier( Int_type h ) { this->m_id = h; }
Identifier( Identifier_struct< name, Int_type> h ) { this->m_id = h.m_id; }
operator Int_type() const { return this->m_id; }
Int_type operator*() const { return this->m_id; }
bool is_valid( ) const { return this->m_id != Invalid_identifier<Int_type>::value(); }
Identifier& operator++() { ++this->m_id; return *this; }
Identifier
operator++(int) { Identifier h(*this); ++this->m_id; return h; }
Identifier& operator--() { --this->m_id; return *this; }
Identifier
operator--(int) { Identifier h(*this); --this->m_id; return h; }
bool operator< ( const Identifier &other ) const { return this->m_id < other.m_id; }
bool operator< =( const Identifier &other ) const { return this->m_id <= other.m_id; }
bool operator>( const Identifier &other ) const { return this->m_id > other.m_id; }
bool operator>=( const Identifier &other ) const { return this->m_id >= other.m_id; }
};
// end group mi_neuray
typedef Identifier_struct< HND_TRIANGLE>
Triangle_handle_struct;
typedef Identifier_struct< HND_POLY>
Polygon_handle_struct;
typedef Identifier_struct< HND_SURFACE>
Surface_handle_struct;
typedef Identifier_struct< HND_CURVE>
Curve_handle_struct;
typedef Identifier_struct< HND_CURVE_SEGMENT>
Curve_segment_handle_struct;
typedef Identifier_struct< HND_TEXTURE_SURFACE>
Texture_surface_handle_struct;
typedef Identifier< HND_TRIANGLE>
Triangle_handle;
typedef Identifier< HND_POLY>
Polygon_handle;
typedef Identifier< HND_SURFACE>
Surface_handle;
typedef Identifier< HND_CURVE>
Curve_handle;
typedef Identifier< HND_CURVE_SEGMENT>
Curve_segment_handle;
typedef Identifier< HND_TEXTURE_SURFACE>
Texture_surface_handle;
} // namespace neuraylib
#ifdef MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION
using neuraylib::Curve_handle;
using neuraylib::Curve_handle_struct;
using neuraylib::Curve_segment_handle;
using neuraylib::Curve_segment_handle_struct;
using neuraylib::HND_CURVE;
using neuraylib::HND_CURVE_SEGMENT;
using neuraylib::HND_POLY;
using neuraylib::HND_SCENE_GRAPH_DECAL_NODE;
using neuraylib::HND_SCENE_GRAPH_LIGHT_NODE;
using neuraylib::HND_SCENE_GRAPH_MATERIAL;
using neuraylib::HND_SCENE_GRAPH_MESH;
using neuraylib::HND_SCENE_GRAPH_NODE;
using neuraylib::HND_SCENE_GRAPH_OBJECT_NODE;
using neuraylib::HND_SCENE_GRAPH_VERSION;
using neuraylib::HND_SURFACE;
using neuraylib::HND_TEXTURE_SURFACE;
using neuraylib::HND_TRIANGLE;
using neuraylib::Identifier;
using neuraylib::Identifier_name;
using neuraylib::Identifier_struct;
using neuraylib::Polygon_handle;
using neuraylib::Polygon_handle_struct;
using neuraylib::Surface_handle;
using neuraylib::Surface_handle_struct;
using neuraylib::Texture_surface_handle;
using neuraylib::Texture_surface_handle_struct;
using neuraylib::Triangle_handle;
using neuraylib::Triangle_handle_struct;
#endif // MI_NEURAYLIB_DEPRECATED_NAMESPACE_MI_TRANSITION
} // namespace mi
#endif // MI_NEURAYLIB_IDENTIFIER_H
Namespaces
- namespace
- Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...
- namespace
- Namespace for the neuray API. More...
Classes
Typedefs
- typedef Identifier< HND_CURVE>
- Handle for curve More...
- typedef Identifier_struct< HND_CURVE>
- Handle for curves More...
- typedef Identifier< HND_CURVE_SEGMENT>
- Handle for curve segments More...
- typedef Identifier_struct< HND_CURVE_SEGMENT>
- Handle for curve segments More...
- typedef Identifier< HND_POLY>
- Handle for polygons More...
- typedef Identifier_struct< HND_POLY>
- Handle for polygons More...
- typedef Identifier< HND_SURFACE>
- Handle for surfaces More...
- typedef Identifier_struct< HND_SURFACE>
- Handle for surfaces More...
- typedef Identifier< HND_TEXTURE_SURFACE>
- Handle for texture surfaces More...
- typedef Identifier_struct< HND_TEXTURE_SURFACE>
- Handle for texture surfaces More...
- typedef Identifier< HND_TRIANGLE>
- Handle for triangles More...
- typedef Identifier_struct< HND_TRIANGLE>
- Handle for triangles More...
Enumerations
- enum {HND_TRIANGLE, HND_POLY, HND_SURFACE, HND_CURVE, HND_CURVE_SEGMENT, HND_TEXTURE_SURFACE, HND_SCENE_GRAPH_VERSION, HND_SCENE_GRAPH_NODE, HND_SCENE_GRAPH_OBJECT_NODE, HND_SCENE_GRAPH_LIGHT_NODE, HND_SCENE_GRAPH_MESH, HND_SCENE_GRAPH_MATERIAL, HND_SCENE_GRAPH_DECAL_NODE }
- Various handle types. More...