HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mapEditor.h
Go to the documentation of this file.
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 
19 
20 class TfToken;
21 
22 /// \class Sdf_MapEditor
23 ///
24 /// Interface for private implementations used by SdfMapEditProxy.
25 ///
26 template <class MapType>
28 public:
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 
36  /// Returns a string describing the location of the map being edited.
37  /// This is used for debugging and error messages.
38  virtual std::string GetLocation() const = 0;
39 
40  /// Returns owner of the map being edited.
41  virtual SdfSpecHandle GetOwner() const = 0;
42 
43  /// Returns true if the map being edited is expired, false otherwise.
44  virtual bool IsExpired() const = 0;
45 
46  /// Returns const pointer to map being edited.
47  virtual const MapType* GetData() const = 0;
48 
49  /// Returns non-const pointer to map being edited.
50  /// All edits to the map should be done using the editing functions below.
51  /// This function is primarily here for convenience. Ideally, only the
52  /// const version of this function would exist.
53  virtual MapType* GetData() = 0;
54 
55  /// \name Editing Operations
56  /// @{
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 
66  /// @}
67 
68 protected:
69  Sdf_MapEditor();
70 
71 };
72 
73 template <class T>
74 std::unique_ptr<Sdf_MapEditor<T> >
75 Sdf_CreateMapEditor(const SdfSpecHandle& owner, const TfToken& field);
76 
78 
79 #endif // PXR_USD_SDF_MAP_EDITOR_H
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
Definition: thread.h:632
MapType::mapped_type mapped_type
Definition: mapEditor.h:30
GLsizei const GLfloat * value
Definition: glcorearb.h:824
virtual SdfSpecHandle GetOwner() const =0
Returns owner of the map being edited.
virtual bool IsExpired() const =0
Returns true if the map being edited is expired, false otherwise.
virtual SdfAllowed IsValidValue(const mapped_type &value) const =0
uint64 value_type
Definition: GA_PrimCompat.h:29
virtual std::pair< iterator, bool > Insert(const value_type &value)=0
virtual std::string GetLocation() const =0
MapType::iterator iterator
Definition: mapEditor.h:32
Definition: token.h:70
virtual void Copy(const MapType &other)=0
virtual void Set(const key_type &key, const mapped_type &other)=0
virtual const MapType * GetData() const =0
Returns const pointer to map being edited.
virtual SdfAllowed IsValidKey(const key_type &key) const =0
virtual bool Erase(const key_type &key)=0
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
virtual ~Sdf_MapEditor() noexcept
std::unique_ptr< Sdf_MapEditor< T > > Sdf_CreateMapEditor(const SdfSpecHandle &owner, const TfToken &field)
MapType::value_type value_type
Definition: mapEditor.h:31
MapType::key_type key_type
Definition: mapEditor.h:29