當前位置: 首頁>>代碼示例>>C++>>正文


C++ BIND函數代碼示例

本文整理匯總了C++中BIND函數的典型用法代碼示例。如果您正苦於以下問題:C++ BIND函數的具體用法?C++ BIND怎麽用?C++ BIND使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了BIND函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: AutoGL_SetUp

void AutoGL_SetUp (int argc, char *argv[])
{
  AutoGL_SetViewRedrawCallback (BIND(autogl_redraw));
  AutoGL_SetIdleEventCallback (BIND(autogl_idle));

  BIND(autogl_setup) ();
}
開發者ID:kuvo1017,項目名稱:advmates,代碼行數:7,代碼來源:autogl_fortran.c

示例2: loading_

COMA_USING_NS

ResourceManager::ResourceManager() : loading_(false)
{
	SetEventListener(ResourceManagerEvent::LOAD_COMPLETE, BIND(ResourceManager::CompleteListener));
	SetEventListener(ResourceManagerEvent::UNLOAD_COMPLETE, BIND(ResourceManager::CompleteListener));
}
開發者ID:letepyu,項目名稱:Coma2D,代碼行數:7,代碼來源:ResourceManager.cpp

示例3: BIND

Weapon::Weapon(const WeaponConfig * pConfig) {
    m_pConfig = pConfig;
    m_bullet_level = BULLET_LEVEL_1;
    
    BIND(BUND_ID_WEAPON_FIRE, this, Weapon::OnCmdFire);
    BIND(BUND_ID_BULLET_LEVEL_UP, this, Weapon::OnCmdBulletUp);
}
開發者ID:joyfish,項目名稱:PlaneWar,代碼行數:7,代碼來源:Weapon.cpp

示例4: EMPLACE

 vexcl_steppers::vexcl_steppers(tensor_factory& f, cse& cw, lambda_manager& lm, translator_data& p, language_printer& prn)
   : ::macro_packages::replacement_rule_package(f, cw, lm, p, prn)
   {
     EMPLACE(pre_package, BIND(replace_backg_stepper, "MAKE_BACKG_STEPPER"));
     EMPLACE(pre_package, BIND(replace_pert_stepper, "MAKE_PERT_STEPPER"));
     EMPLACE(pre_package, BIND(stepper_name, "BACKG_STEPPER"));
     EMPLACE(pre_package, BIND(stepper_name, "PERT_STEPPER"));
   }
開發者ID:ds283,項目名稱:CppTransport,代碼行數:8,代碼來源:vexcl_steppers.cpp

示例5: GetAPI

void clGLVertexArray::AfterConstruction()
{
	iVertexArray::AfterConstruction();

	GetAPI( Env );

	Env->Connect( L_EVENT_SURFACE_ATTACHED, BIND( &clGLVertexArray::Event_SURFACE_ATTACHED ) );
	Env->Connect( L_EVENT_SURFACE_DETACHED, BIND( &clGLVertexArray::Event_SURFACE_DETACHED ) );
}
開發者ID:berezhkovskaya,項目名稱:Carousel3D,代碼行數:9,代碼來源:GLVertexArray.cpp

示例6: RegisterCommand

