本文整理汇总了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) ();
}
示例2: loading_
COMA_USING_NS
ResourceManager::ResourceManager() : loading_(false)
{
SetEventListener(ResourceManagerEvent::LOAD_COMPLETE, BIND(ResourceManager::CompleteListener));
SetEventListener(ResourceManagerEvent::UNLOAD_COMPLETE, BIND(ResourceManager::CompleteListener));
}
示例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);
}
示例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"));
}
示例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 ) );
}
示例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" );
}
示例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;
}
示例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();
}
示例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);
}
示例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;
}
示例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()));
}
示例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");
}
示例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;
}
示例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));
}
示例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;
}