HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_UniversalLogSink.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_UniversalLogSink.h ( FS Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __UT_UniversalLogSink__
13 #define __UT_UniversalLogSink__
14 
15 #include "UT_API.h"
16 #include "UT_Function.h"
17 #include "UT_Lock.h"
18 #include "UT_StringSet.h"
19 #include "UT_UniversalLogEntry.h"
20 
21 class UT_StringArray;
22 class UT_StringHolder;
23 
24 /// This class exists to amalgamate logging information from a variety of
25 /// sources (UT_UniversalLogSource objects). Log entries can be fetched and
26 /// filtered to present the user with just the logging they are interested in.
28 {
29 public:
32 
34  virtual ~UT_UniversalLogSink();
35 
36  /// Each sink creates its own source objects, and can only have one source
37  /// of any given type.
38  void connect(const UT_StringHolder &source_name);
39  void disconnect(const UT_StringHolder &source_name);
40  void disconnectAll();
41  void getConnectedSourceNames(UT_StringArray &source_names);
42 
44  { myLogEntryFilterCallback = callback; }
45 
46  /// Record a message from a log source.
47  void log(const UT_UniversalLogEntry &entry);
48 
49 protected:
50  virtual void doLog(const UT_UniversalLogEntry &entry) = 0;
51 
52 private:
53  UT_StringSet mySources;
54  UT_Lock mySourcesLock;
55  LogEntryFilterCallback myLogEntryFilterCallback;
56 };
57 
58 #endif
59 
#define UT_API
Definition: UT_API.h:14
UT_Function< bool(const UT_UniversalLogEntry &)> LogEntryFilterCallback
void setFilterEntryCallback(const LogEntryFilterCallback &callback)
std::function< T > UT_Function
Definition: UT_Function.h:37
OIIO_FORCEINLINE T log(const T &v)
Definition: simd.h:7688
Simple object to hold the data associated with a single log entry event.