All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
schema.h
1//
2// Copyright 2021 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_SCHEMA_H
9#define PXR_IMAGING_HD_SCHEMA_H
10
11#include "pxr/imaging/hd/api.h"
12
13#include "pxr/imaging/hd/dataSourceTypeDefs.h"
14
15PXR_NAMESPACE_OPEN_SCOPE
16
17// ----------------------------------------------------------------------------
18
26{
27public:
28 HdSchema(HdContainerDataSourceHandle container)
29 : _container(container) {}
30
31
33 HD_API
34 HdContainerDataSourceHandle GetContainer() const;
35 HD_API
36 bool IsDefined() const;
37
40 explicit operator bool() const { return IsDefined(); }
41
42 using UnderlyingDataSource = HdContainerDataSource;
43
44protected:
45 HdContainerDataSourceHandle _container;
46
51 template <typename T>
52 typename T::Handle _GetTypedDataSource(TfToken name) const {
53 return _container ? T::Cast(
54 _container->Get(name)) : nullptr;
55 }
56};
57
58PXR_NAMESPACE_CLOSE_SCOPE
59
60#endif
A datasource representing structured (named, hierarchical) data, for example a geometric primitive or...
Definition: dataSource.h:99
Schema classes represent a structured view of the inherently unstructured container data source passe...
Definition: schema.h:26
T::Handle _GetTypedDataSource(TfToken name) const
Returns a datasource of the requested type for the given name: schema implementations can use this to...
Definition: schema.h:52
HD_API HdContainerDataSourceHandle GetContainer() const
Returns the container data source that this schema is interpreting.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71