void clConsole::AfterConstruction()
{
	RegisterCommand( "Quit",             Utils::Bind( &clConsole::QuitC,          this ) );
	RegisterCommand( "Exit",             Utils::Bind( &clConsole::QuitC,          this ) );
	RegisterCommand( "Exec",             Utils::Bind( &clConsole::ExecC,          this ) );
	RegisterCommand( "Bind",             Utils::Bind( &clConsole::BindC,          this ) );
	RegisterCommand( "Alias",            Utils::Bind( &clConsole::AliasC,         this ) );
	RegisterCommand( "ToggleConsole",    Utils::Bind( &clConsole::ToggleConsoleC, this ) );
	RegisterCommand( "Mount",            Utils::Bind( &clConsole::MountC,         this ) );
	RegisterCommand( "Clear",            Utils::Bind( &clConsole::ClearC,         this ) );
	RegisterCommand( "Version",          Utils::Bind( &clConsole::VersionC,       this ) );
	RegisterCommand( "Help",             Utils::Bind( &clConsole::HelpC,          this ) );
	RegisterCommand( "CmdList",          Utils::Bind( &clConsole::HelpC,          this ) );
	RegisterCommand( "TogglePause",      Utils::Bind( &clConsole::TogglePauseC,   this ) );
	RegisterCommand( "Toggle",           Utils::Bind( &clConsole::ToggleC,        this ) );
	RegisterCommand( "Set",              Utils::Bind( &clConsole::SetC,           this ) );
	RegisterCommand( "SetProperty",      Utils::Bind( &clConsole::SetPropertyC,   this ) );
	RegisterCommand( "Show",             Utils::Bind( &clConsole::ShowC,          this ) );
	RegisterCommand( "Menu",             Utils::Bind( &clConsole::MenuC,          this ) );
	RegisterCommand( "SaveVars",         Utils::Bind( &clConsole::SaveVarsC,      this ) );
	RegisterCommand( "RefreshScreen",    Utils::Bind( &clConsole::RefreshScreenC, this ) );
	RegisterCommand( "Sleep",            Utils::Bind( &clConsole::SleepC,         this ) );
	RegisterCommand( "SetLogLevel",      Utils::Bind( &clConsole::SetLogLevelC,   this ) );
	RegisterCommand( "PrintLogLevel",    Utils::Bind( &clConsole::PrintLogLevelC, this ) );

	RegisterCommand( "AddDirWatch",      Utils::Bind( &clFileSystem::AddDirWatchC,     Env->FileSystem ) );
	RegisterCommand( "AddFileWatch",     Utils::Bind( &clFileSystem::AddFileWatchC,    Env->FileSystem ) );
	RegisterCommand( "RemoveDirWatch",   Utils::Bind( &clFileSystem::RemoveDirWatchC,  Env->FileSystem ) );
	RegisterCommand( "RemoveFileWatch",  Utils::Bind( &clFileSystem::RemoveFileWatchC, Env->FileSystem ) );

	Env->Logger->Connect( L_EVENT_ERROR,       BIND( &clConsole::Event_ERROR ) );
	Env->Connect( L_EVENT_TIMER,       BIND( &clConsole::Event_TIMER ) );
	Env->ConnectWithPriority( L_EVENT_KEY,         BIND( &clConsole::Event_KEY         ),  -1 );

	FConsoleHUDFileName = GetVar( "GUI.ConsoleHUD" );
	FConsoleHUDFileName->SetString( "Interface/Console.gui" );

	FShouldSaveHistory = GetVar ( "Console.SaveHistory" );
	FShouldSaveHistory->SetBool( true );

	GetVarDefault( "Core.EngineVersion", ENGINE_VERSION );

	if ( Env->FileSystem->FileExists( HistoryFileName ) )
	{
		iIStream* Input = Env->FileSystem->CreateFileReader( HistoryFileName );

		FCommandsHistory->LoadFromStream( Input );

		delete( Input );
	}

	// instantiate script compiler
	// its initialization is delayed until some script is actually compiled
	FScriptCompiler = Env->Linker->Instantiate( "clScriptCompiler" );
}
開發者ID:berezhkovskaya,項目名稱:Carousel3D,代碼行數:55,代碼來源:Console.cpp

示例7: BIND

bool InputBinder::try_bind_scene_entity_to_input(
    const Scene&                    scene,
    const SymbolTable&              scene_symbols,
    const char*                     entity_type,
    const char*                     entity_name,
    const char*                     param_value,
    InputArray::iterator&           input)
{
    if (input.format() == InputFormatEntity)
    {
        #define BIND(symbol, collection)                        \
            case symbol:                                        \
              input.bind(collection.get_by_name(param_value));  \
              return true

        switch (scene_symbols.lookup(param_value))
        {
          BIND(SymbolTable::SymbolColor, scene.colors());
          BIND(SymbolTable::SymbolTexture, scene.textures());
          BIND(SymbolTable::SymbolTextureInstance, scene.texture_instances());
          BIND(SymbolTable::SymbolEnvironmentEDF, scene.environment_edfs());
          BIND(SymbolTable::SymbolEnvironmentShader, scene.environment_shaders());
        }

        #undef BIND
    }
    else
    {
        switch (scene_symbols.lookup(param_value))
        {
          case SymbolTable::SymbolColor:
            bind_color_to_input(
                scene.colors(),
                param_value,
                input);
            return true;

          case SymbolTable::SymbolTextureInstance:
            bind_texture_instance_to_input(
                scene.texture_instances(),
                ~0,                 // the parent is the scene, not an assembly
                entity_type,
                entity_name,
                param_value,
                input);
            return true;
        }
    }

    return false;
}
開發者ID:marius-avram,項目名稱:appleseed,代碼行數:51,代碼來源:inputbinder.cpp

