This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
children.h
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_CHILDREN_H
8#define PXR_USD_SDF_CHILDREN_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/sdf/api.h"
13#include "pxr/usd/sdf/path.h"
14
15#include <vector>
16
17PXR_NAMESPACE_OPEN_SCOPE
18
19SDF_DECLARE_HANDLES(SdfLayer);
20class SdfSpec;
21
32template<class ChildPolicy>
33class Sdf_Children
34{
35public:
36 typedef typename ChildPolicy::KeyPolicy KeyPolicy;
37 typedef typename ChildPolicy::KeyType KeyType;
38 typedef typename ChildPolicy::ValueType ValueType;
39 typedef typename ChildPolicy::FieldType FieldType;
40 typedef Sdf_Children<ChildPolicy> This;
41
42 SDF_API
43 Sdf_Children();
44
45 SDF_API
46 Sdf_Children(const Sdf_Children<ChildPolicy> &other);
47
48 SDF_API
49 Sdf_Children(const SdfLayerHandle &layer,
50 const SdfPath &parentPath, const TfToken &childrenKey,
51 const KeyPolicy& keyPolicy = KeyPolicy());
52
54 SDF_API
55 bool IsValid() const;
56
58 SDF_API
59 size_t GetSize() const;
60
62 SDF_API
63 ValueType GetChild(size_t index) const;
64
66 SDF_API
67 size_t Find(const KeyType &key) const;
68
71 SDF_API
72 KeyType FindKey(const ValueType &value) const;
73
75 SDF_API
76 bool IsEqualTo(const This &other) const;
77
79 SDF_API
80 bool Copy(const std::vector<ValueType> & values, const std::string &type);
81
83 SDF_API
84 bool Insert(const ValueType& value, size_t index, const std::string &type);
85
87 SDF_API
88 bool Erase(const KeyType& key, const std::string &type);
89
90private:
91 void _UpdateChildNames() const;
92
93private:
94 SdfLayerHandle _layer;
95 SdfPath _parentPath;
96 TfToken _childrenKey;
97 KeyPolicy _keyPolicy;
98
99 mutable std::vector<FieldType> _childNames;
100 mutable bool _childNamesValid;
101};
102
103PXR_NAMESPACE_CLOSE_SCOPE
104
105#endif // PXR_USD_SDF_CHILDREN_H
A scene description container that can combine with other such containers to form simple component as...
Definition: layer.h:84
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Base class for all Sdf spec classes.
Definition: spec.h:33
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71