• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ flat_set类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中flat_set的典型用法代码示例。如果您正苦于以下问题:C++ flat_set类的具体用法?C++ flat_set怎么用?C++ flat_set使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了flat_set类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: s

set<public_key_type> signed_transaction::get_required_signatures(
   const chain_id_type& chain_id,
   const flat_set<public_key_type>& available_keys,
   const std::function<const authority*(account_id_type)>& get_active,
   const std::function<const authority*(account_id_type)>& get_owner,
   uint32_t max_recursion_depth )const
{
   flat_set<account_id_type> required_active;
   flat_set<account_id_type> required_owner;
   vector<authority> other;
   get_required_authorities( required_active, required_owner, other );


   sign_state s(get_signature_keys( chain_id ),get_active,available_keys);
   s.max_recursion = max_recursion_depth;

   for( const auto& auth : other )
      s.check_authority(&auth);
   for( auto& owner : required_owner )
      s.check_authority( get_owner( owner ) );
   for( auto& active : required_active )
      s.check_authority( active  );

   s.remove_unused_signatures();

   set<public_key_type> result;

   for( auto& provided_sig : s.provided_signatures )
      if( available_keys.find( provided_sig.first ) != available_keys.end() )
         result.insert( provided_sig.first );

   return result;
}
开发者ID:8001800,项目名称:graphene,代码行数:33,代码来源:transaction.cpp


示例2: get_required_active_authorities

 void get_required_active_authorities( flat_set<account_id_type>& a )const
 {
    // registrar should be required anyway as it is the fee_payer(), but we insert it here just to be sure
    a.insert( registrar );
    if( extensions.value.buyback_options.valid() )
       a.insert( extensions.value.buyback_options->asset_to_buy_issuer );
 }
开发者ID:hanxueming126,项目名称:bitshares-core,代码行数:7,代码来源:account.hpp


示例3: hasSafeMultiReports

bool RoseDedupeAuxImpl::hasSafeMultiReports(
    const flat_set<ReportID> &reports) const {
    if (reports.size() <= 1) {
        return true;
    }

    /* We have more than one ReportID corresponding to the external ID that is
     * presented to the user. These may differ in offset adjustment, bounds
     * checks, etc. */

    /* TODO: work out if these differences will actually cause problems */

    /* One common case where we know we don't have a problem is if there are
     * precisely two reports, one for the main Rose path and one for the
     * "small block matcher" path. */
    if (reports.size() == 2) {
        ReportID id1 = *reports.begin();
        ReportID id2 = *reports.rbegin();

        bool has_verts_1 = contains(vert_map, id1);
        bool has_verts_2 = contains(vert_map, id2);
        bool has_sb_verts_1 = contains(sb_vert_map, id1);
        bool has_sb_verts_2 = contains(sb_vert_map, id2);

        if (has_verts_1 != has_verts_2 && has_sb_verts_1 != has_sb_verts_2) {
            DEBUG_PRINTF("two reports, one full and one small block: ok\n");
            return true;
        }
    }

    DEBUG_PRINTF("more than one report\n");
    return false;
}
开发者ID:tomzhang,项目名称:hyperscan,代码行数:33,代码来源:rose_build_dedupe.cpp


示例4: authority_checker

 authority_checker( PermissionToAuthorityFunc permission_to_authority, 
                    uint16_t recursion_depth_limit, const flat_set<public_key_type>& signing_keys,
                    flat_set<account_name> provided_auths = flat_set<account_name>() )
    : permission_to_authority(permission_to_authority),
      recursion_depth_limit(recursion_depth_limit),
      signing_keys(signing_keys.begin(), signing_keys.end()),
      _provided_auths(provided_auths.begin(), provided_auths.end()),
      _used_keys(signing_keys.size(), false)
 {}
开发者ID:liuenci,项目名称:eos,代码行数:9,代码来源:authority_checker.hpp


示例5: verify_authority

