HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
layerTree.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_USD_SDF_LAYER_TREE_H
8 #define PXR_USD_SDF_LAYER_TREE_H
9 
10 /// \file sdf/layerTree.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/sdf/api.h"
16 
17 #include <vector>
18 
20 
21 // Layer tree forward declarations.
24 typedef std::vector<SdfLayerTreeHandle> SdfLayerTreeHandleVector;
25 
27 
28 /// \class SdfLayerTree
29 ///
30 /// A SdfLayerTree is an immutable tree structure representing a sublayer
31 /// stack and its recursive structure.
32 ///
33 /// Layers can have sublayers, which can in turn have sublayers of their
34 /// own. Clients that want to represent that hierarchical structure in
35 /// memory can build a SdfLayerTree for that purpose.
36 ///
37 /// We use TfRefPtr<SdfLayerTree> as handles to LayerTrees, as a simple way
38 /// to pass them around as immutable trees without worrying about lifetime.
39 ///
40 class SdfLayerTree : public TfRefBase, public TfWeakBase {
41  SdfLayerTree(const SdfLayerTree&) = delete;
42  SdfLayerTree& operator=(const SdfLayerTree&) = delete;
43 public:
44  /// Create a new layer tree node.
45  SDF_API
46  static SdfLayerTreeHandle
47  New( const SdfLayerHandle & layer,
48  const SdfLayerTreeHandleVector & childTrees,
49  const SdfLayerOffset & cumulativeOffset = SdfLayerOffset() );
50 
51  /// Returns the layer handle this tree node represents.
52  SDF_API const SdfLayerHandle & GetLayer() const;
53 
54  /// Returns the cumulative layer offset from the root of the tree.
55  SDF_API const SdfLayerOffset & GetOffset() const;
56 
57  /// Returns the children of this tree node.
59 
60 private:
61  SdfLayerTree( const SdfLayerHandle & layer,
62  const SdfLayerTreeHandleVector & childTrees,
63  const SdfLayerOffset & cumulativeOffset );
64 
65 private:
66  const SdfLayerHandle _layer;
67  const SdfLayerOffset _offset;
68  const SdfLayerTreeHandleVector _childTrees;
69 };
70 
72 
73 #endif // PXR_USD_SDF_LAYER_TREE_H
static SDF_API SdfLayerTreeHandle New(const SdfLayerHandle &layer, const SdfLayerTreeHandleVector &childTrees, const SdfLayerOffset &cumulativeOffset=SdfLayerOffset())
Create a new layer tree node.
TfRefPtr< SdfLayerTree > SdfLayerTreeHandle
Definition: layerTree.h:22
Definition: layer.h:81
SDF_API const SdfLayerTreeHandleVector & GetChildTrees() const
Returns the children of this tree node.
std::vector< SdfLayerTreeHandle > SdfLayerTreeHandleVector
Definition: layerTree.h:24
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
SDF_API const SdfLayerHandle & GetLayer() const
Returns the layer handle this tree node represents.
SDF_DECLARE_HANDLES(SdfLayer)
SDF_API const SdfLayerOffset & GetOffset() const
Returns the cumulative layer offset from the root of the tree.
#define SDF_API
Definition: api.h:23
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74