Loading...
Searching...
No Matches
journal.h
Go to the documentation of this file.
1//
2// Copyright 2025 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_EXEC_ESF_JOURNAL_H
8#define PXR_EXEC_ESF_JOURNAL_H
9
11
12#include "pxr/pxr.h"
13
15
17#include "pxr/base/tf/hash.h"
18#include "pxr/usd/sdf/path.h"
19
20PXR_NAMESPACE_OPEN_SCOPE
21
38{
40
41public:
50 EsfJournal &Add(const SdfPath &path, EsfEditReason editReason) {
51 if (TF_VERIFY(path.IsAbsolutePath()) && TF_VERIFY(!path.IsEmpty())) {
52 _hashMap[path] |= editReason;
53 }
54 return *this;
55 }
56
62 void Merge(const EsfJournal &other) {
63 for (const value_type &entry : other) {
64 _hashMap[entry.first] |= entry.second;
65 }
66 }
67
68 bool operator==(const EsfJournal &other) const {
69 return _hashMap == other._hashMap;
70 }
71
72 bool operator!=(const EsfJournal &other) const {
73 return _hashMap != other._hashMap;
74 }
75
83 using value_type = _HashMap::value_type;
84 using iterator = _HashMap::iterator;
85 using const_iterator = _HashMap::const_iterator;
86
87 iterator begin() & {
88 return _hashMap.begin();
89 }
90
91 iterator end() & {
92 return _hashMap.end();
93 }
94
95 const_iterator begin() const & {
96 return _hashMap.begin();
97 }
98
99 const_iterator end() const & {
100 return _hashMap.end();
101 }
102
103 const_iterator cbegin() const & {
104 return _hashMap.begin();
105 }
106
107 const_iterator cend() const & {
108 return _hashMap.end();
109 }
111
112private:
113 _HashMap _hashMap;
114};
115
116PXR_NAMESPACE_CLOSE_SCOPE
117
118#endif
Set of scene changes that should trigger edits to the exec network.
Definition: editReason.h:31
Stores a collection of edit reasons associated with scene objects.
Definition: journal.h:38
EsfJournal & Add(const SdfPath &path, EsfEditReason editReason)
Adds or updates a new entry in the journal.
Definition: journal.h:50
void Merge(const EsfJournal &other)
Merges the entries from the other EsfJournal into this one.
Definition: journal.h:62
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
bool IsEmpty() const noexcept
Returns true if this is the empty path (SdfPath::EmptyPath()).
Definition: path.h:398
SDF_API bool IsAbsolutePath() const
Returns whether the path is absolute.
_IteratorBase< const value_type, typename _Vector::const_iterator > const_iterator
An iterator type for this map.
Definition: denseHashMap.h:227
_IteratorBase< value_type, typename _Vector::iterator > iterator
An iterator type for this map.
Definition: denseHashMap.h:221
iterator end()
Returns an const_iterator pointing to the end of the map.
Definition: denseHashMap.h:350
iterator begin()
Returns an const_iterator pointing to the beginning of the map.
Definition: denseHashMap.h:344
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.
Definition: diagnostic.h:266