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


C++ defer函数代码示例

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


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

示例1: data_address

void data_address(TTPtr self, t_symbol *address)
{
	WrappedModularInstancePtr	x = (WrappedModularInstancePtr)self;
	
	// Avoid succession of address changes
    if (!EXTRA->changingAddress) {
        
        EXTRA->changingAddress = YES;
        
        // filter repetitions
        if (!(x->arrayAddress == TTAddress(address->s_name))) {
            
            if (!x->iterateInternals) {
                
                // unregister internals
                wrappedModularClass_unregister(x);
                
                x->arraySize = 0;

                // rebuild internals
                defer(self,(method)data_new_address, address, 0, NULL);
                
                // for array mode : output the array once afterward
                if (x->arrayAttrFormat == gensym("array")) {
                    
                    TTValue     array;
                    t_symbol	*msg;
                    long		argc = 0;
                    t_atom		*argv = NULL;
                    TTBoolean	shifted = NO;
                    
                    data_edit_array(self, array);
                    
                    jamoma_ttvalue_to_typed_Atom(array, &msg, &argc, &argv, shifted);
                    
                    // avoid blank before data
                    if (msg == _sym_nothing)
                        outlet_atoms(x->outlets[data_out], argc, argv);
                    else
                        outlet_anything(x->outlets[data_out], msg, argc, argv);
                    
                    if (shifted)
                        argv--;
                    sysmem_freeptr(argv);
                }
            }
        }
        
        EXTRA->changingAddress = NO;
        return;
	}
	
    object_error((t_object*)x, "can't change to %s address. Please defer low", address->s_name);
}
开发者ID:avilleret,项目名称:JamomaMax,代码行数:54,代码来源:j.parameter_array.cpp

示例2: qDebug

void DesktopConnector::jsConnectorReadySlot()
{
    // at this point it's safe to start using setState as the javascript
    // connector has registered to listen for the signal
    qDebug() << "JS Connector is ready!!!!";

    // time to call the initialize callback
    defer( std::bind( m_initializeCallback, true));

//    m_initializeCallback(true);
}
开发者ID:Astroua,项目名称:CARTAvis,代码行数:11,代码来源:DesktopConnector.cpp

示例3: JLOG

void Waiter::wait()
{
    if (proceeder.unique())
    {
        JLOG("everything done, nothing to do");
        return;
    }
    defer([this] {
        auto toDestroy = std::move(proceeder);
    });
    init0();
}
开发者ID:Scardonian,项目名称:Synca,代码行数:12,代码来源:core.cpp

示例4: irphase_process

void irphase_process (t_irphase *x, t_symbol *target, t_symbol *source, double phase, double time_mul, t_phase_type mode)
{
	t_atom args[5];

	atom_setsym(args + 0, target);
	atom_setsym(args + 1, source);
	atom_setfloat(args + 2, phase);
	atom_setfloat(args + 3, time_mul);
	atom_setlong(args + 4, mode);
	
	defer(x, (method) irphase_process_internal, 0, 5, args);
}
开发者ID:EQ4,项目名称:HISSTools_Impulse_Response_Toolbox,代码行数:12,代码来源:irphase~.c

示例5: defer

