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

C++ enumerate函数代码示例

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

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



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

示例1: enumerate

static void
enumerate(pccluster t, uint tname, pclusteroperator co,
	  pclusteroperator * con)
{
  uint      tname1;
  uint      i;

  assert(co == 0 || co->t == t);

  con[tname] = co;

  tname1 = tname + 1;

  if (co == 0 || co->son == 0)
    for (i = 0; i < t->sons; i++) {
      enumerate(t->son[i], tname1, 0, con);

      tname1 += t->son[i]->desc;
    }
  else {
    assert(t->sons == co->sons);

    for (i = 0; i < t->sons; i++) {
      enumerate(t->son[i], tname1, co->son[i], con);

      tname1 += t->son[i]->desc;
    }
  }
  assert(tname1 == tname + t->desc);
}
开发者ID:H2Lib,项目名称:H2Lib,代码行数:30,代码来源:clusteroperator.c


示例2: enumerate

void enumerate(int energy, int number, int flag, int count)
{
    if(energy * flag == 0 )
    {
        return;
    }

    if(energy != flag && energy-flag <= flag)
    {
        array[count++] = flag;
        enumerate(energy-flag, number-1, energy-flag, count);
        count--;
        enumerate(energy, number, flag-1, count);
    }


    if(energy != flag && energy-flag > flag)
    {
        array[count++] = flag;
        enumerate(energy-flag, number-1, flag, count);
    }

    if(energy == flag)
    {
        array[count++] = flag;
        calcu(count, array);
        count--;
        enumerate(energy, number, flag-1, count);
    }

    return;
}
开发者ID:JackXu1993,项目名称:Finite_System_Statistical_Mechanics,代码行数:32,代码来源:new.c


示例3: initialize

void initialize(){

    //Mark Init
    enumerated = 0xABCDEF01;

    //Global variable init
    Pstack_state = PSTK_IDLE; 	//0x0;
    MBus_msg_flag = 0;
    cdc_data_index = 0;
//    snsv3_r0 = SNSv3_R0_DEFAULT;

    //Enumeration
    enumerate(RAD_ADDR);
    delay(100);
    enumerate(SNS_ADDR);
    delay(100);

    //CDC init--------------------------------------

    // SNSv3_R7
    snsv3_r7.CDC_LDO_CDC_LDO_ENB      = 0x1;
    snsv3_r7.CDC_LDO_CDC_LDO_DLY_ENB  = 0x1;
    snsv3_r7.ADC_LDO_ADC_LDO_ENB      = 0x1;
    snsv3_r7.ADC_LDO_ADC_LDO_DLY_ENB  = 0x1;

    // Set ADC LDO to around 1.37V: 0x3//0x20
    snsv3_r7.ADC_LDO_ADC_VREF_MUX_SEL = 0x3;
    snsv3_r7.ADC_LDO_ADC_VREF_SEL     = 0x20;

    // Set CDC LDO to around 1.03V: 0x0//0x20
    snsv3_r7.CDC_LDO_CDC_VREF_MUX_SEL = 0x0;
    snsv3_r7.CDC_LDO_CDC_VREF_SEL     = 0x20;

    snsv3_r7.LC_CLK_CONF              = 0x9; // default = 0x9
    write_mbus_register(SNS_ADDR,7,snsv3_r7.as_int);

    // SNSv3_R1
    snsv3_r1.CDC_S_period = 0x1A;
    snsv3_r1.CDC_R_period = 0xC;
    snsv3_r1.CDC_CR_ext = 0x0;
    write_mbus_register(SNS_ADDR,1,snsv3_r1.as_int);


    // SNSv3_R0 (need to be initialized here)
    snsv3_r0.CDC_ext_select_CR = 0x0;
    snsv3_r0.CDC_max_select = 0x7;
    snsv3_r0.CDC_ext_max = 0x0;
    snsv3_r0.CDC_CR_fixB = 0x1;
    snsv3_r0.CDC_ext_clk = 0x0;
    snsv3_r0.CDC_outck_in = 0x1;
    snsv3_r0.CDC_on_adap = 0x1;		//0x0 (default 0x1)
    snsv3_r0.CDC_s_recycle = 0x1;	//0x1 (default 0x4)
    snsv3_r0.CDC_Td = 0x0;
    snsv3_r0.CDC_OP_on = 0x0;
    snsv3_r0.CDC_Bias_2nd = 0x7;
    snsv3_r0.CDC_Bias_1st = 0x7;
    snsv3_r0.CDC_EXT_RESET = 0x1;
    snsv3_r0.CDC_CLK = 0x0;
    write_mbus_register(SNS_ADDR,0,snsv3_r0.as_int);
}
开发者ID:hoangt,项目名称:M-ulator,代码行数:60,代码来源:SNSv3_test_v2.c


