OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 // This is the pure C wrapper of the DataLog class. | |
12 | |
13 #include "webrtc/system_wrappers/include/data_log_c.h" | |
14 | |
15 #include <string> | |
16 | |
17 #include "webrtc/system_wrappers/include/data_log.h" | |
18 | |
19 extern "C" int WebRtcDataLog_CreateLog() { | |
20 return webrtc::DataLog::CreateLog(); | |
21 } | |
22 | |
23 extern "C" void WebRtcDataLog_ReturnLog() { | |
24 return webrtc::DataLog::ReturnLog(); | |
25 } | |
26 | |
27 extern "C" char* WebRtcDataLog_Combine(char* combined_name, size_t combined_len, | |
28 const char* table_name, int table_id) { | |
29 if (!table_name) return NULL; | |
30 std::string combined = webrtc::DataLog::Combine(table_name, table_id); | |
31 if (combined.size() >= combined_len) return NULL; | |
32 std::copy(combined.begin(), combined.end(), combined_name); | |
33 combined_name[combined.size()] = '\0'; | |
34 return combined_name; | |
35 } | |
36 | |
37 extern "C" int WebRtcDataLog_AddTable(const char* table_name) { | |
38 if (!table_name) return -1; | |
39 return webrtc::DataLog::AddTable(table_name); | |
40 } | |
41 | |
42 extern "C" int WebRtcDataLog_AddColumn(const char* table_name, | |
43 const char* column_name, | |
44 int multi_value_length) { | |
45 if (!table_name || !column_name) return -1; | |
46 return webrtc::DataLog::AddColumn(table_name, column_name, | |
47 multi_value_length); | |
48 } | |
49 | |
50 extern "C" int WebRtcDataLog_InsertCell_int(const char* table_name, | |
51 const char* column_name, | |
52 int value) { | |
53 if (!table_name || !column_name) return -1; | |
54 return webrtc::DataLog::InsertCell(table_name, column_name, value); | |
55 } | |
56 | |
57 extern "C" int WebRtcDataLog_InsertArray_int(const char* table_name, | |
58 const char* column_name, | |
59 const int* values, | |
60 int length) { | |
61 if (!table_name || !column_name) return -1; | |
62 return webrtc::DataLog::InsertCell(table_name, column_name, values, length); | |
63 } | |
64 | |
65 extern "C" int WebRtcDataLog_InsertCell_float(const char* table_name, | |
66 const char* column_name, | |
67 float value) { | |
68 if (!table_name || !column_name) return -1; | |
69 return webrtc::DataLog::InsertCell(table_name, column_name, value); | |
70 } | |
71 | |
72 extern "C" int WebRtcDataLog_InsertArray_float(const char* table_name, | |
73 const char* column_name, | |
74 const float* values, | |
75 int length) { | |
76 if (!table_name || !column_name) return -1; | |
77 return webrtc::DataLog::InsertCell(table_name, column_name, values, length); | |
78 } | |
79 | |
80 extern "C" int WebRtcDataLog_InsertCell_double(const char* table_name, | |
81 const char* column_name, | |
82 double value) { | |
83 if (!table_name || !column_name) return -1; | |
84 return webrtc::DataLog::InsertCell(table_name, column_name, value); | |
85 } | |
86 | |
87 extern "C" int WebRtcDataLog_InsertArray_double(const char* table_name, | |
88 const char* column_name, | |
89 const double* values, | |
90 int length) { | |
91 if (!table_name || !column_name) return -1; | |
92 return webrtc::DataLog::InsertCell(table_name, column_name, values, length); | |
93 } | |
94 | |
95 extern "C" int WebRtcDataLog_InsertCell_int32(const char* table_name, | |
96 const char* column_name, | |
97 int32_t value) { | |
98 if (!table_name || !column_name) return -1; | |
99 return webrtc::DataLog::InsertCell(table_name, column_name, value); | |
100 } | |
101 | |
102 extern "C" int WebRtcDataLog_InsertArray_int32(const char* table_name, | |
103 const char* column_name, | |
104 const int32_t* values, | |
105 int length) { | |
106 if (!table_name || !column_name) return -1; | |
107 return webrtc::DataLog::InsertCell(table_name, column_name, values, length); | |
108 } | |
109 | |
110 extern "C" int WebRtcDataLog_InsertCell_uint32(const char* table_name, | |
111 const char* column_name, | |
112 uint32_t value) { | |
113 if (!table_name || !column_name) return -1; | |
114 return webrtc::DataLog::InsertCell(table_name, column_name, value); | |
115 } | |
116 | |
117 extern "C" int WebRtcDataLog_InsertArray_uint32(const char* table_name, | |
118 const char* column_name, | |
119 const uint32_t* values, | |
120 int length) { | |
121 if (!table_name || !column_name) return -1; | |
122 return webrtc::DataLog::InsertCell(table_name, column_name, values, length); | |
123 } | |
124 | |
125 extern "C" int WebRtcDataLog_InsertCell_int64(const char* table_name, | |
126 const char* column_name, | |
127 int64_t value) { | |
128 if (!table_name || !column_name) return -1; | |
129 return webrtc::DataLog::InsertCell(table_name, column_name, value); | |
130 } | |
131 | |
132 extern "C" int WebRtcDataLog_InsertArray_int64(const char* table_name, | |
133 const char* column_name, | |
134 const int64_t* values, | |
135 int length) { | |
136 if (!table_name || !column_name) return -1; | |
137 return webrtc::DataLog::InsertCell(table_name, column_name, values, length); | |
138 } | |
139 | |
140 extern "C" int WebRtcDataLog_NextRow(const char* table_name) { | |
141 if (!table_name) return -1; | |
142 return webrtc::DataLog::NextRow(table_name); | |
143 } | |
OLD | NEW |