void verify_authority( const vector<operation>& ops, const flat_set<public_key_type>& sigs, 
                       const std::function<const authority*(account_id_type)>& get_active,
                       const std::function<const authority*(account_id_type)>& get_owner,
                       uint32_t max_recursion_depth,
                       bool  allow_committe,
                       const flat_set<account_id_type>& active_aprovals,
                       const flat_set<account_id_type>& owner_approvals )
{ try {
   flat_set<account_id_type> required_active;
   flat_set<account_id_type> required_owner;
   vector<authority> other;

   for( const auto& op : ops )
      operation_get_required_authorities( op, required_active, required_owner, other );

   if( !allow_committe )
      GRAPHENE_ASSERT( required_active.find(GRAPHENE_COMMITTEE_ACCOUNT) == required_active.end(),
                       invalid_committee_approval, "Committee account may only propose transactions" );

   sign_state s(sigs,get_active);
   s.max_recursion = max_recursion_depth;
   for( auto& id : active_aprovals )
      s.approved_by.insert( id );
   for( auto& id : owner_approvals )
      s.approved_by.insert( id );

   for( const auto& auth : other )
   {
      GRAPHENE_ASSERT( s.check_authority(&auth), tx_missing_other_auth, "Missing Authority", ("auth",auth)("sigs",sigs) );
   }

   // fetch all of the top level authorities
   for( auto id : required_active )
   {
      GRAPHENE_ASSERT( s.check_authority(id) || 
                       s.check_authority(get_owner(id)), 
                       tx_missing_active_auth, "Missing Active Authority ${id}", ("id",id)("auth",*get_active(id))("owner",*get_owner(id)) );
   }

   for( auto id : required_owner )
   {
      GRAPHENE_ASSERT( owner_approvals.find(id) != owner_approvals.end() ||
                       s.check_authority(get_owner(id)), 
                       tx_missing_owner_auth, "Missing Owner Authority ${id}", ("id",id)("auth",*get_owner(id)) );
   }

   GRAPHENE_ASSERT(
      !s.remove_unused_signatures(),
      tx_irrelevant_sig,
      "Unnecessary signature(s) detected"
      );
} FC_CAPTURE_AND_RETHROW( (ops)(sigs) ) }
开发者ID:8001800,项目名称:graphene,代码行数:52,代码来源:transaction.cpp


示例6: insert_or_remove_delta

void required_approval_index::insert_or_remove_delta( proposal_id_type p,
                                                      const flat_set<account_id_type>& before,
                                                      const flat_set<account_id_type>& after )
{
    auto b = before.begin();
    auto a = after.begin();
    while( b != before.end() || a != after.end() )
    {
       if( a == after.end() || (b != before.end() && *b < *a) )
       {
           remove( *b, p );
           ++b;
       }
       else if( b == before.end() || (a != after.end() && *a < *b) )
       {
           _account_to_proposals[*a].insert( p );
           ++a;
       }
       else // *a == *b
       {
           ++a;
           ++b;
       }
    }
}
开发者ID:dbarobin,项目名称:bitshares-core,代码行数:25,代码来源:proposal_object.cpp


示例7: database

void account_history_plugin_impl::update_account_histories( const signed_block& b )
{
   graphene::chain::database& db = database();
   const vector<operation_history_object>& hist = db.get_applied_operations();
   for( auto op : hist )
   {
      // add to the operation history index
      const auto& oho = db.create<operation_history_object>( [&]( operation_history_object& h ){
                                h = op;
                        });

      // get the set of accounts this operation applies to
      flat_set<account_id_type> impacted;
      vector<authority> other;
      operation_get_required_authorities( op.op, impacted, impacted, other );
      op.op.visit( operation_get_impacted_accounts( oho, _self, impacted ) );

      for( auto& a : other )
         for( auto& item : a.account_auths )
            impacted.insert( item.first );

      // for each operation this account applies to that is in the config link it into the history
      if( _tracked_accounts.size() == 0 )
      {
         for( auto& account_id : impacted )
         {
            // we don't do index_account_keys here anymore, because
            // that indexing now happens in observers' post_evaluate()

            // add history
            const auto& stats_obj = account_id(db).statistics(db);
            const auto& ath = db.create<account_transaction_history_object>( [&]( account_transaction_history_object& obj ){
                obj.operation_id = oho.id;
                obj.next = stats_obj.most_recent_op;
            });
            db.modify( stats_obj, [&]( account_statistics_object& obj ){
                obj.most_recent_op = ath.id;
            });
         }
      }
      else
      {
         for( auto account_id : _tracked_accounts )
         {
            if( impacted.find( account_id ) != impacted.end() )
            {
               // add history
               const auto& stats_obj = account_id(db).statistics(db);
               const auto& ath = db.create<account_transaction_history_object>( [&]( account_transaction_history_object& obj ){
                   obj.operation_id = oho.id;
                   obj.next = stats_obj.most_recent_op;
               });
               db.modify( stats_obj, [&]( account_statistics_object& obj ){
                   obj.most_recent_op = ath.id;
               });
            }
         }
      }
   }
}
开发者ID:clayop,项目名称:graphene,代码行数:60,代码来源:account_history_plugin.cpp


