Proactive Safety Framework  1.0
protobuf_util.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11 */
12 
13 #ifndef PROTOAPI
14 #define PROTOAPI
15 
16 #ifdef __cplusplus
17 extern "C"
18 {
19 #endif
20 
21  typedef enum
22  {
34  } Type;
35 
36  typedef struct
37  {
38  int64_t seconds;
39  int32_t nanos;
40  } TimeStamp;
41 
42  typedef struct
43  {
45  union
46  {
47  int32_t i32;
48  int64_t i64;
49  uint32_t u32;
50  uint64_t u64;
51  float f;
52  double d;
53  const char *s;
54  bool b;
55  const char *mapValue;
57  } data;
58  } Result;
59 
60  typedef struct
61  {
63  union
64  {
65  int32_t i32;
66  int64_t i64;
67  uint32_t u32;
68  uint64_t u64;
69  float f;
70  double d;
71  const char *s;
72  bool b;
73  const char *mapValue;
75  } data;
76  } FieldData;
77 
78  Result getFieldValue(const google::protobuf::Message &, char *);
79 
80  bool getFieldPresence(const google::protobuf::Message &, char *);
81 
82  void setFieldValue(google::protobuf::Message &, char *, FieldData);
83 
85 
86  Result getFieldValueFromFile(google::protobuf::Message &, char *, char *);
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif
bool getFieldPresence(const google::protobuf::Message &, char *)
Type
Definition: protobuf_util.h:22
@ VALUE_TYPE_TIMESTAMP
Definition: protobuf_util.h:31
@ VALUE_TYPE_FLOAT
Definition: protobuf_util.h:27
@ VALUE_TYPE_INT64
Definition: protobuf_util.h:24
@ VALUE_TYPE_BOOL
Definition: protobuf_util.h:30
@ VALUE_TYPE_ERROR
Definition: protobuf_util.h:32
@ VALUE_TYPE_DOUBLE
Definition: protobuf_util.h:28
@ VALUE_TYPE_UINT32
Definition: protobuf_util.h:25
@ VALUE_TYPE_STRING
Definition: protobuf_util.h:29
@ VALUE_TYPE_UINT64
Definition: protobuf_util.h:26
@ VALUE_TYPE_MAPVALUE
Definition: protobuf_util.h:33
@ VALUE_TYPE_INT32
Definition: protobuf_util.h:23
Result getFieldValueFromFile(google::protobuf::Message &, char *, char *)
void setFieldValue(google::protobuf::Message &, char *, FieldData)
bool checkProtobufVersion()
Result getFieldValue(const google::protobuf::Message &, char *)
Definition: protobuf_util.h:61
int32_t i32
Definition: protobuf_util.h:65
uint32_t u32
Definition: protobuf_util.h:67
double d
Definition: protobuf_util.h:70
Type type
Definition: protobuf_util.h:62
const char * s
Definition: protobuf_util.h:71
bool b
Definition: protobuf_util.h:72
TimeStamp * timestamp
Definition: protobuf_util.h:74
uint64_t u64
Definition: protobuf_util.h:68
const char * mapValue
Definition: protobuf_util.h:73
float f
Definition: protobuf_util.h:69
int64_t i64
Definition: protobuf_util.h:66
Definition: protobuf_util.h:43
int32_t i32
Definition: protobuf_util.h:47
const char * s
Definition: protobuf_util.h:53
TimeStamp timestamp
Definition: protobuf_util.h:56
float f
Definition: protobuf_util.h:51
bool b
Definition: protobuf_util.h:54
Type type
Definition: protobuf_util.h:44
uint32_t u32
Definition: protobuf_util.h:49
double d
Definition: protobuf_util.h:52
uint64_t u64
Definition: protobuf_util.h:50
const char * mapValue
Definition: protobuf_util.h:55
int64_t i64
Definition: protobuf_util.h:48
Definition: protobuf_util.h:37
int32_t nanos
Definition: protobuf_util.h:39
int64_t seconds
Definition: protobuf_util.h:38