示例8: main

int main()
{
    typedef void(*Callfp)();

    Callfp u;
    BIND( u, Base::f );
    u();
    Callfp v;
    BIND( v, Base::g );
    v();
    Callfp w;
    BIND( w, Base::h );
    w();
}
開發者ID:CCJY,項目名稱:coliru,代碼行數:14,代碼來源:main.cpp

示例9: CCASSERT

void Battle::onEnter() {
    PublicUI::onEnter();
    CCASSERT(s_mission_name != ""
             && NULL != (m_pConfig = g_pGameConfig->getMissionConfig(s_mission_name)),
             "set mission first");
    
    schedule(schedule_selector(Battle::collidtion), 1/60.0f);
    
    m_pBoss = NULL;
    
    mask();
    ArmatureDataManager::getInstance()->addArmatureFileInfo("Animation/UI/readygo.ExportJson");
    m_pReadygo = Armature::create("readygo");
    m_pReadygo->setAnchorPoint(Vec2(.5f, .5f));
    this->addChild(m_pReadygo, GRADE_UI);
    m_pReadygo->setPosition(g_pGameConfig->screenCenterPoint);
    m_pReadygo->getAnimation()->play("readygo");
    m_pReadygo->setScale(g_pGameConfig->scaleEleMin * 1.5f);
    m_pReadygo->getAnimation()->setMovementEventCallFunc(this, movementEvent_selector(Battle::playActionOver));
    
    s_enemy_count = 0;
    s_itor = m_pConfig->events.begin();
    if (s_itor != m_pConfig->events.end()) {
        CTimer * timer = CTimer::create(&(*s_itor), BUND_ID_BATTLE_EVENT, 0, 0, s_itor->delay);
        addChild(timer);
    }
    
    BIND(BUND_ID_BULLET_FIRED, this, Battle::bulletFired);
    BIND(BUND_ID_BULLET_DISAPPEARED, this, Battle::bulletDisappear);
    BIND(BUND_ID_BATTLE_EVENT, this, Battle::event_exec);
    BIND(BUND_ID_ENEMY_EVENT, this, Battle::enemy_event);
    BIND(BUND_ID_ENEMY_DISAPPEAR, this, Battle::enemydisappear);
    BIND(BUND_ID_PLANE_DISAPPEAR, this, Battle::planedisappear);
    BIND(BUND_ID_PLANE_INJURED, this, Battle::planeinjured);
    BIND(BUND_ID_GLOBAL_TOUCH_BEGAN, this, Battle::globalTouchBegan);
    BIND(BUND_ID_BOSS_DISAPPEAR, this, Battle::bossdisappear);
    
    SEquip equip;
    g_pEquipManager->getGrooveEquip(EQUIP_TYPE_PLANE, equip);
    m_pPlane = Plane::create(equip);
    m_pPlane->setScale(g_pGameConfig->scaleEleMin * .75f);
    g_pEquipManager->getGrooveEquip(EQUIP_TYPE_WEAPON, equip);
    m_pPlane->addWeapon(equip);
    g_pEquipManager->getGrooveEquip(EQUIP_TYPE_WINGMAN, equip);
    m_pPlane->addWingman(equip);
    
    g_pEquipManager->getGrooveEquip(EQUIP_TYPE_ARMOR, equip);
    m_pPlane->addArmor(equip);
    
    m_pPlane->setPosition(Vec2(g_pGameConfig->screenCenterPoint.x, 0));
    addChild(m_pPlane, GRADE_PLAYER);
    ActionInterval * action = EaseExponentialOut::create(MoveBy::create(2, Vec2(0, 500 * g_pGameConfig->scaleEleY)));
    m_pPlane->runAction(action);
}
開發者ID:joyfish,項目名稱:PlaneWar,代碼行數:54,代碼來源:BattleScene.cpp

