Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
538245e3
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
538245e3
编写于
11月 06, 2018
作者:
A
Aaron Xiao
提交者:
Jiangtao Hu
12月 13, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Common: Retire yaml_util which is not used.
上级
68f02852
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
0 addition
and
213 deletion
+0
-213
modules/common/util/BUILD
modules/common/util/BUILD
+0
-28
modules/common/util/testdata/simple_proto.pb.txt
modules/common/util/testdata/simple_proto.pb.txt
+0
-14
modules/common/util/testdata/simple_proto.yaml
modules/common/util/testdata/simple_proto.yaml
+0
-9
modules/common/util/yaml_util.cc
modules/common/util/yaml_util.cc
+0
-78
modules/common/util/yaml_util.h
modules/common/util/yaml_util.h
+0
-36
modules/common/util/yaml_util_test.cc
modules/common/util/yaml_util_test.cc
+0
-46
modules/dreamview/backend/hmi/BUILD
modules/dreamview/backend/hmi/BUILD
+0
-1
modules/dreamview/backend/hmi/hmi_worker.cc
modules/dreamview/backend/hmi/hmi_worker.cc
+0
-1
未找到文件。
modules/common/util/BUILD
浏览文件 @
538245e3
...
...
@@ -268,34 +268,6 @@ cc_test(
],
)
cc_library
(
name
=
"yaml_util"
,
srcs
=
[
"yaml_util.cc"
,
],
hdrs
=
[
"yaml_util.h"
,
],
deps
=
[
"@com_google_protobuf//:protobuf"
,
"@yaml_cpp//:yaml"
,
],
)
cc_test
(
name
=
"yaml_util_test"
,
size
=
"small"
,
srcs
=
[
"yaml_util_test.cc"
,
],
deps
=
[
":util"
,
":yaml_util"
,
"//modules/common/util/testdata:simple_proto"
,
"@gtest//:main"
,
],
)
cc_library
(
name
=
"http_client"
,
srcs
=
[
"http_client.cc"
],
...
...
modules/common/util/testdata/simple_proto.pb.txt
已删除
100644 → 0
浏览文件 @
68f02852
message {
integer: 1
text: "234"
header {
module_name: "Message 1"
status {
msg: "Status"
error_code: OK
}
}
}
message {
integer: 2
}
modules/common/util/testdata/simple_proto.yaml
已删除
100644 → 0
浏览文件 @
68f02852
message
:
-
integer
:
1
text
:
"
234"
header
:
module_name
:
"
Message
1"
status
:
msg
:
"
Status"
error_code
:
"
OK"
-
integer
:
2
modules/common/util/yaml_util.cc
已删除
100644 → 0
浏览文件 @
68f02852
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/common/util/yaml_util.h"
#include <google/protobuf/util/json_util.h>
#include <yaml-cpp/yaml.h>
namespace
apollo
{
namespace
common
{
namespace
util
{
namespace
{
void
YamlNodeToJson
(
const
YAML
::
Node
&
node
,
std
::
ostringstream
*
oss
)
{
switch
(
node
.
Type
())
{
case
YAML
::
NodeType
::
Undefined
:
*
oss
<<
"
\"\"
"
;
break
;
case
YAML
::
NodeType
::
Null
:
*
oss
<<
"
\"\"
"
;
break
;
case
YAML
::
NodeType
::
Scalar
:
*
oss
<<
"
\"
"
<<
node
.
as
<
std
::
string
>
()
<<
"
\"
"
;
break
;
case
YAML
::
NodeType
::
Sequence
:
*
oss
<<
"[
\n
"
;
for
(
const
auto
&
sub_node
:
node
)
{
YamlNodeToJson
(
sub_node
,
oss
);
*
oss
<<
", "
;
}
*
oss
<<
"]
\n
"
;
break
;
case
YAML
::
NodeType
::
Map
:
*
oss
<<
"{
\n
"
;
for
(
const
auto
&
sub_node
:
node
)
{
YamlNodeToJson
(
sub_node
.
first
,
oss
);
*
oss
<<
": "
;
YamlNodeToJson
(
sub_node
.
second
,
oss
);
*
oss
<<
",
\n
"
;
}
*
oss
<<
"}
\n
"
;
break
;
}
}
}
// namespace
// Load YAML file to an equivalent json string.
std
::
string
YamlToJson
(
const
std
::
string
&
yaml_file
)
{
std
::
ostringstream
oss
;
YamlNodeToJson
(
YAML
::
LoadFile
(
yaml_file
),
&
oss
);
return
oss
.
str
();
}
// Load YAML file to an equivalent proto message.
// Return false if failed.
bool
YamlToProto
(
const
std
::
string
&
yaml_file
,
google
::
protobuf
::
Message
*
proto
)
{
const
std
::
string
json
=
YamlToJson
(
yaml_file
);
return
google
::
protobuf
::
util
::
JsonStringToMessage
(
json
,
proto
).
ok
();
}
}
// namespace util
}
// namespace common
}
// namespace apollo
modules/common/util/yaml_util.h
已删除
100644 → 0
浏览文件 @
68f02852
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#pragma once
#include <string>
#include "google/protobuf/message.h"
namespace
apollo
{
namespace
common
{
namespace
util
{
// Load YAML file to an equivalent json string.
std
::
string
YamlToJson
(
const
std
::
string
&
yaml_file
);
// Load YAML file to an equivalent proto message.
// Return false if failed.
bool
YamlToProto
(
const
std
::
string
&
yaml_file
,
google
::
protobuf
::
Message
*
proto
);
}
// namespace util
}
// namespace common
}
// namespace apollo
modules/common/util/yaml_util_test.cc
已删除
100644 → 0
浏览文件 @
68f02852
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/common/util/yaml_util.h"
#include "gtest/gtest.h"
#include "modules/common/util/file.h"
#include "modules/common/util/testdata/simple.pb.h"
#include "modules/common/util/util.h"
namespace
apollo
{
namespace
common
{
namespace
util
{
TEST
(
YamlUtilTest
,
YamlToProto
)
{
const
std
::
string
kInputYamlFile
=
"/apollo/modules/common/util/testdata/simple_proto.yaml"
;
const
std
::
string
kExpectedProtoFile
=
"/apollo/modules/common/util/testdata/simple_proto.pb.txt"
;
test
::
SimpleRepeatedMessage
loaded_proto
;
EXPECT_TRUE
(
YamlToProto
(
kInputYamlFile
,
&
loaded_proto
));
test
::
SimpleRepeatedMessage
expected_proto
;
ASSERT_TRUE
(
GetProtoFromASCIIFile
(
kExpectedProtoFile
,
&
expected_proto
));
EXPECT_TRUE
(
IsProtoEqual
(
expected_proto
,
loaded_proto
));
}
}
// namespace util
}
// namespace common
}
// namespace apollo
modules/dreamview/backend/hmi/BUILD
浏览文件 @
538245e3
...
...
@@ -66,7 +66,6 @@ cc_library(
"//modules/common/proto:drive_event_proto"
,
"//modules/common/util:map_util"
,
"//modules/common/util:message_util"
,
"//modules/common/util:yaml_util"
,
"//modules/data/util:info_collector"
,
"//modules/dreamview/backend/common:dreamview_gflags"
,
"//modules/dreamview/proto:hmi_config_proto"
,
...
...
modules/dreamview/backend/hmi/hmi_worker.cc
浏览文件 @
538245e3
...
...
@@ -27,7 +27,6 @@
#include "modules/common/util/message_util.h"
#include "modules/common/util/string_tokenizer.h"
#include "modules/common/util/string_util.h"
#include "modules/common/util/yaml_util.h"
#include "modules/data/util/info_collector.h"
#include "modules/dreamview/backend/common/dreamview_gflags.h"
#include "modules/dreamview/backend/hmi/vehicle_manager.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录