示例4: enumerate

int enumerate(int x)
{
	if(x <= 0)
		return 1;
	else
		return enumerate(x-1) + enumerate(x-2);

}
开发者ID:slyj91,项目名称:CS1010,代码行数:8,代码来源:food-plan.c


示例5: operation_init

static void operation_init(void){
	volatile uint32_t temp_addr;
	volatile uint32_t temp_data;
	volatile uint32_t temp_numBit;
  
    // Set PMU Strength & division threshold
    // PMU_CTRL Register
    // PRCv9 Default: 0x8F770049
    // Decrease 5x division switching threshold
	set_pmu_sleep_clk_default();
  
    // Speed up GOC frontend to match PMU frequency
	// Speed up MBUS
	// GOC_CTRL Register
    // PRCv9 Default: 0x00202903
	//*((volatile uint32_t *) 0xA2000008) = 0x00202608;
  
	// For PREv9E GPIO Isolation disable >> bits 16, 17, 24
	*((volatile uint32_t *) 0xA2000008) = 0x0120E508;


    delay(DELAY_1);
  
    //Enumerate & Initialize Registers
    enumerated = 0xDEADBEEF;
    exec_count = 0;
    exec_count_irq = 0;
    MBus_msg_flag = 0;
    //Enumeration
    enumerate(MD_ADDR);
    delay(MBUS_DELAY*2);
    enumerate(RAD_ADDR);
    delay(MBUS_DELAY*2);
    enumerate(HRV_ADDR);
    delay(MBUS_DELAY*2);

	// Set HRVv2 optimal settings for GaAs solar cell
	hrvv2_r0.HRV_TOP_CONV_RATIO = 0;
    write_mbus_register(HRV_ADDR,0x0,hrvv2_r0.as_int);
	

    // Initialize other global variables
    WAKEUP_PERIOD_CONT = 100;   // 1: 2-4 sec with PRCv9
    WAKEUP_PERIOD_CONT_INIT = 1;   // 0x1E (30): ~1 min with PRCv9
    radio_tx_count = 0;
    radio_tx_option = 0;
    
	md_start_motion = 0;
	md_capture_img = 0;
	md_count = 0;

	INT_TIME = 5;
	MD_INT_TIME = 15;

    // Go to sleep without timer
    //operation_sleep_notimer();
}
开发者ID:johnMamish,项目名称:M-ulator,代码行数:57,代码来源:MOD_motion_hrv_setup.c


示例6: _bproc_test_run

int _bproc_test_run(struct bproc_test_t *t, int nproc) {
    int arr, error;

    arr = enumerate(nproc, t->flags, -1);
    while (arr != -1) {
	error = __bproc_test_run(t, nproc, arr);
	if (error) return 1;
	arr = enumerate(nproc, t->flags, arr);
    }
    return 0;
}
开发者ID:dwrudis,项目名称:clustermatic,代码行数:11,代码来源:bproc_test.c


示例7: main

int main (int argc, char const * argv [])