示例10: AlphaBeta

	int AlphaBeta  (const uint64_t P, const uint64_t O, uint64_t& NodeCounter, int alpha, int beta)
	{
		const uint64_t empties = Empties(P, O);
		if (empties == 4)
			return AlphaBeta_4(P, O, NodeCounter, alpha, beta);

		uint64_t flipped;
		uint64_t BitBoardPossible = PossibleMoves(P, O);
		unsigned long Move;
		int score = -64;
		NodeCounter++;

		if (!BitBoardPossible){
			if (HasMoves(O, P))
				return -AlphaBeta(O, P, NodeCounter, -beta, -alpha);
			else //Game is over
				return BIND(EvalGameOver(P, empties), alpha, beta);
		}

		while (BitBoardPossible)
		{
			Move = BitScanLSB(BitBoardPossible);
			RemoveLSB(BitBoardPossible);
			flipped = flip(P, O, Move);
			score = -AlphaBeta(O ^ flipped, P ^ (1ULL << Move) ^ flipped, NodeCounter, -beta, -alpha);
			if (score >= beta) return beta;
			if (score > alpha) alpha = score;
		}

		return alpha;
	}
開發者ID:PanicSheep,項目名稱:Cassandra,代碼行數:31,代碼來源:endgame_negamax.cpp

示例11: assert

void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp,
                                            bool for_compiler_entry) {
  assert(method == rmethod, "interpreter calling convention");
  Label L_no_such_method;
  __ cbz(rmethod, L_no_such_method);
  __ verify_method_ptr(method);

  if (!for_compiler_entry && JvmtiExport::can_post_interpreter_events()) {
    Label run_compiled_code;
    // JVMTI events, such as single-stepping, are implemented partly by avoiding running
    // compiled code in threads for which the event is enabled.  Check here for
    // interp_only_mode if these events CAN be enabled.

    __ ldrb(rscratch1, Address(rthread, JavaThread::interp_only_mode_offset()));
    __ cbnz(rscratch1, run_compiled_code);
    __ ldr(rscratch1, Address(method, Method::interpreter_entry_offset()));
    __ br(rscratch1);
    __ BIND(run_compiled_code);
  }

  const ByteSize entry_offset = for_compiler_entry ? Method::from_compiled_offset() :
                                                     Method::from_interpreted_offset();
  __ ldr(rscratch1,Address(method, entry_offset));
  __ br(rscratch1);
  __ bind(L_no_such_method);
  __ far_jump(RuntimeAddress(StubRoutines::throw_AbstractMethodError_entry()));
}
開發者ID:campolake,項目名稱:openjdk9,代碼行數:27,代碼來源:methodHandles_aarch64.cpp

示例12: LP64_ONLY

void MethodHandles::verify_klass(MacroAssembler* _masm,
                                 Register obj, SystemDictionary::WKID klass_id,
                                 const char* error_message) {
  Klass** klass_addr = SystemDictionary::well_known_klass_addr(klass_id);
  KlassHandle klass = SystemDictionary::well_known_klass(klass_id);
  Register temp = rdi;
  Register temp2 = noreg;
  LP64_ONLY(temp2 = rscratch1);  // used by MacroAssembler::cmpptr
  Label L_ok, L_bad;
  BLOCK_COMMENT("verify_klass {");
  __ verify_oop(obj);
  __ testptr(obj, obj);
  __ jcc(Assembler::zero, L_bad);
  __ push(temp); if (temp2 != noreg)  __ push(temp2);
#define UNPUSH { if (temp2 != noreg)  __ pop(temp2);  __ pop(temp); }
  __ load_klass(temp, obj);
  __ cmpptr(temp, ExternalAddress((address) klass_addr));
  __ jcc(Assembler::equal, L_ok);
  intptr_t super_check_offset = klass->super_check_offset();
  __ movptr(temp, Address(temp, super_check_offset));
  __ cmpptr(temp, ExternalAddress((address) klass_addr));
  __ jcc(Assembler::equal, L_ok);
  UNPUSH;
  __ bind(L_bad);
  __ STOP(error_message);
  __ BIND(L_ok);
  UNPUSH;
  BLOCK_COMMENT("} verify_klass");
}
開發者ID:pombreda,項目名稱:graal,代碼行數:29,代碼來源:methodHandles_x86.cpp

示例13: main

