本文整理汇总了C++中owner函数的典型用法代码示例。如果您正苦于以下问题:C++ owner函数的具体用法?C++ owner怎么用?C++ owner使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了owner函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: most_urgent_DataUnit
// ----------------------------------------------------------------------
autocast::AutoCastProcessor::LocalDataUnit *
AutoCastProcessor::
most_urgent_DataUnit()
throw()
{
double now = owner().world().scheduler().current_time();
std::vector<LocalDataUnit*> tmp_objects;
for (DataUnitsMap::const_iterator it = complete_DataUnits_.begin(); it != complete_DataUnits_.end(); ++it){
if (it->second->last_send_time() < now && it->second->unknown_count() > 0){
for (int i = 0; i < it->second->unknown_count(); i++){
tmp_objects.push_back(it->second);
}
}
}
if (tmp_objects.size() == 0) return NULL;
int idx = static_cast<int>(uniform_random(0.0,tmp_objects.size(),true,false));
return tmp_objects.at(idx);
}
示例2: fabs
void CMissileProjectile::Collision()
{
const float h = ground->GetHeightReal(pos.x, pos.z);
if (weaponDef->waterweapon && h < pos.y) {
// let waterweapons travel in water
return;
}
if (h > pos.y && fabs(speed.y) > 0.001f) {
pos -= speed * std::min(1.0f, (float)((h - pos.y) / fabs(speed.y)));
}
if (weaponDef->visuals.smokeTrail) {
new CSmokeTrailProjectile(pos, oldSmoke, dir, oldDir, owner(), false, true, 7, SMOKE_TIME, 0.6f, drawTrail, 0, weaponDef->visuals.texture2);
}
CWeaponProjectile::Collision();
oldSmoke = pos;
}
示例3: PolyAlgebraHom
RingHom PolyAlgebraHom(const PolyRing& Rx, const ring& Ry, const std::vector<RingElem>& IndetImages)
{
const char* const FnName = "PolyAlgebraHom(Rx,Ry,IndetImages)";
// Check that IndetImages are sensible...
if (NumIndets(Rx) != len(IndetImages))
CoCoA_ERROR(ERR::BadPolyRingHomImages, FnName);
for (long i=0; i < NumIndets(Rx); ++i)
if (owner(IndetImages[i]) != Ry)
CoCoA_ERROR(ERR::BadPolyRingHomImages, FnName);
// // Special case: codomain is coeff ring.
// if (Ry == CoeffRing(Rx))
// return Rx->myHomCtor(Ry, IdentityHom(Ry), IndetImages);
// // General case: codomain must be a poly ring with same coeffs
// if (!IsPolyRing(Ry))
// CoCoA_ERROR(ERR::BadCodomain, FnName);
// if (CoeffRing(Rx) != CoeffRing(Ry))
// CoCoA_ERROR(ERR::MixedCoeffRings, FnName);
// return Rx->myHomCtor(Ry, CoeffEmbeddingHom(Ry), IndetImages);
return Rx->myHomCtor(Ry, CanonicalHom(CoeffRing(Rx),Ry), IndetImages);
}
示例4: owner
void CWeaponProjectile::Collision()
{
if (/* !weaponDef->noExplode || gs->frameNum & 1 */ true) {
// don't do damage only on odd-numbered frames
// for noExplode projectiles (it breaks coldet)
float3 impactDir = speed;
impactDir.Normalize();
// Dynamic Damage
DamageArray dynDamages;
if (weaponDef->dynDamageExp > 0)
dynDamages = weaponDefHandler->DynamicDamages(weaponDef->damages,
startpos, pos, (weaponDef->dynDamageRange > 0)
? weaponDef->dynDamageRange
: weaponDef->range,
weaponDef->dynDamageExp, weaponDef->dynDamageMin,
weaponDef->dynDamageInverted);
helper->Explosion(pos,
(weaponDef->dynDamageExp > 0) ? dynDamages : weaponDef->damages,
weaponDef->areaOfEffect, weaponDef->edgeEffectiveness,
weaponDef->explosionSpeed, owner(), true,
weaponDef->noExplode ? 0.3f : 1,
weaponDef->noExplode || weaponDef->noSelfDamage, weaponDef->impactOnly,
weaponDef->explosionGenerator, 0, impactDir, weaponDef->id);
}
if (weaponDef->soundhit.getID(0) > 0) {
Channels::Battle.PlaySample(weaponDef->soundhit.getID(0), this,
weaponDef->soundhit.getVolume(0));
}
if (!weaponDef->noExplode){
CProjectile::Collision();
} else {
if (TraveledRange()) {
CProjectile::Collision();
}
}
}
示例5: owner
::CORBA::Boolean
TestValuetype::_tao_unmarshal (
TAO_InputCDR &strm,
TestValuetype *&new_object
)
{
::CORBA::ValueBase *base = 0;
::CORBA::Boolean is_indirected = false;
::CORBA::Boolean is_null_object = false;
::CORBA::Boolean const retval =
::CORBA::ValueBase::_tao_unmarshal_pre (
strm,
base,
TestValuetype::_tao_obv_static_repository_id (),
is_null_object,
is_indirected
);
::CORBA::ValueBase_var owner (base);
if (!retval)
return false;
if (is_null_object)
return true;
if (!is_indirected && !base->_tao_unmarshal_v (strm))
return false;
// Now base must point to the unmarshaled object.
// Align the pointer to the right subobject.
new_object = TestValuetype::_downcast (base);
if (0 == new_object)
return false;
if (is_indirected)
new_object->_add_ref ();
owner._retn ();
return true;
}
示例6: creator
void permission_object_t::test<5>()
{
LLPermissions perm,perm1;
LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");
LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806");
LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d");
LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");
perm1.init(creator,owner,lastOwner,group);
U32 base = PERM_TRANSFER;
U32 ownerp = PERM_TRANSFER;
U32 groupp = PERM_TRANSFER;
U32 everyone = PERM_TRANSFER;
U32 next = PERM_NONE;
perm1.initMasks(base, ownerp, everyone, groupp, next);
base = PERM_ALL;
ownerp = PERM_ITEM_UNRESTRICTED; //PERM_ITEM_UNRESTRICTED = PERM_MODIFY | PERM_COPY | PERM_TRANSFER;
groupp = PERM_TRANSFER | PERM_COPY|PERM_MODIFY;
everyone = PERM_TRANSFER;
next = PERM_NONE;
perm.init(creator,owner,lastOwner,group);
perm.initMasks(base, ownerp, everyone, groupp, next);
// restrict permissions by accumulation
perm.accumulate(perm1);
U32 fixedbase = PERM_TRANSFER | PERM_MOVE;
U32 fixedowner = PERM_TRANSFER;
U32 fixedgroup = PERM_TRANSFER;
U32 fixedeveryone = PERM_TRANSFER;
U32 fixednext = PERM_NONE;
ensure_equals("accumulate failed ", fixedbase, perm.getMaskBase());
ensure_equals("accumulate failed ", fixedowner, perm.getMaskOwner());
ensure_equals("accumulate failed ", fixedgroup, perm.getMaskGroup());
ensure_equals("accumulate failed ", fixedeveryone, perm.getMaskEveryone());
ensure_equals("accumulate failed ", fixednext, perm.getMaskNextOwner());
}
示例7: utime
/*
****************************************************************
* Chamada ao sistema "utime" *
****************************************************************
*/
int
utime (const char *path, const time_t *tp)
{
register INODE *ip;
time_t tv[3];
if ((ip = owner (path)) == NOINODE)
return (-1);
if (ip->i_sb->sb_mntent.me_flags & SB_RONLY)
{ u.u_error = EROFS; goto bad; }
/*
* Altera os tempos
*/
if (tp == (time_t *)NULL) /* Tempos de acesso e modificação */
{
ip->i_atime = time;
ip->i_mtime = time;
}
else /* Os 3 tempos */
{
if (unimove (tv, tp, sizeof (tv), US))
{
u.u_error = EFAULT;
goto bad;
}
ip->i_atime = tv[0];
ip->i_mtime = tv[1];
ip->i_ctime = tv[2];
}
inode_dirty_inc (ip);
bad:
iput (ip);
return (UNDEF);
} /* end utime */
示例8: work
// ----------------------------------------------------------------------
void
LocalizationIterLaterationModule::
work( void )
throw()
{
if ( state_ == il_finished )
return;
// do initial stuff;
// if anchor, send 'init-message' and set state to 'finished';
// if unknown, check whether the node is sound or not. if sound,
// send messages, if not, clear estimated position.
if ( state_ == il_init )
{
if ( owner().is_anchor() )
{
send( new LocalizationIterLaterationMessage( observer().confidence() ) );
state_ = il_finished;
}
else
{
sound_ = neighborhood().is_sound();
if ( sound_ && node().has_est_position() )
{
send( new LocalizationIterLaterationMessage( observer().confidence() ) );
send( new LocalizationIterLaterationSoundMessage() );
}
else
{
set_confidence( 0 );
node_w().clear_est_position();
}
state_ = il_work;
}
}
if ( state_ == il_work )
iter_lateration_step();
}
示例9: t01_basic
void t01_basic(){
INIT_LOCAL();
Onion::Dict normal;
normal.add("Hello", "World");
onion_dict *d=onion_dict_new();
onion_dict_add(d, "Hello", "2", 0);
Onion::Dict non_owner(d);
FAIL_IF_NOT_EQUAL_STRING(non_owner.get("Hello"), "2");
Onion::Dict owner(d, true);
FAIL_IF_NOT_EQUAL_STRING(owner.get("Hello"), "2");
non_owner.add("non-owner", "true");
FAIL_IF_NOT_EQUAL_STRING(owner.get("non-owner"), "true");
FAIL_IF_NOT_EQUAL_STRING(onion_dict_get(d,"non-owner"), "true");
END_LOCAL();
}
示例10: loader
bool GScriptCoreService::loadLibrary(const char * namespaces, const GMetaVariadicParam * libraryNames)
{
if(! this->libraryLoader) {
GScopedInterface<IScriptLibraryLoader> loader(createBuiltinLibraries(this->scriptObject));
this->libraryLoader.reset(loader.get());
}
if(namespaces == NULL) {
namespaces = this->bindName.c_str();
}
GScopedInterface<IScriptObject> owner(scriptObjectToInterface(this->scriptObject, false));
for(size_t i = 0; i < libraryNames->paramCount; ++i) {
char * name = fromVariant<char *>(*(libraryNames->params[i]));
if(! this->libraryLoader->loadScriptLibrary(owner.get(), namespaces, name)) {
return false;
}
}
return true;
}
示例11: owner
/*--------------------------------------------------
* Center the window concerning his owner window
*--------------------------------------------------*/
PMWindow& PMWindow::center_at()
{
HWND o_handle = owner ();
HWND p_handle = parent ();
SHAPE o_shape = PMWindow( o_handle ? o_handle : p_handle ).shape();
SHAPE shape = this->shape();
if( o_handle )
{
shape.x = (o_shape.cx - shape.cx)/2 + o_shape.x;
shape.y = (o_shape.cy - shape.cy)/2 + o_shape.y;
}
else
{
shape.x = (o_shape.cx - shape.cx)/2;
shape.y = (o_shape.cy - shape.cy)/2;
}
return reshape( shape );
}
示例12: machine
void cpc_symbiface2_device::device_start()
{
device_t* cpu = machine().device("maincpu");
address_space& space = cpu->memory().space(AS_IO);
m_slot = dynamic_cast<cpc_expansion_slot_device *>(owner());
space.install_readwrite_handler(0xfd00,0xfd07,read8_delegate(FUNC(cpc_symbiface2_device::ide_cs1_r),this),write8_delegate(FUNC(cpc_symbiface2_device::ide_cs1_w),this));
space.install_readwrite_handler(0xfd08,0xfd0f,read8_delegate(FUNC(cpc_symbiface2_device::ide_cs0_r),this),write8_delegate(FUNC(cpc_symbiface2_device::ide_cs0_w),this));
space.install_read_handler(0xfd10,0xfd10,read8_delegate(FUNC(cpc_symbiface2_device::mouse_r),this));
space.install_readwrite_handler(0xfd14,0xfd15,read8_delegate(FUNC(cpc_symbiface2_device::rtc_r),this),write8_delegate(FUNC(cpc_symbiface2_device::rtc_w),this));
space.install_readwrite_handler(0xfd17,0xfd17,read8_delegate(FUNC(cpc_symbiface2_device::rom_rewrite_r),this),write8_delegate(FUNC(cpc_symbiface2_device::rom_rewrite_w),this));
// set up ROM space (these can be writable, when mapped to &4000, or completely disabled, allowing the built-in ROMs to be visible)
// 32 banks of 16kB (512kB)
m_rom_space.resize(32*16384);
m_nvram->set_base(&m_rom_space[0],m_rom_space.size());
save_item(NAME(m_rom_space));
}
示例13: getRoot
/// Closes the LocalConnection object.
//
/// This removes the advanceCallback (so we can be removed by the GC) and
/// removes this object as a listener from the shared memory listeners
/// section.
void
LocalConnection_as::close()
{
// We may be waiting either to send or to receive, so in both cases
// make sure update() isn't called again.
movie_root& mr = getRoot(owner());
mr.removeAdvanceCallback(this);
if (!_connected) return;
_connected = false;
SharedMem::Lock lock(_shm);
if (!lock.locked()) {
log_error("Failed to get lock on shared memory! Will not remove "
"listener");
return;
}
removeListener(_domain + ":" + _name, _shm);
}
示例14: fatalerror
void msx_slot_bunsetsu_device::device_start()
{
msx_slot_rom_device::device_start();
if (m_bunsetsu_region_tag == nullptr)
{
fatalerror("msx_slot_bunsetsu_device: no bunsetsu region tag specified\n");
}
m_bunsetsu_region = owner()->memregion(m_bunsetsu_region_tag);
if (m_bunsetsu_region == nullptr)
{
fatalerror("msx_slot_bunsetsu_device: Unable to find region with tag '%s'\n", m_bunsetsu_region_tag);
}
if (m_bunsetsu_region->bytes() != 0x20000)
{
fatalerror("msx_slot_bunsetsu_device: Bunsetsu region must be 0x20000 bytes.\n");
}
}
示例15: owner
cell factor_vm::code_block_owner(code_block *compiled)
{
tagged<object> owner(compiled->owner);
/* Cold generic word call sites point to quotations that call the
inline-cache-miss and inline-cache-miss-tail primitives. */
if(owner.type_p(QUOTATION_TYPE))
{
tagged<quotation> quot(owner.as<quotation>());
tagged<array> elements(quot->array);
#ifdef FACTOR_DEBUG
assert(array_capacity(elements.untagged()) == 5);
assert(array_nth(elements.untagged(),4) == special_objects[PIC_MISS_WORD]
|| array_nth(elements.untagged(),4) == special_objects[PIC_MISS_TAIL_WORD]);
#endif
tagged<wrapper> word_wrapper(array_nth(elements.untagged(),0));
return word_wrapper->object;
}
else
return compiled->owner;
}