{
	static char const * optv [] =
	{
		"",
		PUTOPTV_S_DIVINE,
		"Atheros Ethernet Interface Enumerator",
		(char const *) (0)
	};
	signed c;
	while ((c = getoptv (argc, argv, optv)) != -1)
	{
		switch (c)
		{
		default:
			break;
		}
	}
	argc -= optind;
	argv += optind;
	if (argc)
	{
		error (1, ECANCELED, ERROR_TOOMANY);
	}
	enumerate ();
	return (0);
}
开发者ID:LucaBongiorni,项目名称:open-plc-utils,代码行数:28,代码来源:nics.c


示例8: clear

void QuickSaves::delete_surplus_saves(size_t max_saves)
{
    if (max_saves < 1)
        return;     // unlimited saves, no need to prune
    clear();
    
    // Check the directory to count the saves. If there
    // are fewer than the max, no need to go further.
    vector<dir_entry> entries;
    DirectorySpecifier path;
    path.SetToQuickSavesDir();
    if (path.ReadDirectory(entries)) {
        if (entries.size() <= max_saves)
            return;
    }
    
    // We might have too many unnamed saves; load and
    // count them, deleting any extras.
    enumerate();
    size_t unnamed_saves = 0;
    for (std::vector<QuickSave>::iterator it = begin(); it != end(); ++it) {
        if (it->name.length())
            continue;
        if (++unnamed_saves > max_saves)
            delete_quick_save(*it);
    }
    clear();
}
开发者ID:pfhore-github,项目名称:alephone_jp,代码行数:28,代码来源:QuickSave.cpp


示例9: get_elements

 KFR_INTRINSIC friend vec<T, N> get_elements(const expression_rectangular& self, cinput_t,
                                                 size_t index, vec_shape<T, N>)
 {
     using TI           = utype<T>;
     const vec<TI, N> i = enumerate(vec_shape<TI, N>()) + static_cast<TI>(index);
     return select(i < static_cast<TI>(self.m_size), T(1), T(0));
 }
开发者ID:kfrlib,项目名称:kfr,代码行数:7,代码来源:window.hpp


示例10: enumerate

static void enumerate (table_data * data, json_value * value)
{
	int index;
	for (index = 0; index < value->u.object.length; index++) {
		switch (value->u.object.values[index].value->type) 
		{
		case json_object:
			enumerate(data, value->u.object.values[index].value);
			break;
		case json_string:
                add_data_column(data,value->u.object.values[index].name,value->u.object.values[index].value->u.string.ptr, datatype_text);
//			puts(value->u.object.values[index].value->u.string.ptr);
			break;
            case json_integer:
                add_data_column(data,value->u.object.values[index].name,&(value->u.object.values[index].value->u.integer), datatype_integer);
//			printf("%d\n",(value->u.object.values[index].value->u.integer));
			break;
            case json_double:
                add_data_column(data,value->u.object.values[index].name,&(value->u.object.values[index].value->u.dbl), datatype_real);
//			printf("%f\n",value->u.object.values[index].value->u.dbl);
			break; 
            case json_boolean:
                add_data_column(data,value->u.object.values[index].name,&(value->u.object.values[index].value->u.boolean), datatype_boolean);
//			printf("%d\n",value->u.object.values[index].value->u.boolean);
			break;
            case json_null:
                add_data_column(data,value->u.object.values[index].name,0, datatype_null);
                break;

		default:
			break;
		}
	}
}
开发者ID:leogdion,项目名称:weatherman,代码行数:34,代码来源:main.c


示例11: impl

 static I impl(I begin, S end, C pred, P proj, detail::forward_iterator_tag_ fi)
 {
     using difference_type = iter_difference_t<I>;
     difference_type const alloc_limit = 3; // might want to make this a function
                                            // of trivial assignment.
     // Either prove all true and return begin or point to first false
     while(true)
     {
         if(begin == end)
             return begin;
         if(!invoke(pred, invoke(proj, *begin)))
             break;
         ++begin;
     }
     // We now have a reduced range [begin, end)
     // *begin is known to be false
     using value_type = iter_value_t<I>;
     auto len_end = enumerate(begin, end);
     auto p = len_end.first >= alloc_limit
                  ? detail::get_temporary_buffer<value_type>(len_end.first)
                  : detail::value_init{};
     std::unique_ptr<value_type, detail::return_temporary_buffer> const h{p.first};
     return stable_partition_fn::impl(
         begin, len_end.second, pred, proj, len_end.first, p, fi);
 }
