Loading...
Searching...
No Matches
children.h
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_USD_SDF_CHILDREN_H
25#define PXR_USD_SDF_CHILDREN_H
26
27#include "pxr/pxr.h"
28#include "pxr/usd/sdf/api.h"
30#include "pxr/usd/sdf/path.h"
31
32#include <vector>
33
34PXR_NAMESPACE_OPEN_SCOPE
35
36SDF_DECLARE_HANDLES(SdfLayer);
37class SdfSpec;
38
49template<class ChildPolicy>
50class Sdf_Children
51{
52public:
53 typedef typename ChildPolicy::KeyPolicy KeyPolicy;
54 typedef typename ChildPolicy::KeyType KeyType;
55 typedef typename ChildPolicy::ValueType ValueType;
56 typedef typename ChildPolicy::FieldType FieldType;
57 typedef Sdf_Children<ChildPolicy> This;
58
59 SDF_API
60 Sdf_Children();
61
62 SDF_API
63 Sdf_Children(const Sdf_Children<ChildPolicy> &other);
64
65 SDF_API
66 Sdf_Children(const SdfLayerHandle &layer,
67 const SdfPath &parentPath, const TfToken &childrenKey,
68 const KeyPolicy& keyPolicy = KeyPolicy());
69
71 SDF_API
72 bool IsValid() const;
73
75 SDF_API
76 size_t GetSize() const;
77
79 SDF_API
80 ValueType GetChild(size_t index) const;
81
83 SDF_API
84 size_t Find(const KeyType &key) const;
85
88 SDF_API
89 KeyType FindKey(const ValueType &value) const;
90
92 SDF_API
93 bool IsEqualTo(const This &other) const;
94
96 SDF_API
97 bool Copy(const std::vector<ValueType> & values, const std::string &type);
98
100 SDF_API
101 bool Insert(const ValueType& value, size_t index, const std::string &type);
102
104 SDF_API
105 bool Erase(const KeyType& key, const std::string &type);
106
107private:
108 void _UpdateChildNames() const;
109
110private:
111 SdfLayerHandle _layer;
112 SdfPath _parentPath;
113 TfToken _childrenKey;
114 KeyPolicy _keyPolicy;
115
116 mutable std::vector<FieldType> _childNames;
117 mutable bool _childNamesValid;
118};
119
120PXR_NAMESPACE_CLOSE_SCOPE
121
122#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:100
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
Base class for all Sdf spec classes.
Definition: spec.h:50
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88