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

C++ defined函数代码示例

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

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



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

示例1: defined

void blur_channels_node_t::blur_channel( int ch, const Imath::Box2i& area, const boost::gil::gray32f_view_t& tmp,
										 const Imath::V2f& radius, int iters, blur_border_mode border)
{
    if( border != border_black)
    {
        int hradius = std::ceil( radius.x);
        int vradius = std::ceil( radius.y);

        int border_x0 = std::min( area.min.x - defined().min.x, hradius);
        int border_y0 = std::min( area.min.y - defined().min.y, vradius);
        int border_x1 = std::min( defined().max.x - area.max.x, hradius);
        int border_y1 = std::min( defined().max.y - area.max.y, vradius);

        Imath::Box2i box( area);
        box.min.x -= border_x0; box.min.y -= border_y0;
        box.max.x += border_x1; box.max.y += border_y1;

        if( border == border_repeat)
          boost::gil::repeat_border_pixels( boost::gil::nth_channel_view( subimage_view( box), ch), border_x0, border_y0, border_x1, border_y1);
        else
          boost::gil::reflect_border_pixels( boost::gil::nth_channel_view( subimage_view( box), ch), border_x0, border_y0, border_x1, border_y1);
    }

    image::box_blur_channel( boost::gil::nth_channel_view( const_image_view(), ch), tmp,
							 boost::gil::nth_channel_view( image_view(), ch),
							 radius.x, radius.y, iters);
}
开发者ID:devernay,项目名称:ramen-1,代码行数:27,代码来源:blur_channels_node.cpp


示例2: process_attribute

/*
 * process_attribute: skip attributes in __attribute__((...)).
 *
 *	r)	target type
 */
static void
process_attribute(int target)
{
	int brace = 0;
	int c;
	/*
	 * Skip '...' in __attribute__((...))
	 * but pick up symbols in it.
	 */
	while ((c = nexttoken("()", cpp_reserved_word)) != EOF) {
		if (c == '(')
			brace++;
		else if (c == ')')
			brace--;
		else if (c == SYMBOL) {
			if (target == REF) {
				if (defined(token))
					PUT(token, lineno, sp);
			} else if (target == SYM) {
				if (!defined(token))
					PUT(token, lineno, sp);
			}
		}
		if (brace == 0)
			break;
	}
}
开发者ID:cage433,项目名称:global_with_scala,代码行数:32,代码来源:Cpp.c


示例3: condition_macro

/*
 * condition_macro: 
 *
 *	i)	cc	token
 *	i)	target	current target
 */
static void
condition_macro(int cc, int target)
{
	cur = &pifstack[piflevel];
	if (cc == SHARP_IFDEF || cc == SHARP_IFNDEF || cc == SHARP_IF) {
		DBG_PRINT(piflevel, "#if");
		if (++piflevel >= MAXPIFSTACK)
			die("#if pifstack over flow. [%s]", curfile);
		++cur;
		cur->start = level;
		cur->end = -1;
		cur->if0only = 0;
		if (peekc(0) == '0')
			cur->if0only = 1;
		else if ((cc = nexttoken(NULL, cpp_reserved_word)) == SYMBOL && !strcmp(token, "notdef"))
			cur->if0only = 1;
		else
			pushbacktoken();
	} else if (cc == SHARP_ELIF || cc == SHARP_ELSE) {
		DBG_PRINT(piflevel - 1, "#else");
		if (cur->end == -1)
			cur->end = level;
		else if (cur->end != level && wflag)
			warning("uneven level. [+%d %s]", lineno, curfile);
		level = cur->start;
		cur->if0only = 0;
	} else if (cc == SHARP_ENDIF) {
		int minus = 0;

		--piflevel;
		if (piflevel < 0) {
			minus = 1;
			piflevel = 0;
		}
		DBG_PRINT(piflevel, "#endif");
		if (minus) {
			if (wflag)
				warning("#if block unmatched. reseted. [+%d %s]", lineno, curfile);
		} else {
			if (cur->if0only)
				level = cur->start;
			else if (cur->end != -1) {
				if (cur->end != level && wflag)
					warning("uneven level. [+%d %s]", lineno, curfile);
				level = cur->end;
			}
		}
	}
	while ((cc = nexttoken(NULL, cpp_reserved_word)) != EOF && cc != '\n') {
                if (cc == SYMBOL && strcmp(token, "defined") != 0) {
			if (target == REF) {
				if (defined(token))
		                        PUT(token, lineno, sp);
			} else if (target == SYM) {
				if (!defined(token))
		                	PUT(token, lineno, sp);
			}
		}
	}
}
开发者ID:cage433,项目名称:global_with_scala,代码行数:66,代码来源:Cpp.c