示例8:

    vector<asset> database_api::get_account_balances(account_id_type acnt, const flat_set<asset_id_type>& assets)const
    {
       vector<asset> result;
       if (assets.empty())
       {
          // if the caller passes in an empty list of assets, return balances for all assets the account owns
          const account_balance_index& balance_index = _db.get_index_type<account_balance_index>();
          auto range = balance_index.indices().get<by_account>().equal_range(acnt);
          for (const account_balance_object& balance : boost::make_iterator_range(range.first, range.second))
             result.push_back(asset(balance.get_balance()));
       }
       else
       {
          result.reserve(assets.size());

          std::transform(assets.begin(), assets.end(), std::back_inserter(result),
                         [this, acnt](asset_id_type id) { return _db.get_balance(acnt, id); });
       }

       return result;
    }
开发者ID:NaturalCoder,项目名称:graphene,代码行数:21,代码来源:api.cpp


示例9: get_required_active_authorities

 void  get_required_active_authorities( flat_set<string>& a )const{ a.insert(owner); }
开发者ID:abitmore,项目名称:steem,代码行数:1,代码来源:steem_operations.hpp


示例10: get_required_active_authorities

void proposal_update_operation::get_required_active_authorities( flat_set<account_id_type>& a )const
{
   for( const auto& i : active_approvals_to_add )    a.insert(i);
   for( const auto& i : active_approvals_to_remove ) a.insert(i);
}
开发者ID:hoseadevops,项目名称:bitshares-core,代码行数:5,代码来源:proposal.cpp


示例11: get_required_posting_authorities

 void get_required_posting_authorities( flat_set< account_name_type >& a )const
 {
    a.insert( required_posting.begin(), required_posting.end() );
 }
开发者ID:mejustandrew,项目名称:steem,代码行数:4,代码来源:database_api_args.hpp


示例12: get_impacted_accounts

 void get_impacted_accounts( flat_set<account_id_type>& i)const
 { i.insert( authorized_account ); }
开发者ID:clayop,项目名称:graphene,代码行数:2,代码来源:withdraw_permission.hpp


示例13: add_authority_accounts

 static void add_authority_accounts( flat_set<account_id_type>& i, const authority& a )
 {
    for( auto& item : a.account_auths )
       i.insert( item.first );
 }
开发者ID:clayop,项目名称:graphene,代码行数:5,代码来源:base.hpp


示例14: get_relevant_accounts

