Loading...
Searching...
No Matches
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(std::move(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
46 HdContainerDataSourceHandle container)
47 : HdContainerSchema(std::move(container))
48 {}
49
50 typename T::Handle Get(const TfToken &name) const {
51 return _GetTypedDataSource<T>(name);
52 }
53};
54
56template<typename T>
58
62template<typename Schema>
64{
65public:
66
67 HdContainerOfSchemasSchema(HdContainerDataSourceHandle container)
68 : HdContainerSchema(std::move(container))
69 {}
70
71 Schema Get(const TfToken &name) const {
72 using DataSource = typename Schema::UnderlyingDataSource;
73 return Schema(_GetTypedDataSource<DataSource>(name));
74 }
75};
76
78template<typename T>
80
81PXR_NAMESPACE_CLOSE_SCOPE
82
83#endif
Template class for a schema backed by a container whose children have arbitrary names but an expected...
Template class for a schema backed by a container whose children have arbitrary names but an expected...
Base class for a schema backed by a container whose children have arbitrary names.
Schema classes represent a structured view of the inherently unstructured container data source passe...
Definition: schema.h:26
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440