TCResult ast::EnumDefn::typecheck(sst::TypecheckState* fs, fir::Type* infer, const TypeParamMap_t& gmaps)
{
	fs->pushLoc(this);
	defer(fs->popLoc());

	auto tcr = this->generateDeclaration(fs, infer, gmaps);
	if(tcr.isParametric())  return tcr;
	else if(tcr.isError())  error(this, "failed to generate declaration for enum '%s'", this->name);

	auto defn = dcast(sst::EnumDefn, tcr.defn());
	iceAssert(defn);

	auto oldscope = fs->getCurrentScope();
	fs->teleportToScope(defn->id.scope);
	fs->pushTree(defn->id.name);

	if(this->memberType)	defn->memberType = fs->convertParserTypeToFIR(this->memberType);
	else					defn->memberType = fir::Type::getInt64();

	auto ety = fir::EnumType::get(defn->id, defn->memberType);

	size_t index = 0;
	for(auto cs : this->cases)
	{
		sst::Expr* val = 0;
		if(cs.value)
		{
			iceAssert(defn->memberType);
			val = cs.value->typecheck(fs, defn->memberType).expr();

			if(val->type != defn->memberType)
				error(cs.value, "mismatched type in enum case value; expected type '%s', but found type '%s'", defn->memberType, val->type);
		}

		auto ecd = util::pool<sst::EnumCaseDefn>(cs.loc);
		ecd->id = Identifier(cs.name, IdKind::Name);
		ecd->id.scope = fs->getCurrentScope();
		ecd->type = ety;
		ecd->parentEnum = defn;
		ecd->val = val;
		ecd->index = index++;

		defn->cases[cs.name] = ecd;
		fs->stree->addDefinition(cs.name, ecd);
	}

	defn->type = ety;

	fs->popTree();
	fs->teleportToScope(oldscope);

	return TCResult(defn);
}
开发者ID:flax-lang,项目名称:flax,代码行数:53,代码来源:enums.cpp

示例6: LCD_linesegment

void LCD_linesegment(Lcd *x, long fromx, long fromy, long tox, long toy, long color)
{	
	Atom a[5];
	
	EnterCallback();
	SETLONG(a,fromx);
	SETLONG(a+1,fromy);
	SETLONG(a+2,tox);
	SETLONG(a+3,toy);
	SETLONG(a+4,color);
	defer(x,(method)LCD_dolinesegment,0L,5,a);
	ExitCallback();
}
开发者ID:CNMAT,项目名称:CNMAT-Externs,代码行数:13,代码来源:lcd.c

示例7: cmd_Mute

/*------------------------------------ cmd_Mute ---*/
Pvoid
cmd_Mute(QtPtr xx,
         long  muting)
{
  EnterCallback();
#if defined(TRACE_MESSAGES)
  LOG_POST_1("Mute")
#endif /* TRACE_MESSAGES */
  if (xx)
    defer(xx, reinterpret_cast<method>(deferred_Mute),
          reinterpret_cast<PSymbol>(muting), 0, NULL_PTR);
  ExitMaxMessageHandler()
} /* cmd_Mute */
开发者ID:opendragon,项目名称:Max_Objects,代码行数:14,代码来源:qt_Mute.c

示例8: QWidget

MirrorWidget::MirrorWidget(Aqpm::Configuration::MirrorType type, QWidget *parent)
        : QWidget(parent)
        , m_ui(new Ui::MirrorWidget)
        , m_type(type)
{
    m_ui->setupUi(this);

    reloadMirrors();

    connect(m_ui->deferButton, SIGNAL(clicked()), this, SIGNAL(defer()));
    connect(m_ui->preferButton, SIGNAL(clicked()), this, SIGNAL(prefer()));
    connect(m_ui->removeButton, SIGNAL(clicked()), this, SIGNAL(remove()));
}
开发者ID:drf,项目名称:shaman1,代码行数:13,代码来源:MirrorWidget.cpp

示例9: LCD_frameRect

void LCD_frameRect(Lcd *x, long left, long top, long right, long bottom, long color)
{	
	Atom a[5];
	
	EnterCallback();
	SETLONG(a,left);
	SETLONG(a+1,top);
	SETLONG(a+2,right);
	SETLONG(a+3,bottom);
	SETLONG(a+4,color);
	defer(x,(method)LCD_doframeRect,0L,5,a);
	ExitCallback();
}
开发者ID:CNMAT,项目名称:CNMAT-Externs,代码行数:13,代码来源:lcd.c

示例10: acquire

    Future<Nothing> acquire()
    {
        if (!promises.empty()) {
            // Need to wait for others to get permits first.
            Promise<Nothing>* promise = new Promise<Nothing>();
            promises.push_back(promise);
            return promise->future()
                   .onDiscard(defer(self(), &Self::discard, promise->future()));
        }

        if (timeout.remaining() > Seconds(0)) {
            // Need to wait a bit longer, but first one in the queue.
            Promise<Nothing>* promise = new Promise<Nothing>();
            promises.push_back(promise);
            delay(timeout.remaining(), self(), &Self::_acquire);
            return promise->future()
                   .onDiscard(defer(self(), &Self::discard, promise->future()));
        }

        // No need to wait!
        timeout = Seconds(1) / permitsPerSecond;
        return Nothing();
    }
