Loading...
Searching...
No Matches
reporterBase.h
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_REPORTER_BASE_H
9#define PXR_BASE_TRACE_REPORTER_BASE_H
10
11#include "pxr/pxr.h"
12
13#include "pxr/base/trace/api.h"
14#include "pxr/base/trace/collectionNotice.h"
15#include "pxr/base/trace/collection.h"
16#include "pxr/base/trace/reporterDataSourceBase.h"
17
19
20#include <tbb/concurrent_vector.h>
21
22#include <ostream>
23
24PXR_NAMESPACE_OPEN_SCOPE
25
27
36 public TfRefBase, public TfWeakBase {
37public:
38 using This = TraceReporterBase;
39 using ThisPtr = TraceReporterBasePtr;
40 using ThisRefPtr = TraceReporterBaseRefPtr;
41 using CollectionPtr = std::shared_ptr<TraceCollection>;
42 using DataSourcePtr = std::unique_ptr<TraceReporterDataSourceBase>;
43
45 TRACE_API TraceReporterBase(DataSourcePtr dataSource);
46
48 TRACE_API virtual ~TraceReporterBase();
49
51 TRACE_API bool SerializeProcessedCollections(std::ostream& ostr) const;
52protected:
54 TRACE_API void _Clear();
55
58 TRACE_API void _Update();
59
61 virtual void _ProcessCollection(const CollectionPtr&) = 0;
62
63private:
64 DataSourcePtr _dataSource;
65 tbb::concurrent_vector<CollectionPtr> _processedCollections;
66};
67
68PXR_NAMESPACE_CLOSE_SCOPE
69
70#endif // PXR_BASE_TRACE_REPORTER_BASE_H
Enable a concrete base class for use with TfRefPtr.
Definition: refBase.h:56
Enable a concrete base class for use with TfWeakPtr.
Definition: weakBase.h:124
This class is a base class for report implementations.
Definition: reporterBase.h:36
TRACE_API void _Update()
Gets the latest data from the TraceCollector singleton and processes all collections that have been r...
virtual TRACE_API ~TraceReporterBase()
Destructor.
TRACE_API TraceReporterBase(DataSourcePtr dataSource)
Constructor taking ownership of dataSource.
virtual void _ProcessCollection(const CollectionPtr &)=0
Called once per collection from _Update()
TRACE_API void _Clear()
Removes all references to TraceCollections.
TRACE_API bool SerializeProcessedCollections(std::ostream &ostr) const
Write all collections that were processed by this reporter to ostr.
Standard pointer typedefs.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Definition: declarePtrs.h:72