开发者ID:ericniebler,项目名称:range-v3,代码行数:25,代码来源:stable_partition.hpp


示例12: create_find_autogenerate_sql

    inline std::string create_find_autogenerate_sql(Entity & x)
    {
        // filter out non-autogenerate columns
        typedef typename
            boost::mpl::remove_if<
                typename result_of::columns_of<Entity>::type,
                boost::mpl::not_<
                    is_autogenerate<boost::mpl::_1>
                >
            >::type
        filtered_columns;

        std::stringstream ss;
        ss << "SELECT ";
        enumerate(filtered_columns(), detail::output_table_column_ref<Connection>(), ss, ',');
        ss << " FROM ";
        output_table_name<Connection>(ss, table_name_of<Entity>());
        ss << " t0";
        for_each(columns_of<Entity>(), detail::output_join<Connection>(), ss);
        ss << " WHERE t0.";
        output_column_name<Connection>(ss, primary_key_column_of<Entity>());
        ss << '=';
        last_insert_id_hook<Connection>()(ss);
        ss << ';';
        return ss.str();
    }
开发者ID:diosmosis,项目名称:cryo,代码行数:26,代码来源:create_find_sql.hpp


示例13: case_

            void case_(std::stringstream & ss, C const& col, boost::mpl::int_<1>) const
            {
                typedef typename foreign_entity_type_of<C>::type foreign_entity_type;

                join_index = dynamic::detail::join_idx_of(col);
                enumerate(columns_of<foreign_entity_type>(), *this, ss, ',');
            }
开发者ID:diosmosis,项目名称:cryo,代码行数:7,代码来源:create_find_sql.hpp


示例14: operation_init

static void operation_init(void){
  
    // Set PMU Strength & division threshold
    // Change PMU_CTRL Register
    // PRCv9 Default: 0x8F770049
    // Decrease 5x division switching threshold
    *((volatile uint32_t *) 0xA200000C) = 0x8F77004B;
  
    // Speed up GOC frontend to match PMU frequency
    // PRCv9 Default: 0x00202903
    *((volatile uint32_t *) 0xA2000008) = 0x00202508;
  
    delay(100);
  
    //Enumerate & Initialize Registers
    enumerated = 0xDEADBEEF;
    MBus_msg_flag = 0;
    //Enumeration
    enumerate(MRR_ADDR);
    delay(MBUS_DELAY*10);

    // Initialize other global variables
    WAKEUP_PERIOD_CONT = 3;   // 1: 2-4 sec with PRCv9
    WAKEUP_PERIOD_CONT_INIT = 1;   // 0x1E (30): ~1 min with PRCv9
    
}
开发者ID:lab11,项目名称:M-ulator,代码行数:26,代码来源:MRRv2_TX_pulse.c


示例15: main

int main() {
	char line[64];
	size_t size = 64;
	int t, x, i;
	sp S = NULL;

	// GETLINE FROM STDIN AND PUSH INTO STACK
	if (fgets(line, size, stdin) == NULL) {
		printf("ERROR WITH THE INPUT LINE!\n");
		abort();
    } else {
        // STORE THE CHARACTER IN THE LINE (AS INT)
    	t = 0;
    	while(line[t] != '\n') t++;

    	for (i = t-1; i >= 0; i--) {
    		x = line[i] - '0';
    		S = push(x, S);
    		printf("counting: %d, x is: %c\n", i, x+'0');
    	}
    }

    // CALCULATE THE POSTFIX
    enumerate(S);
    return 0;
}
开发者ID:KHN190,项目名称:cisb212,代码行数:26,代码来源:stack.c


示例16: enumerate

winstd::heap::~heap()
{
    if (m_h != invalid) {
        enumerate();
        HeapDestroy(m_h);
    }
}
开发者ID:Amebis,项目名称:WinStd,代码行数:7,代码来源:Win.cpp


