All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
declarePtrs.h
Go to the documentation of this file.
1//
2// Copyright 2016 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_BASE_TF_DECLARE_PTRS_H
8#define PXR_BASE_TF_DECLARE_PTRS_H
9
14
15#include "pxr/pxr.h"
16#include "pxr/base/tf/weakPtr.h"
17#include "pxr/base/tf/refPtr.h"
18
19#include <vector>
20
21PXR_NAMESPACE_OPEN_SCOPE
22
25template<typename T> struct TfDeclarePtrs {
26 typedef TfWeakPtr< T > Ptr;
28 typedef std::vector< Ptr > PtrVector;
29 typedef std::vector< ConstPtr > ConstPtrVector;
30
31 typedef TfRefPtr< T > RefPtr;
33 typedef std::vector< RefPtr > RefPtrVector;
34 typedef std::vector< ConstRefPtr > ConstRefPtrVector;
35};
36
45#define TF_DECLARE_WEAK_PTRS(type) \
46 typedef TfDeclarePtrs< class type >::Ptr type##Ptr; \
47 typedef TfDeclarePtrs< class type >::ConstPtr type##ConstPtr; \
48 typedef TfDeclarePtrs< class type >::PtrVector type##PtrVector; \
49 typedef TfDeclarePtrs< class type >::ConstPtrVector type##ConstPtrVector
50
58#define TF_DECLARE_REF_PTRS(type) \
59 typedef TfDeclarePtrs< class type >::RefPtr type##RefPtr; \
60 typedef TfDeclarePtrs< class type >::ConstRefPtr type##ConstRefPtr; \
61 typedef TfDeclarePtrs< class type >::RefPtrVector type##RefPtrVector; \
62 typedef TfDeclarePtrs< class type >::ConstRefPtrVector type##ConstRefPtrVector
63
72#define TF_DECLARE_WEAK_AND_REF_PTRS(type) \
73 TF_DECLARE_WEAK_PTRS(type); \
74 TF_DECLARE_REF_PTRS(type)
75
76PXR_NAMESPACE_CLOSE_SCOPE
77
78#endif
Reference-counted smart pointer utility class.
Definition: refPtr.h:590
Pointer storage with deletion detection.
Definition: weakPtr.h:128
Templated struct used for type definition macros.
Definition: declarePtrs.h:25
Reference counting.
Pointer storage with deletion detection.