Loading...
Searching...
No Matches
allocateBoxedValue.h
1
//
2
// Copyright 2025 Pixar
3
//
4
// Licensed under the terms set forth in the LICENSE.txt file available at
5
// https://openusd.org/license.
6
//
7
#ifndef PXR_EXEC_VDF_ALLOCATE_BOXED_VALUE_H
8
#define PXR_EXEC_VDF_ALLOCATE_BOXED_VALUE_H
9
10
#include "
pxr/pxr.h
"
11
12
#include "pxr/exec/vdf/api.h"
13
#include "pxr/exec/vdf/boxedContainer.h"
14
#include "
pxr/exec/vdf/vector.h
"
15
16
#include "
pxr/base/arch/functionLite.h
"
17
#include "
pxr/base/tf/diagnostic.h
"
18
#include "
pxr/base/tf/mallocTag.h
"
19
20
PXR_NAMESPACE_OPEN_SCOPE
21
22
class
TfToken
;
23
class
VdfContext
;
24
25
// Allocate a new VdfVector as backing store for a boxed value.
26
//
27
VDF_API
28
VdfVector
*Vdf_AllocateBoxedValueVector(
const
VdfContext
&,
const
TfToken
&);
29
30
// Allocate a new VdfVector as backing store for a boxed value, then construct
31
// a boxed value inside that newly allocated VdfVector.
32
//
33
template
<
typename
T,
typename
... Args>
34
bool
35
Vdf_AllocateBoxedValue(
36
const
VdfContext
&context,
37
const
TfToken
&name,
38
Args&&... args)
39
{
40
// Allocate a new VdfVector for storing a boxed value. This function will
41
// return nullptr if the output is not requested, or if an error occurred.
42
// The function will emit a coding error in the latter case.
43
VdfVector
*v = Vdf_AllocateBoxedValueVector(context, name);
44
if
(!v) {
45
return
false
;
46
}
47
48
// Keep track of how much memory we are allocating.
49
TfAutoMallocTag
tag(
50
"Vdf"
,
TfMallocTag::IsInitialized
() ?
TF_FUNC_NAME
() :
""
);
51
TfAutoMallocTag
typedTag(
"Vdf"
, __ARCH_PRETTY_FUNCTION__);
52
53
// Store a new Vdf_BoxedContainer at the output.
54
v->
Set
(
Vdf_BoxedContainer<T>
(std::forward<Args>(args)...));
55
56
// Success!
57
return
true
;
58
}
59
60
PXR_NAMESPACE_CLOSE_SCOPE
61
62
#endif
diagnostic.h
Low-level utilities for informing users of various internal and external diagnostic conditions.
TfMallocTag::Auto
Scoped (i.e.
Definition:
mallocTag.h:249
TfMallocTag::IsInitialized
static bool IsInitialized()
Return true if the tagging system is active.
Definition:
mallocTag.h:188
TfToken
Token for efficient comparison, assignment, and hashing of known strings.
Definition:
token.h:71
Vdf_BoxedContainer
This simple container stores multiple values that flow through the network as a single data flow elem...
Definition:
boxedContainer.h:85
VdfContext
A context is the parameter bundle passed to callbacks of computations.
Definition:
context.h:40
VdfVector
This class is used to abstract away knowledge of the cache data used for each node.
Definition:
vector.h:56
VdfVector::Set
void Set(TYPE &&data)
Forwards data into the vector.
Definition:
vector.h:162
functionLite.h
Define preprocessor function name macros.
TF_FUNC_NAME
#define TF_FUNC_NAME()
Get the name of the current function as a std::string.
Definition:
diagnostic.h:292
mallocTag.h
pxr.h
vector.h
pxr
exec
vdf
allocateBoxedValue.h
© Copyright 2025, Pixar Animation Studios. |
Terms of Use
| Generated on Thu Oct 23 2025 15:48:42 by
1.9.6