示例4: POMAGMA_INFO

void SymmetricFunction::validate() const {
    POMAGMA_INFO("Validating SymmetricFunction");

    m_lines.validate();

    POMAGMA_DEBUG("validating line-value consistency");
    for (size_t i = 1; i <= item_dim(); ++i)
        for (size_t j = i; j <= item_dim(); ++j) {
            auto val_iter = m_values.find(assert_sorted_pair(i, j));

            if (not(support().contains(i) and support().contains(j))) {
                POMAGMA_ASSERT(val_iter == m_values.end(),
                               "found unsupported lhs, rhs: " << i << ',' << j);
            } else if (val_iter != m_values.end()) {
                POMAGMA_ASSERT(defined(i, j),
                               "found undefined value: " << i << ',' << j);
                Ob val = val_iter->second;
                POMAGMA_ASSERT(val, "found zero value: " << i << ',' << j);
                POMAGMA_ASSERT(support().contains(val),
                               "found unsupported value: " << i << ',' << j);
            } else {
                POMAGMA_ASSERT(not defined(i, j),
                               "found defined null value: " << i << ',' << j);
            }
        }
}
开发者ID:fritzo,项目名称:pomagma,代码行数:26,代码来源:symmetric_function.cpp


示例5: param

void keyer3d_node_t::do_process( const render::context_t& context)
{
	image_node_t *in0 = input_as<image_node_t>( 0);
	
	float gtol = get_value<float>( param( "gtol"));
	float gsoft = get_value<float>( param( "gsoft"));
	
	keyer().set_tol_soft_factors( gtol, gsoft);
	
    if( !input(1))
    {
		Imath::Box2i area( Imath::intersect( defined(), in0->defined()));

		if( area.isEmpty())
		    return;

		boost::gil::tbb_transform_pixels(  in0->const_subimage_view( area),
											subimage_view( area), key3d_fun( keyer()));
    }
    else
    {
		image_node_t *in1 = input_as<image_node_t>( 1);
		
		Imath::Box2i area( Imath::intersect( Imath::intersect( defined(), in0->defined()), in1->defined()));

		if( area.isEmpty())
		    return;

		boost::gil::tbb_transform2_pixels(  in0->const_subimage_view( area),
											in1->const_subimage_view( area),
											subimage_view( area), key3d_fun( keyer()));
    }
}
开发者ID:JohanAberg,项目名称:Ramen,代码行数:33,代码来源:keyer3d_node.cpp


示例6: calc_transform_matrix

void flip_node_t::do_process( const render::context_t& context)
{
    if( defined().isEmpty())
        return;

    calc_transform_matrix();
    image::affine_warp_nearest( input_as<image_node_t>()->defined(), input_as<image_node_t>()->const_image_view(),
                                defined(), image_view(), xform_, inv_xform_);
}
开发者ID:devernay,项目名称:ramen-1,代码行数:9,代码来源:flip_node.cpp


示例7: area

