HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
serialization.h
Go to the documentation of this file.
1 //
2 // Copyright 2018 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_BASE_TRACE_SERIALIZATION_H
9 #define PXR_BASE_TRACE_SERIALIZATION_H
10 
11 #include "pxr/pxr.h"
12 #include "pxr/base/trace/api.h"
14 
15 #include <istream>
16 #include <ostream>
17 #include <memory>
18 #include <vector>
19 
21 
22 ////////////////////////////////////////////////////////////////////////////////
23 /// \class TraceSerialization
24 ///
25 /// This class contains methods to read and write TraceCollection.
26 ///
28 public:
29  /// Writes \p col to \p ostr.
30  /// Returns true if the write was successful, false otherwise.
31  TRACE_API static bool Write(std::ostream& ostr,
32  const std::shared_ptr<TraceCollection>& col);
33 
34  /// Writes \p collections to \p ostr.
35  /// Returns true if the write was successful, false otherwise.
36  TRACE_API static bool Write(
37  std::ostream& ostr,
38  const std::vector<std::shared_ptr<TraceCollection>>& collections);
39 
40  /// Tries to create a TraceCollection from the contexts of \p istr.
41  /// Returns a pointer to the created collection if it was successful.
42  /// If there is an error reading \p istr, \p error will be populated with a
43  /// description.
44  TRACE_API static std::unique_ptr<TraceCollection> Read(std::istream& istr,
45  std::string* error = nullptr);
46 };
47 
49 
50 #endif // PXR_BASE_TRACE_SERIALIZATION_H
static TRACE_API std::unique_ptr< TraceCollection > Read(std::istream &istr, std::string *error=nullptr)
static TRACE_API bool Write(std::ostream &ostr, const std::shared_ptr< TraceCollection > &col)
< returns > If no error
Definition: snippets.dox:2
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
#define TRACE_API
Definition: api.h:23