当前位置: 首页>>代码示例>>C++>>正文


C++ enumerate函数代码示例

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


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


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