Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,20 @@ enum SystemMetricsSampler {
}
func parseTime() throws -> Double {
let s = try parseString(stripPlusMinus: true)
let components = s.components(separatedBy: ":")

var result = 0.0
for (i, c) in components.reversed().enumerated() {
guard let d = Double(c) else { throw ParseError(message: "parseTime", index: i) }
result += d * pow(60.0, Double(i))
if let match = s.wholeMatch(of: #/(.+) hrs/#), let i = Int(match.output.1) {
return Double(i) * 60 * 60
} else {
let components = s.components(separatedBy: ":")

var result = 0.0
for (i, c) in components.reversed().enumerated() {
guard let d = Double(c) else { throw ParseError(message: "parseTime", index: i) }
result += d * pow(60.0, Double(i))
}

return result
}

return result
}
func parseDouble() throws -> Double {
guard let x = Double(try parseString(stripPlusMinus: true)) else { throw ParseError(message: "parseDouble", index: i) }
Expand Down
41 changes: 41 additions & 0 deletions source/Wrappers/TfErrorMarkWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,49 @@

#include "swiftUsd/Wrappers/TfErrorMarkWrapper.h"

void Overlay::TfErrorMarkWrapper::SetMark() const {
_impl->SetMark();
}

bool Overlay::TfErrorMarkWrapper::IsClean() const {
return _impl->IsClean();
}

bool Overlay::TfErrorMarkWrapper::Clear() const {
return _impl->Clear();
}

pxr::TfErrorTransport Overlay::TfErrorMarkWrapper::Transport() const {
return _impl->Transport();
}

void Overlay::TfErrorMarkWrapper::TransportTo(pxr::TfErrorTransport& dest) const {
_impl->TransportTo(dest);
}

pxr::TfErrorMark::Iterator Overlay::TfErrorMarkWrapper::GetBegin(size_t*_Nullable nErrors) const {
return _impl->GetBegin(nErrors);
}

pxr::TfErrorMark::Iterator Overlay::TfErrorMarkWrapper::GetEnd() const {
return _impl->GetEnd();
}

pxr::TfErrorMark::Iterator Overlay::TfErrorMarkWrapper::begin() const {
return _impl->begin();
}

pxr::TfErrorMark::Iterator Overlay::TfErrorMarkWrapper::end() const {
return _impl->end();
}


Overlay::TfErrorMarkWrapper __Overlay::makeTfErrorMarkWrapper_friend() {
return {};
}

Overlay::TfErrorMarkWrapper::TfErrorMarkWrapper() : _impl(std::make_unique<pxr::TfErrorMark>()) {}

Overlay::TfErrorMarkWrapper __Overlay::makeTfErrorMarkWrapper() {
return makeTfErrorMarkWrapper_friend();
}
42 changes: 9 additions & 33 deletions source/Wrappers/TfErrorMarkWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ namespace Overlay {
// closure takes it as `borrowing`. As a consequence, any non-const methods
// can't be called on it. So, make `SetMark()` const here, even though it's non-const
// for `pxr::TfErrorMark`
inline void SetMark() const {
_impl->SetMark();
}
void SetMark() const;

/// Return true if no new errors were posted in this thread since the last
/// call to \c SetMark(), false otherwise.
Expand All @@ -104,18 +102,14 @@ namespace Overlay {
/// atomic integer read and comparison. Otherwise thread-specific data is
/// accessed to make the determination. Thus, this function is fast when
/// diagnostics are not being issued.
inline bool IsClean() const {
return _impl->IsClean();
}
bool IsClean() const;

/// Remove all errors in this mark from the error system. Return true if
/// any errors were cleared, false if there were no errors in this mark.
///
/// Clear all errors contained in this mark from the error system.
/// Subsequently, these errors will be considered handled.
inline bool Clear() const {
return _impl->Clear();
}
bool Clear() const;

/// Remove all errors in this mark from the error system and return them in
/// a TfErrorTransport.
Expand All @@ -130,9 +124,7 @@ namespace Overlay {
/// between Swift Concurrency tasks intentionally requires using unsafe
/// opt-outs on the `pxr.TfErrorTransport` because it can expose
/// unsynchronized access to shared mutable state. Use with caution.
inline pxr::TfErrorTransport Transport() const {
return _impl->Transport();
}
pxr::TfErrorTransport Transport() const;

/// Remove all errors in this mark from the error system and return them in
/// a TfErrorTransport.
Expand All @@ -145,9 +137,7 @@ namespace Overlay {
/// between Swift Concurrency tasks intentionally requires using unsafe
/// opt-outs on the `pxr.TfErrorTransport` because it can expose
/// unsynchronized access to shared mutable state. Use with caution.
inline void TransportTo(pxr::TfErrorTransport& dest) const {
Transport().swap(dest);
}
void TransportTo(pxr::TfErrorTransport& dest) const;

/// Return an iterator to the first error added to the error list after
/// \c SetMark().
Expand All @@ -164,27 +154,19 @@ namespace Overlay {
///
/// If \c nErrors is non-NULL, then \c *nErrors is set to the number of
/// errors between the returned iterator and the end of the list.
pxr::TfErrorMark::Iterator GetBegin(size_t* _Nullable nErrors = 0) const {
return _impl->GetBegin(nErrors);
}
pxr::TfErrorMark::Iterator GetBegin(size_t* _Nullable nErrors = 0) const;

/// Return an iterator past the last error in the error system.
///
/// This iterator is always equivalent to the iterator returned by \c
/// TfDiagnosticMgr::GetErrorEnd().
pxr::TfErrorMark::Iterator GetEnd() const {
return _impl->GetEnd();
}
pxr::TfErrorMark::Iterator GetEnd() const;

/// Equivalent to GetBegin()
pxr::TfErrorMark::Iterator begin() const {
return _impl->begin();
}
pxr::TfErrorMark::Iterator begin() const;

/// Equivalent to GetEnd()
pxr::TfErrorMark::Iterator end() const {
return _impl->end();
}
pxr::TfErrorMark::Iterator end() const;

private:
TfErrorMarkWrapper();
Expand All @@ -193,11 +175,5 @@ namespace Overlay {
};
}

namespace __Overlay {
inline Overlay::TfErrorMarkWrapper makeTfErrorMarkWrapper() {
return makeTfErrorMarkWrapper_friend();
}
}


#endif /* SWIFTUSD_WRAPPERS_TFERRORMARKWRAPPER_H */
Loading