static void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accounts )
{
   if( obj->id.space() == protocol_ids )
   {
      switch( (object_type)obj->id.type() )
      {
        case null_object_type:
        case base_object_type:
        case OBJECT_TYPE_COUNT:
           return;
        case account_object_type:{
           accounts.insert( obj->id );
           break;
        } case asset_object_type:{
           const auto& aobj = dynamic_cast<const asset_object*>(obj);
           FC_ASSERT( aobj != nullptr );
           accounts.insert( aobj->issuer );
           break;
        } case force_settlement_object_type:{
           const auto& aobj = dynamic_cast<const force_settlement_object*>(obj);
           FC_ASSERT( aobj != nullptr );
           accounts.insert( aobj->owner );
           break;
        } case committee_member_object_type:{
           const auto& aobj = dynamic_cast<const committee_member_object*>(obj);
           FC_ASSERT( aobj != nullptr );
           accounts.insert( aobj->committee_member_account );
           break;
        } case witness_object_type:{
           const auto& aobj = dynamic_cast<const witness_object*>(obj);
           FC_ASSERT( aobj != nullptr );
           accounts.insert( aobj->witness_account );
           break;
        } case limit_order_object_type:{
           const auto& aobj = dynamic_cast<const limit_order_object*>(obj);
           FC_ASSERT( aobj != nullptr );
           accounts.insert( aobj->seller );
           break;
        } case call_order_object_type:{
           const auto& aobj = dynamic_cast<const call_order_object*>(obj);
           FC_ASSERT( aobj != nullptr );
           accounts.insert( aobj->borrower );
           break;
        } case custom_object_type:{
          break;
        } case proposal_object_type:{
           const auto& aobj = dynamic_cast<const proposal_object*>(obj);
           FC_ASSERT( aobj != nullptr );
           transaction_get_impacted_accounts( aobj->proposed_transaction, accounts );
           break;
        } case operation_history_object_type:{
           const auto& aobj = dynamic_cast<const operation_history_object*>(obj);
           FC_ASSERT( aobj != nullptr );
           operation_get_impacted_accounts( aobj->op, accounts );
           break;
        } case withdraw_permission_object_type:{
           const auto& aobj = dynamic_cast<const withdraw_permission_object*>(obj);
           FC_ASSERT( aobj != nullptr );
           accounts.insert( aobj->withdraw_from_account );
           accounts.insert( aobj->authorized_account );
           break;
        } case vesting_balance_object_type:{
           const auto& aobj = dynamic_cast<const vesting_balance_object*>(obj);
           FC_ASSERT( aobj != nullptr );
           accounts.insert( aobj->owner );
           break;
        } case worker_object_type:{
           const auto& aobj = dynamic_cast<const worker_object*>(obj);
           FC_ASSERT( aobj != nullptr );
           accounts.insert( aobj->worker_account );
           break;
        } case balance_object_type:{
           /** these are free from any accounts */
           break;
        }
      }
   }
   else if( obj->id.space() == implementation_ids )
   {
      switch( (impl_object_type)obj->id.type() )
      {
             case impl_global_property_object_type:
              break;
             case impl_dynamic_global_property_object_type:
              break;
             case impl_reserved0_object_type:
              break;
             case impl_asset_dynamic_data_type:
              break;
             case impl_asset_bitasset_data_type:
              break;
             case impl_account_balance_object_type:{
              const auto& aobj = dynamic_cast<const account_balance_object*>(obj);
              FC_ASSERT( aobj != nullptr );
              accounts.insert( aobj->owner );
              break;
           } case impl_account_statistics_object_type:{
              const auto& aobj = dynamic_cast<const account_statistics_object*>(obj);
              FC_ASSERT( aobj != nullptr );
              accounts.insert( aobj->owner );
//.........这里部分代码省略.........
开发者ID:hoseadevops,项目名称:bitshares-core,代码行数:101,代码来源:db_notify.cpp


示例15: get_required_posting_authorities

 void get_required_posting_authorities( flat_set<string>& a )const{ a.insert(voter); }
开发者ID:abitmore,项目名称:steem,代码行数:1,代码来源:steem_operations.hpp


示例16: get_impacted_accounts

 void get_impacted_accounts( flat_set<account_id_type>& i )const
 { i.insert(owner); }
开发者ID:clayop,项目名称:graphene,代码行数:2,代码来源:vesting.hpp


示例17: get_required_active_authorities

 void get_required_active_authorities( flat_set< account_name_type >& a )const
 {
    a.insert( required_active.begin(), required_active.end() );
 }
开发者ID:mejustandrew,项目名称:steem,代码行数:4,代码来源:database_api_args.hpp


示例18: get_required_active_authorities

 void get_required_active_authorities( flat_set<account_name_type>& a )const{ a.insert(account); }
开发者ID:Gandalf-the-Grey,项目名称:steem,代码行数:1,代码来源:steem_required_actions.hpp


示例19: get_required_owner_authorities

 void get_required_owner_authorities( flat_set<account_id_type>& a )const
 { if( owner ) a.insert( account ); }
开发者ID:elmato,项目名称:graphene,代码行数:2,代码来源:account.hpp


示例20: has_permission

 bool has_permission( account_name n )const {
    return _provided_auths.find(n) != _provided_auths.end();
 }
开发者ID:liuenci,项目名称:eos,代码行数:3,代码来源:authority_checker.hpp



注:本文中的flat_set类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ flex_date_time类代码示例发布时间:2022-05-31
下一篇:
C++ fixed类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap