All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
containerSchema.h
1//
2// Copyright 2022 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7
8#ifndef PXR_IMAGING_HD_CONTAINER_SCHEMA_H
9#define PXR_IMAGING_HD_CONTAINER_SCHEMA_H
10
11#include "pxr/imaging/hd/schema.h"
12
13PXR_NAMESPACE_OPEN_SCOPE
14
19{
20public:
21
22 HdContainerSchema(HdContainerDataSourceHandle container)
23 : HdSchema(container)
24 {}
25
26 HD_API
27 TfTokenVector GetNames() const;
28
29 HD_API
30 static HdContainerDataSourceHandle
31 BuildRetained(
32 size_t count,
33 const TfToken *names,
34 const HdDataSourceBaseHandle *values);
35};
36
40template<typename T>
42{
43public:
44
45 HdTypedContainerSchema(HdContainerDataSourceHandle container)
46 : HdContainerSchema(container)
47 {}
48
49 typename T::Handle Get(const TfToken &name) const {
50 return _GetTypedDataSource<T>(name);
51 }
52};
53
57template<typename Schema>
59{
60public:
61
62 HdSchemaBasedContainerSchema(HdContainerDataSourceHandle container)
63 : HdContainerSchema(container)
64 {}
65
66 Schema Get(const TfToken &name) const {
67 using DataSource = typename Schema::UnderlyingDataSource;
68 return Schema(_GetTypedDataSource<DataSource>(name));
69 }
70};
71
72PXR_NAMESPACE_CLOSE_SCOPE
73
74#endif
Base class for a schema backed by a container whose children have arbitrary names.
Template class for a schema backed by a container whose children have arbitrary names but an expected...
Schema classes represent a structured view of the inherently unstructured container data source passe...
Definition: schema.h:26
Template class for a schema backed by a container whose children have arbitrary names but an expected...
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440