void blur_node_t::do_process( const render::render_context_t& context)
{
    Imath::Box2i area( intersect( input()->defined(), defined()));

    if( area.isEmpty())
	return;

    boost::gil::copy_pixels( input()->const_subimage_view( area), subimage_view( area));

    int bmode = get_value<int>( param( "border"));

    if( bmode != border_black)
    {
        int border_x0 = area.min.x - defined().min.x;
        int border_y0 = area.min.y - defined().min.y;

        int border_x1 = defined().max.x - area.max.x;
        int border_y1 = defined().max.y - area.max.y;

        if( bmode == border_repeat)
            boost::gil::repeat_border_pixels( image_view(), border_x0, border_y0, border_x1, border_y1);
        else
            boost::gil::reflect_border_pixels( image_view(), border_x0, border_y0, border_x1, border_y1);
    }

    int channels = get_value<int>( param( "channels"));
    Imath::V2f radius = get_value<Imath::V2f>( param( "radius"));
    int iters = get_value<int>( param( "iters"));

    radius.x  /= context.subsample;
    radius.y /= context.subsample;

    switch( channels)
    {
    case channels_rgba:
	image::box_blur_rgba( const_image_view(), image_view(), radius.x, radius.y, iters);
    break;

    case channels_rgb:
    {
	image::box_blur_rgba( const_image_view(), image_view(), radius.x, radius.y, iters);
        boost::gil::fill_pixels( boost::gil::nth_channel_view( image_view(), 3), boost::gil::gray32f_pixel_t( 0));
	boost::gil::copy_pixels( boost::gil::nth_channel_view( input()->const_subimage_view( area), 3),
				boost::gil::nth_channel_view( subimage_view( area), 3));
    }
    break;

    case channels_alpha:
    {
	image::box_blur_channel( boost::gil::nth_channel_view( const_image_view(), 3),
				boost::gil::nth_channel_view( image_view(), 3),
				radius.x, radius.y, iters);
    }
    break;
    }
}
开发者ID:apextw,项目名称:Ramen,代码行数:56,代码来源:blur_node.cpp


示例8: exfill

static void 
exfill(void (*fill) (PLINT, PLFLT *, PLFLT *),
       PLINT (*defined) (PLFLT, PLFLT),
       int n, PLFLT *x, PLFLT *y)
{
    if (defined == NULL)

        (*fill) (n, x, y);

    else {
        PLFLT xx[16];  
	PLFLT yy[16];
	PLFLT xb, yb;  
	PLINT count = 0;
	PLINT is_inside = defined (x[n-1], y[n-1]);
	PLINT i;

        for (i = 0; i < n; i++) {

	    if (defined(x[i], y[i])) {
	        if (!is_inside) {
		    if (i > 0)
		        bisect (defined, 10,
				x[i], y[i], x[i-1], y[i-1], &xb, &yb);
		    else
		        bisect (defined, 10,
				x[i], y[i], x[n-1], y[n-1], &xb, &yb);
		    xx[count] = xb;
		    yy[count++] = yb;
		}
		xx[count] = x[i];
		yy[count++] = y[i];
		is_inside = 1;
	    }
	    else {
	        if (is_inside) {
		    if (i > 0)
		        bisect (defined, 10,
				x[i-1], y[i-1], x[i], y[i], &xb, &yb);
		    else
		        bisect (defined, 10,
				x[n-1], y[n-1], x[i], y[i], &xb, &yb);
		    xx[count] = xb;
		    yy[count++] = yb;
		    is_inside = 0;
		}
	    }
	}
	
	if (count)
  	    (*fill) (count, xx, yy);
    }
}
开发者ID:NikolaBorisov,项目名称:racket,代码行数:53,代码来源:plshade.c


示例9: timer_init

/*
 * Initializes the timer, and resets the timer count to 0.  Sets up the ISRs 
 * linked with timer0.
 */
