LCOV - code coverage report
Current view: top level - irohad/model/generators - command_generator.hpp (source / functions) Hit Total Coverage
Test: cleared_cor.info Lines: 0 1 0.0 %
Date: 2019-03-07 14:46:43 Functions: 0 11 0.0 %

          Line data    Source code
       1             : /**
       2             :  * Copyright Soramitsu Co., Ltd. All Rights Reserved.
       3             :  * SPDX-License-Identifier: Apache-2.0
       4             :  */
       5             : 
       6             : #ifndef IROHA_COMMAND_GENERATOR_HPP
       7             : #define IROHA_COMMAND_GENERATOR_HPP
       8             : 
       9             : #include <memory>
      10             : #include "crypto/keypair.hpp"
      11             : #include "generator/generator.hpp"
      12             : 
      13             : namespace iroha {
      14             :   namespace model {
      15             : 
      16             :     struct Peer;
      17             :     struct Command;
      18             :     struct Account;
      19             : 
      20             :     namespace generators {
      21             : 
      22             :       class CommandGenerator {
      23             :        public:
      24             :         std::shared_ptr<Command> generateAddPeer(const Peer &peer);
      25             : 
      26             :         std::shared_ptr<Command> generateAddSignatory(
      27             :             const std::string &account_id, const pubkey_t &key);
      28             : 
      29             :         std::shared_ptr<Command> generateRemoveSignatory(
      30             :             const std::string &account_id, const pubkey_t &key);
      31             : 
      32             :         std::shared_ptr<Command> generateCreateAccount(
      33             :             const std::string &account_name,
      34             :             const std::string &domain_id,
      35             :             const pubkey_t &key);
      36             : 
      37             :         std::shared_ptr<Command> generateCreateDomain(
      38             :             const std::string &domain_id, const std::string &default_role);
      39             : 
      40             :         std::shared_ptr<Command> generateCreateAsset(
      41             :             const std::string &asset_name,
      42             :             const std::string &domain_name,
      43             :             uint8_t precision);
      44             : 
      45             :         template <typename Type, typename... ParamTypes>
      46             :         std::shared_ptr<Command> generateCommand(ParamTypes... args) {
      47           0 :           return std::make_shared<Type>(args...);
      48             :         }
      49             : 
      50             :         std::shared_ptr<Command> generateCreateAdminRole(std::string role_name);
      51             : 
      52             :         std::shared_ptr<Command> generateCreateUserRole(std::string role_name);
      53             : 
      54             :         std::shared_ptr<Command> generateCreateAssetCreatorRole(
      55             :             std::string role_name);
      56             : 
      57             :         std::shared_ptr<Command> generateSetQuorum(
      58             :             const std::string &account_id, uint32_t quorum);
      59             : 
      60             :         std::shared_ptr<Command> generateAddAssetQuantity(
      61             :             const std::string &asset_id, const std::string &amount);
      62             : 
      63             :         std::shared_ptr<Command> generateSubtractAssetQuantity(
      64             :             const std::string &asset_id, const std::string &amount);
      65             :         /**
      66             :          * Generate transfer assets from source account_id to target account_id
      67             :          * @param src_account_id - source account identifier
      68             :          * @param target_account_id - target account identifier
      69             :          * @param asset_id - asset identifier to transfer
      70             :          * @param amount - amount of assets to transfer
      71             :          * @return
      72             :          */
      73             :         std::shared_ptr<Command> generateTransferAsset(
      74             :             const std::string &src_account_id,
      75             :             const std::string &target_account_id,
      76             :             const std::string &asset_id,
      77             :             const std::string &amount);
      78             : 
      79             :         std::shared_ptr<Command> generateAppendRole(
      80             :             const std::string &account_id, const std::string &role_name);
      81             :       };
      82             :     }  // namespace generators
      83             :   }    // namespace model
      84             : }  // namespace iroha
      85             : 
      86             : #endif  // IROHA_COMMAND_GENERATOR_HPP

Generated by: LCOV version 1.13