开发者ID:abhishekamralkar,项目名称:mesos,代码行数:23,代码来源:limiter.hpp

示例11: detect

  Future<Option<MasterInfo>> detect(
      const Option<MasterInfo>& previous = None())
  {
    if (leader != previous) {
      return leader;
    }

    Promise<Option<MasterInfo>>* promise = new Promise<Option<MasterInfo>>();

    promise->future()
      .onDiscard(defer(self(), &Self::discard, promise->future()));

    promises.insert(promise);
    return promise->future();
  }
开发者ID:AbheekG,项目名称:mesos,代码行数:15,代码来源:standalone.cpp

示例12: Failure

Future<Future<Nothing>> LeaderContenderProcess::contend()
{
  if (contending.isSome()) {
    return Failure("Cannot contend more than once");
  }

  LOG(INFO) << "Joining the ZK group";
  candidacy = group->join(data, label);
  candidacy
    .onAny(defer(self(), &Self::joined));

  // Okay, we wait and see what unfolds.
  contending = new Promise<Future<Nothing>>();
  return contending.get()->future();
}
开发者ID:GrovoLearning,项目名称:mesos,代码行数:15,代码来源:contender.cpp

示例13: LOG

void LeaderContenderProcess::cancel()
{
  if (!candidacy.isReady()) {
    // Nothing to cancel.
    if (withdrawing.isSome()) {
      withdrawing.get()->set(false);
    }
    return;
  }

  LOG(INFO) << "Now cancelling the membership: " << candidacy->id();

  group->cancel(candidacy.get())
    .onAny(defer(self(), &Self::cancelled, lambda::_1));
}
开发者ID:GrovoLearning,项目名称:mesos,代码行数:15,代码来源:contender.cpp

示例14: glCreateProgram

bool ShaderProgram::attachShaderFromMemory(ShaderType type,
                                           const std::string& source)
{
	if (!handle)
		handle = glCreateProgram();

	const char* shaderSource{source.c_str()};

	u32 shader{0};
	if (type == ShaderType::Vertex)
		shader = glCreateShader(GL_VERTEX_SHADER);
	else if (type == ShaderType::Fragment)
		shader = glCreateShader(GL_FRAGMENT_SHADER);

	glShaderSource(shader, 1, &shaderSource, nullptr);
	glCompileShader(shader);

	s32 status;
	glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
	if (status == false)
	{
		std::string msg;
		if (type == ShaderType::Vertex)
			msg = "Compile failure in vertex shader: \n";
		else if (type == ShaderType::Fragment)
			msg = "Compile failure in fragment shader: \n";

		s32 infoLogLength;
		glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);

		char* strInfoLog{new char[infoLogLength + 1]};
		defer(delete[] strInfoLog);

		glGetShaderInfoLog(shader, infoLogLength, nullptr, strInfoLog);

		msg.append(strInfoLog);
		msg.append("\n");
		errorLog.append(msg);

		glDeleteShader(shader);

		return false;
	}

	glAttachShader(handle, shader);

	return true;
}
开发者ID:Kitsune001,项目名称:Dunjun,代码行数:48,代码来源:ShaderProgram.cpp

示例15: findViewInfo

void DesktopConnector::jsUpdateViewSlot(const QString & viewName, int width, int height)
{
    ViewInfo * viewInfo = findViewInfo( viewName);
    if( ! viewInfo) {
        qWarning() << "Received update for unknown view " << viewName;
        return;
    }

    IView * view = viewInfo-> view;
    viewInfo-> clientSize = QSize( width, height);

    defer([this,view,viewInfo](){
        view-> handleResizeRequest( viewInfo-> clientSize);
        refreshView( view);
    });
}
开发者ID:Astroua,项目名称:CARTAvis,代码行数:16,代码来源:DesktopConnector.cpp


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