void timer_init(){
	//Set up the timer to run at F_CPU / 256, in normal mode (we reset TCNT0 in the ISR)
	TCCR0A = 0x0;
	TCCR0B |= _BV(CS02);
	
	//Every _timer_micro_divisor clock ticks is one microsecond.
	_timer_micro_divisor = F_CPU / 1000000; 
	
	//Set compare value to be F_CPU / 1000 -- fire interrupt every millisecond
	OCR0A = F_CPU / 256 / 1000;
	
	//Enable compare interrupt
#if defined(__AVR_ATtiny13__)   || \
	defined(__AVR_ATtiny24__)   || \
	defined(__AVR_ATtiny44__)   || \
	defined(__AVR_ATtiny84__)   || \
	defined(__AVR_ATtiny25__)   || \
	defined(__AVR_ATtiny45__)   || \
	defined(__AVR_ATtiny85__)

	TIMSK = _BV(OCIE0A);
	
#elif defined(__AVR_ATmega48__)   || \
    defined(__AVR_ATmega48P__)    || \
	defined(__AVR_ATmega168__)   || \
	defined(__AVR_ATmega328__)     || \
	defined(__AVR_ATmega328P__)    || \
	defined(__AVR_ATmega324P__)    || \
	defined(__AVR_ATmega644__)     || \
	defined(__AVR_ATmega644P__)    || \
	defined(__AVR_ATmega644PA__)   || \
	defined(__AVR_ATmega1284P__)
	defined(__AVR_ATmega32U2__)    || \
	defined(__AVR_ATmega16U4__)    || \
	defined(__AVR_ATmega32U4__)
	
	TIMSK0 = _BV(OCIE0A);
	
#endif
	

	//Reset count variables
	_timer_millis = 0;
	
	//Enable interrupts if the NO_INTERRUPT_ENABLE define is not set.  If it is, you need to call sei() elsewhere.
#ifndef NO_INTERRUPT_ENABLE
	sei();
#endif
}
开发者ID:TAGood827,项目名称:microcontroller-projects,代码行数:53,代码来源:timer_0.c


示例10: user_assert

void Buffer::set_min(int m0, int m1, int m2, int m3) {
    user_assert(defined()) << "Buffer is undefined\n";
    contents.ptr->buf.min[0] = m0;
    contents.ptr->buf.min[1] = m1;
    contents.ptr->buf.min[2] = m2;
    contents.ptr->buf.min[3] = m3;
}
开发者ID:DoDNet,项目名称:Halide,代码行数:7,代码来源:Buffer.cpp


示例11: image_view

void colorx_node_t::do_process( const render::context_t& context)
{
	if( !expr_.get() || !expr_->isValid())
	{
		image::make_color_bars( image_view());
		return;
	}
	
    Imath::Box2i area( Imath::intersect( input_as<image_node_t>()->defined(), defined()));

    if( area.isEmpty())
		return;
	
	if( expr_->isThreadSafe()) // multi-threaded
	{
		tbb::parallel_for( tbb::blocked_range<int>( 0, area.size().y + 1),
						   boost::bind( &colorx_node_t::do_expression, this, _1, area, boost::cref( context)), 
						   tbb::auto_partitioner());
	}
	else
	{
		tbb::blocked_range<int> range( 0, area.size().y + 1);
		do_expression( range, area, context);
	}
}
开发者ID:JohanAberg,项目名称:Ramen,代码行数:25,代码来源:colorx_node.cpp


示例12: assert

void
MaskedIcon::load_big(unsigned id, unsigned big_id, bool center)
{
  if (Layout::ScaleEnabled()) {
    if (big_id > 0)
      bitmap.load(big_id);
    else
      bitmap.load_stretch(id, Layout::FastScale(1));
  } else
    bitmap.load(id);

  assert(defined());

  size = bitmap.get_size();
  /* left half is mask, right half is icon */
  size.cx /= 2;

  if (center) {
    origin.x = size.cx / 2;
    origin.y = size.cy / 2;
  } else {
    origin.x = 0;
    origin.y = 0;
  }
}
开发者ID:galippi,项目名称:xcsoar,代码行数:25,代码来源:Icon.cpp


示例13: print

 virtual void print()
 {
   if (defined())
     cout << name << ":" << values[ value() -1] << '\n';
   else
     cout << name << ":Undefined\n";
 };