示例17: main

int main( int argc, char **argv )
{
    if( argc != 2 )
        return std::cerr << "Usage: " << argv[0] << " file.ogg" << std::endl, -1;

    // enumerate audio devices
    for( auto &it : enumerate() )
        std::cout << "Audio device: " << it << std::endl;

    // create as many audio contexts as you want
    context_t sfx, music, voice, ambient, video, ui;

    // sfx uses device #0
    if( !sfx.init(0) )
        return std::cerr << "Cant open audio device." << std::endl, -1;

    // print device name
    std::cout << "Using audio device: " << sfx.devname << std::endl;

    // @todo: purge @playonce
    int source = sfx.playonce( argv[1] );

    // wait for source to finish
    if( source >= 0 )
    while( sfx.sources[ source ].is_playing() )
    {}

    return 0;
}
开发者ID:shammellee,项目名称:moon9,代码行数:29,代码来源:device.sample.cpp


示例18: lock

void AbstractConfiguration::keys(const std::string& key, Keys& range) const
{
	Mutex::ScopedLock lock(_mutex);

	range.clear();
	enumerate(key, range);
}
开发者ID:Fangang,项目名称:poco,代码行数:7,代码来源:AbstractConfiguration.cpp


示例19: create_find_sql

    inline std::string create_find_sql(PrimaryKey const& key, Columns const& cols)
    {
        extension::concrete_hooks<Connection> hooks;

        // calculate join indices
        join_index_set indices;
        calc_join_indices(cols, indices);

        std::stringstream ss;
        ss << "SELECT ";
        enumerate(cols, detail::output_select_expr<Connection>(indices.size()), ss, ',');
        ss << " FROM ";
        output_table_name<Connection>(ss, table_name_of<Entity>());
        ss << " t0";

        // output joins
        for (join_index_set::const_iterator i = indices.begin(); i != indices.end(); ++i)
        {
            i->output_join(ss, hooks);
        }

        // output extra joins
        for_each(cols, detail::output_extra_joins<Connection>(indices.size()), ss);

        ss << " WHERE t0.";
        output_column_name<Connection>(ss, primary_key_column_of<Entity>());
        ss << '=';
        output_column_value<Connection>(ss, key);

        // output group by (if any are any group bys)
        detail::output_group_by<Connection>(ss, cols);

        ss << ';';
        return ss.str();
    }
开发者ID:diosmosis,项目名称:cryo,代码行数:35,代码来源:create_find_sql.hpp


示例20: enumerate

// 2005-06-28  CDC  Not ideal, but this lets you extract data from a text string
bool FUNCSTRINGPARSE::execute(void)
{
	bool result= false;
	VMREGTYPE pFormat = 0;
	const char* format = "null";
	VMREGTYPE pstr = 0;
	const char* str= "null";
	int resultmax = 0;
	bool eolmode = false;

	if ( machine.pop(pFormat) && ( ( format=machine.GetString((VPVOID)pFormat) ) !=0 ) )
	{
		// Count how many results there should be based on the format string
		enumerate(format, resultmax, eolmode);
		resultmax++;		// There's always a status value
		VMREGTYPE* resultset=new VMREGTYPE[resultmax];	// Store results so we can push them on in reverse
		resultset[0] = 0;
		if ( machine.pop(pstr) && (str=(char*)machine.GetString((VPVOID)pstr)) )
			secernate(format, str, resultset, resultmax);
		while ( resultmax-- )
			result= machine.push((VMREGTYPE)resultset[resultmax]);
        delete[] resultset;
	}
#ifdef DEBUGGING
	//cLog::mLogMessage("FUNCSTRINGPARSE(%d,%s,%s) %s\n",resultset[0],format,str,result?"succeeded":"failed");
#endif
	return result;
}
开发者ID:Merzasphor,项目名称:MWSE,代码行数:29,代码来源:FUNCTEXT.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ enumerate_ht_chain函数代码示例发布时间:2022-05-30
下一篇:
C++ enum_name函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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