-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathICdsFactory.hpp
95 lines (74 loc) · 2.49 KB
/
ICdsFactory.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//
#ifndef MAT_ICDSFACTORY_HPP
#define MAT_ICDSFACTORY_HPP
#include "ctmacros.hpp"
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <vector>
namespace MAT_NS_BEGIN {
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4251)
#endif
// disable warning (4251) to declare Config and DiagnosticConfig as dll api
/// <summary>
/// Configuration Params for Collector / Packager / Uploader
/// </summary>
struct MATSDK_LIBABI Config {
std::string name;
std::map<std::string /*param name*/, std::string /*param value*/> params;
};
/// <summary>
/// Collecotr/Packager/Uploader Configuration Params for Common Diagnostic Stack
/// </summary>
struct MATSDK_LIBABI DiagnosticConfig {
Config collectorConfig;
Config packagerConfig;
Config uploaderConfig;
};
#ifdef _MSC_VER
#pragma warning(pop)
#endif
/// <summary>
/// Collector must agree to this interface to provide diagnostic data to CDS
/// </summary>
class MATSDK_LIBABI IDiagnosticDataCollector {
public:
virtual ~IDiagnosticDataCollector() noexcept = default;
/// <summary>
/// return Diagnostic Data
/// </summary>
virtual std::vector<uint8_t> CollectAndGetDataStream(const std::string& sessionId, const Config& config) noexcept = 0;
};
/// <summary>
/// Provide the Common Diagnostic Stack functionality
/// </summary>
class ICommonDiagnosticSystem {
public:
virtual ~ICommonDiagnosticSystem() noexcept = default;
/// <summary>
/// Used to register collectors with CDS
/// </summary>
virtual MATSDK_LIBABI void RegisterCollector(const std::string& collectorName, const std::shared_ptr<IDiagnosticDataCollector>& collector) noexcept = 0;
/// <summary>
/// Call to perform data collection with default config and upload to ODS
/// </summary>
virtual MATSDK_LIBABI bool DoCollectAndUpload(const std::string& sessionID, const std::string& collectorName) noexcept = 0;
/// <summary>
/// Call to perform data collection and upload to ODS
/// </summary>
virtual MATSDK_LIBABI bool DoCollectAndUpload(const std::string& sessionID, const DiagnosticConfig& config) noexcept = 0;
};
/// <summary>
/// Get a singleton of Common Diagnostic Stack that is used for registering CollectorCallback and is used to call
/// to collect and upload data.
/// </summary>
MATSDK_LIBABI ICommonDiagnosticSystem& GetCommonDiagnosticSystem() noexcept;
}
MAT_NS_END
#endif