hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
pb_command_factory.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_PB_COMMAND_FACTORY_HPP
7 #define IROHA_PB_COMMAND_FACTORY_HPP
8 
9 #include <primitive.pb.h>
10 #include <boost/bimap.hpp>
11 #include <unordered_map>
12 #include "commands.pb.h"
30 
31 namespace iroha {
32  namespace model {
33  namespace converters {
34 
39  public:
41  // asset quantity
42  protocol::AddAssetQuantity serializeAddAssetQuantity(
43  const model::AddAssetQuantity &addAssetQuantity);
45  const protocol::AddAssetQuantity &addAssetQuantity);
46 
47  // subtract asset quantity
48  protocol::SubtractAssetQuantity serializeSubtractAssetQuantity(
49  const model::SubtractAssetQuantity &subtractAssetQuantity);
51  const protocol::SubtractAssetQuantity &subtractAssetQuantity);
52 
53  // add peer
54  protocol::AddPeer serializeAddPeer(const model::AddPeer &addPeer);
55  model::AddPeer deserializeAddPeer(const protocol::AddPeer &addPeer);
56 
57  // add signatory
58  protocol::AddSignatory serializeAddSignatory(
59  const model::AddSignatory &addSignatory);
61  const protocol::AddSignatory &addSignatory);
62 
63  // create asset
64  protocol::CreateAsset serializeCreateAsset(
65  const model::CreateAsset &createAsset);
67  const protocol::CreateAsset &createAsset);
68 
69  // create account
70  protocol::CreateAccount serializeCreateAccount(
71  const model::CreateAccount &createAccount);
73  const protocol::CreateAccount &createAccount);
74 
75  // create domain
76  protocol::CreateDomain serializeCreateDomain(
77  const model::CreateDomain &createDomain);
79  const protocol::CreateDomain &createDomain);
80 
81  // remove signatory
82  protocol::RemoveSignatory serializeRemoveSignatory(
83  const model::RemoveSignatory &removeSignatory);
85  const protocol::RemoveSignatory &removeSignatory);
86 
87  // set account quorum
88  protocol::SetAccountQuorum serializeSetQuorum(
89  const model::SetQuorum &setAccountQuorum);
91  const protocol::SetAccountQuorum &setAccountQuorum);
92 
93  // transfer asset
94  protocol::TransferAsset serializeTransferAsset(
95  const model::TransferAsset &subtractAssetQuantity);
97  const protocol::TransferAsset &subtractAssetQuantity);
98 
99  // Append role
100  protocol::AppendRole serializeAppendRole(
101  const model::AppendRole &command);
103  const protocol::AppendRole &command);
104 
105  // Append role
106  protocol::DetachRole serializeDetachRole(
107  const model::DetachRole &command);
109  const protocol::DetachRole &command);
110 
111  // Create Role
112  protocol::CreateRole serializeCreateRole(
113  const model::CreateRole &command);
115  const protocol::CreateRole &command);
116 
117  // Grant Permission
118  protocol::GrantPermission serializeGrantPermission(
119  const model::GrantPermission &command);
121  const protocol::GrantPermission &command);
122 
123  // Revoke Permission
124  protocol::RevokePermission serializeRevokePermission(
125  const model::RevokePermission &command);
127  const protocol::RevokePermission &command);
128 
129  // Set Account Detail
130  protocol::SetAccountDetail serializeSetAccountDetail(
131  const model::SetAccountDetail &command);
133  const protocol::SetAccountDetail &command);
134 
135  // abstract
136  protocol::Command serializeAbstractCommand(
137  const model::Command &command);
138  std::shared_ptr<model::Command> deserializeAbstractCommand(
139  const protocol::Command &command);
140 
141  protected:
142  boost::bimap<iroha::protocol::RolePermission, std::string> pb_role_map_;
143  boost::bimap<iroha::protocol::GrantablePermission, std::string>
145  };
146  } // namespace converters
147  } // namespace model
148 } // namespace iroha
149 #endif // IROHA_PB_COMMAND_FACTORY_HPP
Definition: add_peer.hpp:20
Definition: create_domain.hpp:16
protocol::CreateAsset serializeCreateAsset(const model::CreateAsset &createAsset)
Definition: pb_command_factory.cpp:233
model::CreateAsset deserializeCreateAsset(const protocol::CreateAsset &createAsset)
Definition: pb_command_factory.cpp:242
Definition: transfer_asset.hpp:18
protocol::DetachRole serializeDetachRole(const model::DetachRole &command)
Definition: pb_command_factory.cpp:366
Definition: command.hpp:14
protocol::SetAccountQuorum serializeSetQuorum(const model::SetQuorum &setAccountQuorum)
Definition: pb_command_factory.cpp:305
Definition: revoke_permission.hpp:18
protocol::AddPeer serializeAddPeer(const model::AddPeer &addPeer)
Definition: pb_command_factory.cpp:199
protocol::Command serializeAbstractCommand(const model::Command &command)
Definition: pb_command_factory.cpp:459
Definition: create_role.hpp:18
boost::bimap< iroha::protocol::RolePermission, std::string > pb_role_map_
Definition: pb_command_factory.hpp:142
Definition: remove_signatory.hpp:18
model::AddSignatory deserializeAddSignatory(const protocol::AddSignatory &addSignatory)
Definition: pb_command_factory.cpp:224
Definition: pb_command_factory.hpp:38
model::CreateAccount deserializeCreateAccount(const protocol::CreateAccount &createAccount)
Definition: pb_command_factory.cpp:261
model::RevokePermission deserializeRevokePermission(const protocol::RevokePermission &command)
Definition: pb_command_factory.cpp:432
PbCommandFactory()
Definition: pb_command_factory.cpp:30
model::AppendRole deserializeAppendRole(const protocol::AppendRole &command)
Definition: pb_command_factory.cpp:347
protocol::TransferAsset serializeTransferAsset(const model::TransferAsset &subtractAssetQuantity)
Definition: pb_command_factory.cpp:321
model::CreateDomain deserializeCreateDomain(const protocol::CreateDomain &createDomain)
Definition: pb_command_factory.cpp:279
model::RemoveSignatory deserializeRemoveSignatory(const protocol::RemoveSignatory &removeSignatory)
Definition: pb_command_factory.cpp:297
std::shared_ptr< model::Command > deserializeAbstractCommand(const protocol::Command &command)
Definition: pb_command_factory.cpp:592
protocol::AppendRole serializeAppendRole(const model::AppendRole &command)
Definition: pb_command_factory.cpp:352
protocol::CreateAccount serializeCreateAccount(const model::CreateAccount &createAccount)
Definition: pb_command_factory.cpp:253
Definition: append_role.hpp:17
Definition: block_query.hpp:16
protocol::CreateRole serializeCreateRole(const model::CreateRole &command)
Definition: pb_command_factory.cpp:391
Definition: create_asset.hpp:18
protocol::GrantPermission serializeGrantPermission(const model::GrantPermission &command)
Definition: pb_command_factory.cpp:405
model::GrantPermission deserializeGrantPermission(const protocol::GrantPermission &command)
Definition: pb_command_factory.cpp:414
model::AddPeer deserializeAddPeer(const protocol::AddPeer &addPeer)
Definition: pb_command_factory.cpp:207
boost::bimap< iroha::protocol::GrantablePermission, std::string > pb_grant_map_
Definition: pb_command_factory.hpp:144
Definition: set_quorum.hpp:17
protocol::AddSignatory serializeAddSignatory(const model::AddSignatory &addSignatory)
Definition: pb_command_factory.cpp:216
model::DetachRole deserializeDetachRole(const protocol::DetachRole &command)
Definition: pb_command_factory.cpp:361
protocol::CreateDomain serializeCreateDomain(const model::CreateDomain &createDomain)
Definition: pb_command_factory.cpp:271
model::AddAssetQuantity deserializeAddAssetQuantity(const protocol::AddAssetQuantity &addAssetQuantity)
Definition: pb_command_factory.cpp:167
model::SubtractAssetQuantity deserializeSubtractAssetQuantity(const protocol::SubtractAssetQuantity &subtractAssetQuantity)
Definition: pb_command_factory.cpp:188
model::SetQuorum deserializeSetQuorum(const protocol::SetAccountQuorum &setAccountQuorum)
Definition: pb_command_factory.cpp:312
Definition: subtract_asset_quantity.hpp:17
model::SetAccountDetail deserializeSetAccountDetail(const protocol::SetAccountDetail &command)
Definition: pb_command_factory.cpp:450
model::TransferAsset deserializeTransferAsset(const protocol::TransferAsset &subtractAssetQuantity)
Definition: pb_command_factory.cpp:333
Definition: grant_permission.hpp:18
protocol::AddAssetQuantity serializeAddAssetQuantity(const model::AddAssetQuantity &addAssetQuantity)
Definition: pb_command_factory.cpp:159
protocol::RemoveSignatory serializeRemoveSignatory(const model::RemoveSignatory &removeSignatory)
Definition: pb_command_factory.cpp:288
protocol::SetAccountDetail serializeSetAccountDetail(const model::SetAccountDetail &command)
Definition: pb_command_factory.cpp:441
protocol::SubtractAssetQuantity serializeSubtractAssetQuantity(const model::SubtractAssetQuantity &subtractAssetQuantity)
Definition: pb_command_factory.cpp:178
Definition: add_asset_quantity.hpp:18
model::CreateRole deserializeCreateRole(const protocol::CreateRole &command)
Definition: pb_command_factory.cpp:375
Definition: set_account_detail.hpp:15
Definition: detach_role.hpp:17
Definition: add_signatory.hpp:19
protocol::RevokePermission serializeRevokePermission(const model::RevokePermission &command)
Definition: pb_command_factory.cpp:423
Definition: create_account.hpp:17