HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
UT_UniversalLogSource.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_UniversalLogSource.h ( FS Library, C++)
7
*
8
* COMMENTS:
9
*
10
*/
11
12
#ifndef __UT_UniversalLogSource__
13
#define __UT_UniversalLogSource__
14
15
#include "
UT_API.h
"
16
#include "
UT_Array.h
"
17
#include "
UT_Function.h
"
18
#include "
UT_Lock.h
"
19
#include "
UT_StringHolder.h
"
20
#include "
UT_UniversalLogEntry.h
"
21
22
class
UT_StringArray
;
23
class
UT_UniversalLogSink
;
24
class
UT_UniversalLogSource
;
25
26
typedef
UT_Function<UT_UniversalLogSource *()>
27
UT_UniversalLogSourceCreator
;
28
29
/// Use this macro to register a log source class so it can be created by
30
/// and attached to a log sink object.
31
#define UT_REGISTERUNIVERSALLOGSOURCE(source_class) \
32
static UT_UniversalLogSourceRegistration theReg##source_class( \
33
source_class::staticName(), \
34
[] () { return new source_class(); })
35
36
/// This class performs the registration of a log source class. It also holds
37
/// the static map of instantiated source objects.
38
class
UT_API
UT_UniversalLogSourceRegistration
39
{
40
public
:
41
UT_UniversalLogSourceRegistration
(
42
const
UT_StringHolder
&source_name,
43
UT_UniversalLogSourceCreator
creator);
44
45
static
bool
connect(
const
UT_StringHolder
&source_name,
46
UT_UniversalLogSink
*sink);
47
static
bool
disconnect(
const
UT_StringHolder
&source_name,
48
UT_UniversalLogSink
*sink);
49
50
static
void
getSourceNames(
UT_StringArray
&source_names);
51
static
bool
isSourceName(
const
UT_StringRef
&source_name);
52
static
UT_UniversalLogSource
*
getSource
(
const
UT_StringRef
&source_name);
53
};
54
55
/// This class represents a logging data source. Each source is a singleton
56
/// created by the registration code the first time a sink asks to connect
57
/// to it. The Source is destroyed when the last sink disconnects from it.
58
/// The source's connection to its sinks is maintained by the base class, so
59
/// source subclasses simply need to call sendToSinks when they have a log
60
/// entry to broadcast.
61
class
UT_API
UT_UniversalLogSource
62
{
63
public
:
64
/// Sends a message to our associated log sinks.
65
void
sendToSinks(
const
UT_UniversalLogEntry
&entry);
66
67
protected
:
68
UT_UniversalLogSource
();
69
virtual
~
UT_UniversalLogSource
();
70
71
UT_UniversalLogSource
(
const
UT_UniversalLogSource
&) =
delete
;
72
UT_UniversalLogSource
&
operator=
(
const
UT_UniversalLogSource
&) =
delete
;
73
74
UT_Lock
mySinksLock
;
75
UT_Array<UT_UniversalLogSink *>
mySinks
;
76
77
friend
class
UT_UniversalLogSourceRegistration
;
78
};
79
80
#endif
getSource
int getSource() override
UT_API.h
UT_UniversalLogSourceRegistration
Definition:
UT_UniversalLogSource.h:38
UT_API
#define UT_API
Definition:
UT_API.h:14
UT_StringRef
Definition:
UT_StringHolder.h:188
UT_UniversalLogEntry.h
UT_Array.h
UT_Array< UT_UniversalLogSink * >
UT_UniversalLogSourceCreator
UT_Function< UT_UniversalLogSource *()> UT_UniversalLogSourceCreator
Definition:
UT_UniversalLogSource.h:24
UT_UniversalLogSource::mySinksLock
UT_Lock mySinksLock
Definition:
UT_UniversalLogSource.h:74
UT_SpinLockT< true, false >
UT_UniversalLogSink
Definition:
UT_UniversalLogSink.h:30
UT_StringHolder
Definition:
UT_StringHolder.h:999
UT_StringArray
Definition:
UT_StringArray.h:24
UT_Function.h
UT_Function
std::function< T > UT_Function
Definition:
UT_Function.h:37
UT_UniversalLogSource
Definition:
UT_UniversalLogSource.h:61
UT_StringHolder.h
nanovdb::operator=
LeafData & operator=(const LeafData &)=delete
UT_UniversalLogSource::mySinks
UT_Array< UT_UniversalLogSink * > mySinks
Definition:
UT_UniversalLogSource.h:75
UT_Lock.h
UT_UniversalLogEntry
Simple object to hold the data associated with a single log entry event.
Definition:
UT_UniversalLogEntry.h:58
UT
UT_UniversalLogSource.h
Generated on Fri Nov 8 2024 03:42:07 for HDK by
1.8.6