int main(int argc,char *argv[]){
	int sock,newsock;
	int portNum,pid;
	socklen_t clientLen;
	struct sockaddr_in server_addr;
	struct sockaddr_in client_addr;
	char buffer[1000];

	if(argc != 2){
		printf("ERROR, wrong number of arguments!\n");
		printf("./ftps portNumber");
		exit(0);
	}
	sock = SOCKET(AF_INET,SOCK_STREAM,0);
	if(sock < 0){
		printf("ERROR OPENING SOCKET!");
		exit(0);
	}
	/*Sets up connection for the server */
	//portNum = atoi(argv[1]);
	server_addr.sin_family = AF_INET;
	server_addr.sin_addr.s_addr = 0;
	server_addr.sin_port = htons(SERVERPORT);
	
	if(BIND(sock,(struct sockaddr *)&server_addr,sizeof(server_addr)) < 0){
		perror("ERROR binding to socket!");
		exit(0);
	}
	
	receiveFile(sock);
		
	return 0;	
}
開發者ID:Roman32,項目名稱:CSE5462Lab3,代碼行數:33,代碼來源:ftps.c

示例14: assert

void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp,
                                            bool for_compiler_entry) {
  assert(method == rbx, "interpreter calling convention");
  __ verify_method_ptr(method);

  if (!for_compiler_entry && JvmtiExport::can_post_interpreter_events()) {
    Label run_compiled_code;
    // JVMTI events, such as single-stepping, are implemented partly by avoiding running
    // compiled code in threads for which the event is enabled.  Check here for
    // interp_only_mode if these events CAN be enabled.
#ifdef _LP64
    Register rthread = r15_thread;
#else
    Register rthread = temp;
    __ get_thread(rthread);
#endif
    // interp_only is an int, on little endian it is sufficient to test the byte only
    // Is a cmpl faster?
    __ cmpb(Address(rthread, JavaThread::interp_only_mode_offset()), 0);
    __ jccb(Assembler::zero, run_compiled_code);
    __ jmp(Address(method, Method::interpreter_entry_offset()));
    __ BIND(run_compiled_code);
  }

  const ByteSize entry_offset = for_compiler_entry ? Method::from_compiled_offset() :
                                                     Method::from_interpreted_offset();
  __ jmp(Address(method, entry_offset));
}
開發者ID:pombreda,項目名稱:graal,代碼行數:28,代碼來源:methodHandles_x86.cpp

示例15: SOCKET

bool TcpServer::init(int port_num)
{
  int rc;
  bool rtn;
  const int reuse_addr = 1;
  //int err;
  SOCKLEN_T addrSize = 0;

  rc = SOCKET(AF_INET, SOCK_STREAM, 0);
  if (this->SOCKET_FAIL != rc)
  {
    this->setSrvrHandle(rc);
    LOG_DEBUG("Socket created, rc: %d", rc);
    LOG_DEBUG("Socket handle: %d", this->getSrvrHandle());

    
    SET_REUSE_ADDR(this->getSrvrHandle(), reuse_addr);

    // Initialize address data structure
    memset(&this->sockaddr_, 0, sizeof(this->sockaddr_));
    this->sockaddr_.sin_family = AF_INET;
    this->sockaddr_.sin_addr.s_addr = INADDR_ANY;
    this->sockaddr_.sin_port = HTONS(port_num);

    addrSize = sizeof(this->sockaddr_);
    rc = BIND(this->getSrvrHandle(), (sockaddr *)&(this->sockaddr_), addrSize);

    if (this->SOCKET_FAIL != rc)
    {
      LOG_INFO("Server socket successfully initialized");

      rc = LISTEN(this->getSrvrHandle(), 1);

      if (this->SOCKET_FAIL != rc)
      {
        LOG_INFO("Socket in listen mode");
        rtn = true;
      }
      else
      {
        LOG_ERROR("Failed to set socket to listen");
        rtn = false;
      }
    }
    else
    {
      LOG_ERROR("Failed to bind socket, rc: %d", rc);
      CLOSE(this->getSrvrHandle());
      rtn = false;
    }

  }
  else
  {
    LOG_ERROR("Failed to create socket, rc: %d", rc);
    rtn = false;
  }

  return rtn;
}
開發者ID:ZahraZahra,項目名稱:swri-ros-pkg,代碼行數:60,代碼來源:tcp_server.cpp


注:本文中的BIND函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。