Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
f84c0287
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f84c0287
编写于
6月 11, 2017
作者:
M
Matias Romeo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add necessary functions to support type_object serialization
上级
e1691416
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
51 addition
and
0 deletion
+51
-0
libraries/chain/CMakeLists.txt
libraries/chain/CMakeLists.txt
+2
-0
libraries/chain/include/eos/chain/type_object.hpp
libraries/chain/include/eos/chain/type_object.hpp
+3
-0
libraries/chain/include/eos/chain/types.hpp
libraries/chain/include/eos/chain/types.hpp
+5
-0
libraries/chain/types.cpp
libraries/chain/types.cpp
+41
-0
未找到文件。
libraries/chain/CMakeLists.txt
浏览文件 @
f84c0287
...
@@ -14,6 +14,8 @@ add_library( eos_chain
...
@@ -14,6 +14,8 @@ add_library( eos_chain
block_log.cpp
block_log.cpp
BlockchainConfiguration.cpp
BlockchainConfiguration.cpp
types.cpp
${
HEADERS
}
${
HEADERS
}
)
)
...
...
libraries/chain/include/eos/chain/type_object.hpp
浏览文件 @
f84c0287
...
@@ -38,6 +38,7 @@ namespace eos { namespace chain {
...
@@ -38,6 +38,7 @@ namespace eos { namespace chain {
TypeName
base
;
TypeName
base
;
shared_vector
<
Field
>
fields
;
shared_vector
<
Field
>
fields
;
};
};
using
type_id_type
=
type_object
::
id_type
;
struct
by_scope_name
;
struct
by_scope_name
;
using
type_index
=
chainbase
::
shared_multi_index_container
<
using
type_index
=
chainbase
::
shared_multi_index_container
<
...
@@ -57,4 +58,6 @@ namespace eos { namespace chain {
...
@@ -57,4 +58,6 @@ namespace eos { namespace chain {
CHAINBASE_SET_INDEX_TYPE
(
eos
::
chain
::
type_object
,
eos
::
chain
::
type_index
)
CHAINBASE_SET_INDEX_TYPE
(
eos
::
chain
::
type_object
,
eos
::
chain
::
type_index
)
FC_REFLECT
(
chainbase
::
oid
<
eos
::
chain
::
type_object
>
,
(
_id
))
FC_REFLECT
(
eos
::
chain
::
type_object
,
(
id
)(
scope
)(
name
)(
base_scope
)(
base
)(
fields
)
)
FC_REFLECT
(
eos
::
chain
::
type_object
,
(
id
)(
scope
)(
name
)(
base_scope
)(
base
)(
fields
)
)
libraries/chain/include/eos/chain/types.hpp
浏览文件 @
f84c0287
...
@@ -179,6 +179,11 @@ namespace eos { namespace chain {
...
@@ -179,6 +179,11 @@ namespace eos { namespace chain {
}
}
// eos::chain
}
}
// eos::chain
namespace
fc
{
void
to_variant
(
const
shared_vector
<
eos
::
types
::
Field
>&
c
,
fc
::
variant
&
v
);
void
from_variant
(
const
fc
::
variant
&
v
,
shared_vector
<
eos
::
types
::
Field
>&
fields
);
}
FC_REFLECT_ENUM
(
eos
::
chain
::
object_type
,
FC_REFLECT_ENUM
(
eos
::
chain
::
object_type
,
(
null_object_type
)
(
null_object_type
)
(
account_object_type
)
(
account_object_type
)
...
...
libraries/chain/types.cpp
0 → 100644
浏览文件 @
f84c0287
/*
* Copyright (c) 2017, Respective Authors.
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <eos/chain/types.hpp>
namespace
fc
{
using
eos
::
chain
::
shared_vector
;
void
to_variant
(
const
shared_vector
<
eos
::
types
::
Field
>&
c
,
fc
::
variant
&
v
)
{
fc
::
mutable_variant_object
mvo
;
mvo
.
reserve
(
c
.
size
());
for
(
const
auto
&
f
:
c
)
{
mvo
.
set
(
f
.
name
,
eos
::
types
::
String
(
f
.
type
));
}
v
=
std
::
move
(
mvo
);
}
void
from_variant
(
const
fc
::
variant
&
v
,
shared_vector
<
eos
::
types
::
Field
>&
fields
)
{
const
auto
&
obj
=
v
.
get_object
();
fields
.
reserve
(
obj
.
size
());
for
(
const
auto
&
f
:
obj
)
fields
.
emplace_back
(
eos
::
types
::
Field
{
f
.
key
(),
f
.
value
().
get_string
()
});
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录