开发者ID:patrickschultz,项目名称:Eddy_Murphi_Original,代码行数:7,代码来源:abp.C


示例14: internal_assert

bool LoopLevel::match(const LoopLevel &other) const {
    internal_assert(defined());
    return (contents->func_name == other.contents->func_name &&
            (contents->var_name == other.contents->var_name ||
             Internal::ends_with(contents->var_name, "." + other.contents->var_name) ||
             Internal::ends_with(other.contents->var_name, "." + contents->var_name)));
}
开发者ID:kgnk,项目名称:Halide,代码行数:7,代码来源:Schedule.cpp


示例15: gen_conf

static void
gen_conf(Entry * head, FILE * fp, int verbose_output)
{
    Entry *entry;
    char buf[8192];
    Line *def = NULL;

    for (entry = head; entry != NULL; entry = entry->next) {
	Line *line;

	if (!strcmp(entry->name, "comment"))
	    (void) 0;
	else if (verbose_output) {
	    fprintf(fp, "#  TAG: %s", entry->name);
	    if (entry->comment)
		fprintf(fp, "\t%s\n", entry->comment);
	    else
		fprintf(fp, "\n");
	}
	if (verbose_output) {
	    if (!defined(entry->ifdef)) {
		fprintf(fp, "# Note: This option is only available if Squid is rebuilt with the\n");
		fprintf(fp, "#       %s option\n#\n", available_if(entry->ifdef));
	    }
	    for (line = entry->doc; line != NULL; line = line->next) {
		fprintf(fp, "#%s\n", line->data);
	    }
	}
	if (entry->default_value && strcmp(entry->default_value, "none") != 0) {
	    snprintf(buf, sizeof(buf), "%s %s", entry->name, entry->default_value);
	    lineAdd(&def, buf);
	}
	if (entry->default_if_none) {
	    for (line = entry->default_if_none; line; line = line->next) {
		snprintf(buf, sizeof(buf), "%s %s", entry->name, line->data);
		lineAdd(&def, buf);
	    }
	}
	if (!def && entry->doc && strcmp(entry->name, "comment") != 0)
	    lineAdd(&def, "none");
	if (verbose_output && def && (entry->doc || entry->nocomment)) {
	    fprintf(fp, "#\n#Default:\n");
	    while (def != NULL) {
		line = def;
		def = line->next;
		fprintf(fp, "# %s\n", line->data);
		xfree(line->data);
		xfree(line);
	    }
	}
	if (verbose_output && entry->nocomment)
	    fprintf(fp, "#\n");
	for (line = entry->nocomment; line != NULL; line = line->next) {
	    fprintf(fp, "%s\n", line->data);
	}
	if (verbose_output && entry->doc != NULL) {
	    fprintf(fp, "\n");
	}
    }
}
开发者ID:cristdai,项目名称:squid2,代码行数:60,代码来源:cf_gen.c


示例16: intersect

void exposure_node_t::do_process( const image::const_image_view_t& src, const image::image_view_t& dst, const render::render_context_t& context)
{
    image::const_image_view_t src_view;
    image::image_view_t dst_view;
    Imath::Box2i area;

    if( input(1))
    {
	boost::gil::copy_pixels( src, dst);
	area = intersect( input(1)->defined(), defined());

	if( area.isEmpty())
	    return;

	src_view = input(0)->const_subimage_view( area);
	dst_view = subimage_view( area);
    }
    else
    {
	src_view = src;
	dst_view = dst;
    }

    boost::gil::tbb_transform_pixels( src_view, dst_view, exposure_fun( get_value<float>( param( "exp"))));

    if( input(1))
        image::key_mix( src_view, dst_view, boost::gil::nth_channel_view( input(1)->const_subimage_view( area), 3), dst_view);
}
开发者ID:apextw,项目名称:Ramen,代码行数:28,代码来源:exposure_node.cpp


示例17: area

