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
mapEditor.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_MAP_EDITOR_H
8#define PXR_USD_SDF_MAP_EDITOR_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/sdf/allowed.h"
12#include "pxr/usd/sdf/spec.h"
13
14#include <memory>
15#include <string>
16#include <utility>
17
18PXR_NAMESPACE_OPEN_SCOPE
19
20class TfToken;
21
26template <class MapType>
27class Sdf_MapEditor {
28public:
29 typedef typename MapType::key_type key_type;
30 typedef typename MapType::mapped_type mapped_type;
31 typedef typename MapType::value_type value_type;
32 typedef typename MapType::iterator iterator;
33
34 virtual ~Sdf_MapEditor() noexcept;
35
38 virtual std::string GetLocation() const = 0;
39
41 virtual SdfSpecHandle GetOwner() const = 0;
42
44 virtual bool IsExpired() const = 0;
45
47 virtual const MapType* GetData() const = 0;
48
53 virtual MapType* GetData() = 0;
54
57
58 virtual void Copy(const MapType& other) = 0;
59 virtual void Set(const key_type& key, const mapped_type& other) = 0;
60 virtual std::pair<iterator, bool> Insert(const value_type& value) = 0;
61 virtual bool Erase(const key_type& key) = 0;
62
63 virtual SdfAllowed IsValidKey(const key_type& key) const = 0;
64 virtual SdfAllowed IsValidValue(const mapped_type& value) const = 0;
65
67
68protected:
69 Sdf_MapEditor();
70
71};
72
73template <class T>
74std::unique_ptr<Sdf_MapEditor<T> >
75Sdf_CreateMapEditor(const SdfSpecHandle& owner, const TfToken& field);
76
77PXR_NAMESPACE_CLOSE_SCOPE
78
79#endif // PXR_USD_SDF_MAP_EDITOR_H
Indicates if an operation is allowed and, if not, why not.
Definition: allowed.h:29
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
STL namespace.