Iray SDK API nvidia_logo_transpbg.gif Up
iserializer.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2024 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_ISERIALIZER_H
8#define MI_NEURAYLIB_ISERIALIZER_H
9
11
12namespace mi {
13
14namespace neuraylib {
15
16class ISerializer;
17class IDeserializer;
18
45{
48};
49
53class Tag : public Tag_struct
54{
55public:
59 Tag() { id = 0; }
60
62 Tag( Tag_struct tag_struct) { id = tag_struct.id; }
63
65 bool is_valid() const { return id != 0; }
66
71 typedef bool (Tag::*bool_conversion_support)() const;
72
85 operator bool_conversion_support() const
86 {
87 return is_valid() ? &Tag::is_valid : 0;
88 }
89};
90
92inline bool operator==( const Tag& lhs, const Tag& rhs)
93{
94 return lhs.id == rhs.id;
95}
96
98inline bool operator!=( const Tag& lhs, const Tag& rhs)
99{
100 return lhs.id != rhs.id;
101}
102
104inline bool operator<( const Tag& lhs, const Tag& rhs)
105{
106 return lhs.id < rhs.id;
107}
108
110inline bool operator>( const Tag& lhs, const Tag& rhs)
111{
112 return lhs.id > rhs.id;
113}
114
116inline bool operator<=( const Tag& lhs, const Tag& rhs)
117{
118 return lhs.id <= rhs.id;
119}
120
122inline bool operator>=( const Tag& lhs, const Tag& rhs)
123{
124 return lhs.id >= rhs.id;
125}
126
129
136 public base::Interface_declare<0x7a70f2fb,0x1b27,0x416f,0xaa,0x21,0x16,0xc7,0xb4,0xd4,0x1f,0xfc>
137{
138public:
146 virtual base::Uuid get_class_id() const = 0;
147
152 virtual void serialize( ISerializer* serializer) const = 0;
153
158 virtual void deserialize( IDeserializer* deserializer) = 0;
159};
160
170 public base::Interface_declare<0xdcf5a659,0x2b06,0x436b,0x82,0x55,0x36,0x9d,0xbd,0xe7,0x42,0xb1>
171{
172public:
177 virtual bool serialize( const ISerializable* serializable) = 0;
178
184 virtual bool write( const bool* value, Size count = 1) = 0;
185
191 virtual bool write( const Uint8* value, Size count = 1) = 0;
192
198 virtual bool write( const Uint16* value, Size count = 1) = 0;
199
205 virtual bool write( const Uint32* value, Size count = 1) = 0;
206
212 virtual bool write( const Uint64* value, Size count = 1) = 0;
213
219 virtual bool write( const Sint8* value, Size count = 1) = 0;
220
226 virtual bool write( const Sint16* value, Size count = 1) = 0;
227
233 virtual bool write( const Sint32* value, Size count = 1) = 0;
234
240 virtual bool write( const Sint64* value, Size count = 1) = 0;
241
247 virtual bool write( const Float32* value, Size count = 1) = 0;
248
254 virtual bool write( const Float64* value, Size count = 1) = 0;
255
261 virtual void reserve( Size capacity) = 0;
262
271 virtual void flush() = 0;
272
278 virtual bool write( const Tag_struct* value, Size count = 1) = 0;
279};
280 // end group mi_neuray_plugins / mi_neuray_dice
282
291{
292public:
296 virtual Uint64 get_thread_id() const = 0;
297};
298 // end group mi_neuray_database_access/mi_neuray_dice
300
301} // namespace neuraylib
302
303} // namespace mi
304
305#endif // MI_NEURAYLIB_ISERIALIZER_H
Mixin class template for deriving new interface declarations.
Definition: interface_declare.h:43
Source for deserializing objects from byte streams.
Definition: ideserializer.h:35
Provides information about the context in which a job is executed.
Definition: iserializer.h:291
virtual Uint64 get_thread_id() const =0
Returns the thread ID.
All serializable objects have to be derived from this interface.
Definition: iserializer.h:137
virtual void deserialize(IDeserializer *deserializer)=0
Deserializes the object from the given deserializer.
virtual base::Uuid get_class_id() const =0
Returns the class ID of the object.
virtual void serialize(ISerializer *serializer) const =0
Serializes the object to the given serializer.
Target for serializing objects to byte streams.
Definition: iserializer.h:171
virtual bool write(const Float32 *value, Size count=1)=0
Writes values of type mi::Float32 to the serializer.
virtual bool write(const Sint16 *value, Size count=1)=0
Writes values of type mi::Sint16 to the serializer.
virtual bool write(const Uint32 *value, Size count=1)=0
Writes values of type mi::Size to the serializer.
virtual bool write(const Sint64 *value, Size count=1)=0
Writes values of type mi::Sint64 to the serializer.
virtual bool write(const Sint32 *value, Size count=1)=0
Writes values of type mi::Sint32 to the serializer.
virtual bool write(const bool *value, Size count=1)=0
Writes values of type bool to the serializer.
virtual void reserve(Size capacity)=0
Gives a hint to the serializer about the required buffer size.
virtual void flush()=0
Flushes the so-far serialized data.
virtual bool serialize(const ISerializable *serializable)=0
Writes a serializable object to the serializer.
virtual bool write(const Tag_struct *value, Size count=1)=0
Writes values of type mi::neuraylib::Tag_struct to the serializer.
virtual bool write(const Float64 *value, Size count=1)=0
Writes values of type mi::Float64 to the serializer.
virtual bool write(const Sint8 *value, Size count=1)=0
Writes values of type mi::Sint8 to the serializer.
virtual bool write(const Uint16 *value, Size count=1)=0
Writes values of type mi::Uint16 to the serializer.
virtual bool write(const Uint8 *value, Size count=1)=0
Writes values of type mi::Uint8 to the serializer.
virtual bool write(const Uint64 *value, Size count=1)=0
Writes values of type mi::Uint64 to the serializer.
A tag represents a unique identifier for database elements in the database.
Definition: iserializer.h:54
Tag()
Constructor.
Definition: iserializer.h:59
Tag(Tag_struct tag_struct)
Constructor from the underlying storage type.
Definition: iserializer.h:62
bool is_valid() const
Returns true if the tag is valid, i.e., is not equal to NULL_TAG.
Definition: iserializer.h:65
bool(Tag::* bool_conversion_support)() const
Helper typedef.
Definition: iserializer.h:71
long long Sint64
64-bit signed integer.
Definition: types.h:61
unsigned long long Uint64
64-bit unsigned integer.
Definition: types.h:62
signed short Sint16
16-bit signed integer.
Definition: types.h:45
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
unsigned char Uint8
8-bit unsigned integer.
Definition: types.h:47
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
signed char Sint8
8-bit signed integer.
Definition: types.h:44
double Float64
64-bit float.
Definition: types.h:52
float Float32
32-bit float.
Definition: types.h:51
unsigned short Uint16
16-bit unsigned integer.
Definition: types.h:48
signed int Sint32
32-bit signed integer.
Definition: types.h:46
bool operator>=(const Tag &lhs, const Tag &rhs)
Returns true if lhs is greater than or equal to rhs.
Definition: iserializer.h:122
bool operator<=(const Tag &lhs, const Tag &rhs)
Returns true if lhs is less than or equal to rhs.
Definition: iserializer.h:116
bool operator!=(const Tag &lhs, const Tag &rhs)
Returns true if lhs is not equal to rhs.
Definition: iserializer.h:98
const Tag NULL_TAG
This value of the tag represents an invalid tag which can not be accessed.
Definition: iserializer.h:128
bool operator>(const Tag &lhs, const Tag &rhs)
Returns true if lhs is greater than rhs.
Definition: iserializer.h:110
bool operator==(const Tag &lhs, const Tag &rhs)
Returns true if lhs is equal to rhs.
Definition: iserializer.h:92
bool operator<(const Tag &lhs, const Tag &rhs)
Returns true if lhs is less than rhs.
Definition: iserializer.h:104
Mixin class template for deriving new interface declarations.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: neuraylib.h:179
A 128 bit representation of a universally unique identifier (UUID or GUID).
Definition: uuid.h:26
A tag represents a unique identifier for database elements in the database.
Definition: iserializer.h:45
Uint32 id
The actual ID of the tag.
Definition: iserializer.h:47