void smart_blur_node_t::do_process( const render::context_t& context)
{
    Imath::Box2i area( ImathExt::intersect( input_as<image_node_t>()->defined(), defined()));

    if( area.isEmpty())
        return;

    Imath::V2f stddev = get_value<Imath::V2f>( param( "stddev"));
	stddev = adjust_blur_size( stddev, context.subsample);
	
	copy_src_image( 0, area, ( blur_border_mode) get_value<int>( param( "border")));
	
    blur_channels_mode channels = ( blur_channels_mode) get_value<int>( param( "channels"));
	
    switch( channels)
    {
		case channels_rgba:
		{
			image::buffer_t tmp( const_image_view().height(), const_image_view().width(), 4);
			image::smart_blur_rgba( const_image_view(), tmp.rgba_view(), image_view(), stddev.x, stddev.y, get_value<float>( param( "theresh")));
		}
		break;
	
		case channels_rgb:
		{
			image::buffer_t tmp( const_image_view().height(), const_image_view().width(), 4);
			image::smart_blur_rgba( const_image_view(), tmp.rgba_view(), image_view(), stddev.x, stddev.y, get_value<float>( param( "theresh")));			
			boost::gil::fill_pixels( boost::gil::nth_channel_view( image_view(), 3), boost::gil::gray32f_pixel_t( 0));
			boost::gil::copy_pixels( boost::gil::nth_channel_view( input_as<image_node_t>()->const_subimage_view( area), 3),
										boost::gil::nth_channel_view( subimage_view( area), 3));
		}
		break;
	}
}
开发者ID:devernay,项目名称:ramen-1,代码行数:34,代码来源:smart_blur_node.cpp


示例18: assert

void
MaskedIcon::draw(Canvas &canvas, int x, int y) const
{
  assert(defined());

#ifdef ENABLE_OPENGL
  if (size.cx == 0)
    /* hack: do the postponed layout calcuation now */
    const_cast<MaskedIcon *>(this)->CalculateLayout((bool)size.cy);

  GLTexture &texture = *bitmap.native();

  GLEnable scope(GL_TEXTURE_2D);
  texture.bind();
  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

  GLLogicOp logic_op(GL_OR);
  texture.draw(x - origin.x, y - origin.y, size.cx, size.cy,
               0, 0, size.cx, size.cy);

  logic_op.set(GL_AND);
  texture.draw(x - origin.x, y - origin.y, size.cx, size.cy,
               size.cx, 0, size.cx, size.cy);
#else
  canvas.copy_or(x - origin.x, y - origin.y, size.cx, size.cy,
                 bitmap, 0, 0);
  canvas.copy_and(x - origin.x, y - origin.y, size.cx, size.cy,
                  bitmap, size.cx, 0);
#endif
}
开发者ID:joachimwieland,项目名称:xcsoar-jwieland,代码行数:30,代码来源:Icon.cpp


示例19: inside

  /**
   * Check if this thread is the current thread.
   */
  bool inside() const {
#ifdef HAVE_POSIX
    return defined() && pthread_equal(pthread_self(), handle);
#else
    return GetCurrentThread() == handle;
#endif
  }
开发者ID:Mrdini,项目名称:XCSoar,代码行数:10,代码来源:Thread.hpp


示例20: POMAGMA_INFO

DenseSet Router::find_defined() const {
    POMAGMA_INFO("Finding defined obs");
    DenseSet defined(m_carrier.item_dim());
    DenseSet undefined(m_carrier.item_dim());
    undefined = m_carrier.support();

    bool changed = true;
    while (changed) {
        changed = false;

        POMAGMA_DEBUG("accumulating route probabilities");

        undefined -= defined;
        for (auto iter = undefined.iter(); iter.ok(); iter.next()) {
            Ob ob = *iter;
            if (defines(defined, ob)) {
                defined.insert(ob);
                changed = true;
                break;
            }
        }
    }

    return defined;
}
开发者ID:fritzo,项目名称:pomagma,代码行数:25,代码来源:router.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ deflate函数代码示例发布时间:2022-05-30
下一篇:
C++ define函数代码示例发布时间: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