3ds Max C++ API Reference
GenericTranslatorKey_Empty< TranslatorType, TranslatorAllocator > Class Template Reference

#include <GenericTranslatorKeys.h>

+ Inheritance diagram for GenericTranslatorKey_Empty< TranslatorType, TranslatorAllocator >:

Public Member Functions

 GenericTranslatorKey_Empty ()
 
virtual bool operator== (const TranslatorKey &rhs) const override
 Returns whether the given key is identical to this one. More...
 
virtual std::unique_ptr< const TranslatorKeyCreateClone () const override
 Allocates and initialized a brand new copy of this key. More...
 
virtual std::unique_ptr< TranslatorAllocateNewTranslator (TranslatorGraphNode &translator_graph_node, const IRenderSessionContext &render_session_context, const TimeValue initial_time) const override
 Factory method for the type of translator represented by this key. More...
 
- Public Member Functions inherited from TranslatorKey
 TranslatorKey (const size_t hash)
 Initializes the translator key with a given hash value. More...
 
virtual ~TranslatorKey ()
 
size_t get_hash () const
 Returns the hash value passed to the constructor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Constructor & Destructor Documentation

◆ GenericTranslatorKey_Empty()

36  : TranslatorKey(std::type_index(typeid(GenericTranslatorKey_Empty<TranslatorType, TranslatorAllocator>)).hash_code())
37 {
38 
39 }
TranslatorKey(const size_t hash)
Initializes the translator key with a given hash value.
Definition: TranslatorKey.inline.h:18

Member Function Documentation

◆ operator==()

bool operator== ( const TranslatorKey rhs) const
overridevirtual

Returns whether the given key is identical to this one.

The comparison should typically consider, both, the set of values stored in the key, and the type of the key, such that two keys that store identical values (e.g. the same INode*) but which create different types of translators (e.g. Instance versus InstanceAttributes) would be deemed to be different. Such comparison will typically be performed using a dynamic_cast.

Implements TranslatorKey.

43 {
44  // No data: just compare type
45  const GenericTranslatorKey_Empty<TranslatorType, TranslatorAllocator>* cast_rhs = dynamic_cast<const GenericTranslatorKey_Empty<TranslatorType, TranslatorAllocator>*>(&rhs);
46  return (cast_rhs != nullptr);
47 }

◆ CreateClone()

std::unique_ptr< const TranslatorKey > CreateClone ( ) const
inlineoverridevirtual

Allocates and initialized a brand new copy of this key.

For efficiency, keys will normally be allocated on the stack - such that Translator::AcquireChildTranslator() will be called with a temporary key, avoiding an unnecessary memory allocation. But if a new translator needs to be created, then the system also needs to store a copy of the key. For this purpose, it creates a clone of the key using this method.

Implements TranslatorKey.

51 {
52  return std::unique_ptr<const TranslatorKey>(new GenericTranslatorKey_Empty<TranslatorType, TranslatorAllocator>());
53 }

◆ AllocateNewTranslator()

std::unique_ptr< Translator > AllocateNewTranslator ( TranslatorGraphNode &  translator_graph_node,
const IRenderSessionContext render_session_context,
const TimeValue  initial_time 
) const
overridevirtual

Factory method for the type of translator represented by this key.

Whenever a new translator needs to be created for a given key, that key is responsible for allocating the new instance of that type of translator.

Parameters
translator_graph_nodeThe parameter which is to be passed to the constructor of class Translator.
render_session_contextThe render session context within which the translator is being created.
initial_timeThe time at which the translator will initially be translated. This may be used, by the method, to evalate scene elements and thus judge exactly what type of translator needs to be allocated (if a single key type maps to multiple types of translators).
Returns
A new instance of a translator which uses this key as input.

Implements TranslatorKey.

57 {
58 return TranslatorAllocator()(*this, translator_graph_node, render_session_context, initial_time);
59 }