您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ withWriteLock函数代码示例

51自学网 2021-06-03 09:59:42
  C++
这篇教程C++ withWriteLock函数代码示例写得很实用,希望能帮到您。

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

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

示例1: withWriteLock

    void Manager::saveAll() {        bool forceSync = false;        withWriteLock([&] {            for (auto key : _pendingChanges.keys()) {                auto newValue = _pendingChanges[key];                auto savedValue = value(key, UNSET_VALUE);                if (newValue == savedValue) {                    continue;                }                if (newValue == UNSET_VALUE || !newValue.isValid()) {                    forceSync = true;                    remove(key);                } else {                    forceSync = true;                    setValue(key, newValue);                }            }            _pendingChanges.clear();        });        if (forceSync) {            sync();        }        // Restart timer        if (_saveTimer) {            _saveTimer->start();        }    }
开发者ID:BingShearer,项目名称:hifi,代码行数:29,


示例2: withWriteLock

void PolyVoxEntityItem::setVoxelVolumeSize(const vec3& voxelVolumeSize) {    withWriteLock([&] {        assert(!glm::any(glm::isnan(voxelVolumeSize)));        _voxelVolumeSize = glm::vec3(roundf(voxelVolumeSize.x), roundf(voxelVolumeSize.y), roundf(voxelVolumeSize.z));        if (_voxelVolumeSize.x < 1) {            qCDebug(entities) << "PolyVoxEntityItem::setVoxelVolumeSize clamping x of" << _voxelVolumeSize.x << "to 1";            _voxelVolumeSize.x = 1;        }        if (_voxelVolumeSize.x > MAX_VOXEL_DIMENSION) {            qCDebug(entities) << "PolyVoxEntityItem::setVoxelVolumeSize clamping x of" << _voxelVolumeSize.x << "to max";            _voxelVolumeSize.x = MAX_VOXEL_DIMENSION;        }        if (_voxelVolumeSize.y < 1) {            qCDebug(entities) << "PolyVoxEntityItem::setVoxelVolumeSize clamping y of" << _voxelVolumeSize.y << "to 1";            _voxelVolumeSize.y = 1;        }        if (_voxelVolumeSize.y > MAX_VOXEL_DIMENSION) {            qCDebug(entities) << "PolyVoxEntityItem::setVoxelVolumeSize clamping y of" << _voxelVolumeSize.y << "to max";            _voxelVolumeSize.y = MAX_VOXEL_DIMENSION;        }        if (_voxelVolumeSize.z < 1) {            qCDebug(entities) << "PolyVoxEntityItem::setVoxelVolumeSize clamping z of" << _voxelVolumeSize.z << "to 1";            _voxelVolumeSize.z = 1;        }        if (_voxelVolumeSize.z > MAX_VOXEL_DIMENSION) {            qCDebug(entities) << "PolyVoxEntityItem::setVoxelVolumeSize clamping z of" << _voxelVolumeSize.z << "to max";            _voxelVolumeSize.z = MAX_VOXEL_DIMENSION;        }    });}
开发者ID:SeijiEmery,项目名称:hifi,代码行数:33,


示例3: withWriteLock

bool PolyLineEntityItem::setStrokeColors(const QVector<glm::vec3>& strokeColors) {    withWriteLock([&] {        _strokeColors = strokeColors;        _strokeColorsChanged = true;    });    return true;}
开发者ID:ZappoMan,项目名称:hifi,代码行数:7,


示例4: READ_ENTITY_PROPERTY

int WebEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,                                                ReadBitstreamToTreeParams& args,                                                EntityPropertyFlags& propertyFlags, bool overwriteLocalData,                                                bool& somethingChanged) {    int bytesRead = 0;    const unsigned char* dataAt = data;    READ_ENTITY_PROPERTY(PROP_COLOR, glm::u8vec3, setColor);    READ_ENTITY_PROPERTY(PROP_ALPHA, float, setAlpha);    withWriteLock([&] {        int bytesFromPulse = _pulseProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,            propertyFlags, overwriteLocalData,            somethingChanged);        bytesRead += bytesFromPulse;        dataAt += bytesFromPulse;    });    READ_ENTITY_PROPERTY(PROP_BILLBOARD_MODE, BillboardMode, setBillboardMode);    READ_ENTITY_PROPERTY(PROP_SOURCE_URL, QString, setSourceUrl);    READ_ENTITY_PROPERTY(PROP_DPI, uint16_t, setDPI);    READ_ENTITY_PROPERTY(PROP_SCRIPT_URL, QString, setScriptURL);    READ_ENTITY_PROPERTY(PROP_MAX_FPS, uint8_t, setMaxFPS);    READ_ENTITY_PROPERTY(PROP_INPUT_MODE, WebInputMode, setInputMode);    READ_ENTITY_PROPERTY(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, bool, setShowKeyboardFocusHighlight);    return bytesRead;}
开发者ID:AndrewMeadows,项目名称:hifi,代码行数:28,


示例5: withWriteLock

void Pointer::disable() {    // Disable the pointer first, then the pick, so someone can't try to use it while it's in a bad state    withWriteLock([&] {        _enabled = false;    });    DependencyManager::get<PickManager>()->disablePick(_pickUID);}
开发者ID:AndrewMeadows,项目名称:hifi,代码行数:7,


示例6: withWriteLock

void LineEntityItem::setColor(const xColor& value) {    withWriteLock([&] {        _color[RED_INDEX] = value.red;        _color[GREEN_INDEX] = value.green;        _color[BLUE_INDEX] = value.blue;    });}
开发者ID:cozza13,项目名称:hifi,代码行数:7,


示例7: withWriteLock

void PolyVoxEntityItem::setVoxelVolumeSize(glm::vec3 voxelVolumeSize) {    withWriteLock([&] {        assert((int)_voxelVolumeSize.x == _voxelVolumeSize.x);        assert((int)_voxelVolumeSize.y == _voxelVolumeSize.y);        assert((int)_voxelVolumeSize.z == _voxelVolumeSize.z);        _voxelVolumeSize = glm::vec3(roundf(voxelVolumeSize.x), roundf(voxelVolumeSize.y), roundf(voxelVolumeSize.z));        if (_voxelVolumeSize.x < 1) {            qDebug() << "PolyVoxEntityItem::setVoxelVolumeSize clamping x of" << _voxelVolumeSize.x << "to 1";            _voxelVolumeSize.x = 1;        }        if (_voxelVolumeSize.x > MAX_VOXEL_DIMENSION) {            qDebug() << "PolyVoxEntityItem::setVoxelVolumeSize clamping x of" << _voxelVolumeSize.x << "to max";            _voxelVolumeSize.x = MAX_VOXEL_DIMENSION;        }        if (_voxelVolumeSize.y < 1) {            qDebug() << "PolyVoxEntityItem::setVoxelVolumeSize clamping y of" << _voxelVolumeSize.y << "to 1";            _voxelVolumeSize.y = 1;        }        if (_voxelVolumeSize.y > MAX_VOXEL_DIMENSION) {            qDebug() << "PolyVoxEntityItem::setVoxelVolumeSize clamping y of" << _voxelVolumeSize.y << "to max";            _voxelVolumeSize.y = MAX_VOXEL_DIMENSION;        }        if (_voxelVolumeSize.z < 1) {            qDebug() << "PolyVoxEntityItem::setVoxelVolumeSize clamping z of" << _voxelVolumeSize.z << "to 1";            _voxelVolumeSize.z = 1;        }        if (_voxelVolumeSize.z > MAX_VOXEL_DIMENSION) {            qDebug() << "PolyVoxEntityItem::setVoxelVolumeSize clamping z of" << _voxelVolumeSize.z << "to max";            _voxelVolumeSize.z = MAX_VOXEL_DIMENSION;        }    });}
开发者ID:AlphaStaxLLC,项目名称:hifi,代码行数:35,


示例8: withWriteLock

void TextEntityItem::setBackgroundColor(const xColor& value) {    withWriteLock([&] {        _backgroundColor[RED_INDEX] = value.red;        _backgroundColor[GREEN_INDEX] = value.green;        _backgroundColor[BLUE_INDEX] = value.blue;    });}
开发者ID:SeijiEmery,项目名称:hifi,代码行数:7,


示例9: SET_ENTITY_PROPERTY_FROM_PROPERTIES

bool ZoneEntityItem::setSubClassProperties(const EntityItemProperties& properties) {    bool somethingChanged = EntityItem::setSubClassProperties(properties); // set the properties in our base class    SET_ENTITY_PROPERTY_FROM_PROPERTIES(shapeType, setShapeType);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(compoundShapeURL, setCompoundShapeURL);    // Contains a QString property, must be synchronized    withWriteLock([&] {        _keyLightPropertiesChanged = _keyLightProperties.setProperties(properties);        _ambientLightPropertiesChanged = _ambientLightProperties.setProperties(properties);        _skyboxPropertiesChanged = _skyboxProperties.setProperties(properties);    });    _hazePropertiesChanged = _hazeProperties.setProperties(properties);    _bloomPropertiesChanged = _bloomProperties.setProperties(properties);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(flyingAllowed, setFlyingAllowed);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(ghostingAllowed, setGhostingAllowed);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(filterURL, setFilterURL);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(keyLightMode, setKeyLightMode);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(ambientLightMode, setAmbientLightMode);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(skyboxMode, setSkyboxMode);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(hazeMode, setHazeMode);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(bloomMode, setBloomMode);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(avatarPriority, setAvatarPriority);    somethingChanged = somethingChanged || _keyLightPropertiesChanged || _ambientLightPropertiesChanged ||        _skyboxPropertiesChanged || _hazePropertiesChanged || _bloomPropertiesChanged;    return somethingChanged;}
开发者ID:Menithal,项目名称:hifi,代码行数:31,


示例10: withWriteLock

bool ObjectDynamic::updateArguments(QVariantMap arguments) {    bool somethingChanged = false;    withWriteLock([&]{        quint64 previousExpires = _expires;        QString previousTag = _tag;        bool ttlSet = true;        float ttl = EntityDynamicInterface::extractFloatArgument("dynamic", arguments, "ttl", ttlSet, false);        if (ttlSet) {            quint64 now = usecTimestampNow();            _expires = now + (quint64)(ttl * USECS_PER_SECOND);        } else {            _expires = 0;        }        bool tagSet = true;        QString tag = EntityDynamicInterface::extractStringArgument("dynamic", arguments, "tag", tagSet, false);        if (tagSet) {            _tag = tag;        } else {            tag = "";        }        if (previousExpires != _expires || previousTag != _tag) {            somethingChanged = true;        }    });    return somethingChanged;}
开发者ID:ZappoMan,项目名称:hifi,代码行数:31,


示例11: SET_ENTITY_PROPERTY_FROM_PROPERTIES

bool WebEntityItem::setProperties(const EntityItemProperties& properties) {    bool somethingChanged = false;    somethingChanged = EntityItem::setProperties(properties); // set the properties in our base class    SET_ENTITY_PROPERTY_FROM_PROPERTIES(color, setColor);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(alpha, setAlpha);    withWriteLock([&] {        bool pulsePropertiesChanged = _pulseProperties.setProperties(properties);        somethingChanged |= pulsePropertiesChanged;    });    SET_ENTITY_PROPERTY_FROM_PROPERTIES(billboardMode, setBillboardMode);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(sourceUrl, setSourceUrl);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(dpi, setDPI);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(scriptURL, setScriptURL);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(maxFPS, setMaxFPS);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(inputMode, setInputMode);    SET_ENTITY_PROPERTY_FROM_PROPERTIES(showKeyboardFocusHighlight, setShowKeyboardFocusHighlight);    if (somethingChanged) {        bool wantDebug = false;        if (wantDebug) {            uint64_t now = usecTimestampNow();            int elapsed = now - getLastEdited();            qCDebug(entities) << "WebEntityItem::setProperties() AFTER update... edited AGO=" << elapsed <<                    "now=" << now << " getLastEdited()=" << getLastEdited();        }        setLastEdited(properties._lastEdited);    }    return somethingChanged;}
开发者ID:AndrewMeadows,项目名称:hifi,代码行数:32,


示例12: withWriteLock

void ZoneEntityItem::setCompoundShapeURL(const QString& url) {    withWriteLock([&] {        _compoundShapeURL = url;        if (_compoundShapeURL.isEmpty() && _shapeType == SHAPE_TYPE_COMPOUND) {            _shapeType = DEFAULT_SHAPE_TYPE;        }    });}
开发者ID:cozza13,项目名称:hifi,代码行数:8,


示例13: withReadLock

bool ObjectActionOffset::updateArguments(QVariantMap arguments) {    glm::vec3 pointToOffsetFrom;    float linearTimeScale;    float linearDistance;    bool needUpdate = false;    bool somethingChanged = ObjectAction::updateArguments(arguments);    withReadLock([&] {        bool ok = true;        pointToOffsetFrom =        EntityActionInterface::extractVec3Argument("offset action", arguments, "pointToOffsetFrom", ok, true);        if (!ok) {            pointToOffsetFrom = _pointToOffsetFrom;        }        ok = true;        linearTimeScale =        EntityActionInterface::extractFloatArgument("offset action", arguments, "linearTimeScale", ok, false);        if (!ok) {            linearTimeScale = _linearTimeScale;        }        ok = true;        linearDistance =        EntityActionInterface::extractFloatArgument("offset action", arguments, "linearDistance", ok, false);        if (!ok) {            linearDistance = _linearDistance;        }        // only change stuff if something actually changed        if (somethingChanged ||        _pointToOffsetFrom != pointToOffsetFrom ||        _linearTimeScale != linearTimeScale ||        _linearDistance != linearDistance) {            needUpdate = true;        }    });    if (needUpdate) {        withWriteLock([&] {            _pointToOffsetFrom = pointToOffsetFrom;            _linearTimeScale = linearTimeScale;            _linearDistance = linearDistance;            _positionalTargetSet = true;            _active = true;            auto ownerEntity = _ownerEntity.lock();            if (ownerEntity) {                ownerEntity->setActionDataDirty(true);            }        });        activateBody();    }    return true;}
开发者ID:CrackerHax,项目名称:hifi,代码行数:58,


示例14: withWriteLock

void ZoneEntityItem::resetRenderingPropertiesChanged() {    withWriteLock([&] {        _keyLightPropertiesChanged = false;        _ambientLightPropertiesChanged = false;        _skyboxPropertiesChanged = false;        _hazePropertiesChanged = false;        _bloomPropertiesChanged = false;    });}
开发者ID:Menithal,项目名称:hifi,代码行数:9,


示例15: withReadLock

bool ObjectConstraintBallSocket::updateArguments(QVariantMap arguments) {    glm::vec3 pivotInA;    QUuid otherEntityID;    glm::vec3 pivotInB;    bool needUpdate = false;    bool somethingChanged = ObjectDynamic::updateArguments(arguments);    withReadLock([&]{        bool ok = true;        pivotInA = EntityDynamicInterface::extractVec3Argument("ball-socket constraint", arguments, "pivot", ok, false);        if (!ok) {            pivotInA = _pivotInA;        }        ok = true;        otherEntityID = QUuid(EntityDynamicInterface::extractStringArgument("ball-socket constraint",                                                                            arguments, "otherEntityID", ok, false));        if (!ok) {            otherEntityID = _otherID;        }        ok = true;        pivotInB = EntityDynamicInterface::extractVec3Argument("ball-socket constraint", arguments, "otherPivot", ok, false);        if (!ok) {            pivotInB = _pivotInB;        }        if (somethingChanged ||            pivotInA != _pivotInA ||            otherEntityID != _otherID ||            pivotInB != _pivotInB) {            // something changed            needUpdate = true;        }    });    if (needUpdate) {        withWriteLock([&] {            _pivotInA = pivotInA;            _otherID = otherEntityID;            _pivotInB = pivotInB;            _active = true;            auto ownerEntity = _ownerEntity.lock();            if (ownerEntity) {                ownerEntity->setDynamicDataDirty(true);                ownerEntity->setDynamicDataNeedsTransmit(true);            }        });        updateBallSocket();    }    return true;}
开发者ID:ZappoMan,项目名称:hifi,代码行数:56,


示例16: withWriteLock

void WebEntityItem::setScriptURL(const QString& value) {    withWriteLock([&] {        if (_scriptURL != value) {            auto newURL = QUrl::fromUserInput(value);            if (newURL.isValid()) {                _scriptURL = newURL.toDisplayString();            } else {                qCDebug(entities) << "Not setting web entity script URL since" << value << "cannot be parsed to a valid URL.";            }        }    });}
开发者ID:AndrewMeadows,项目名称:hifi,代码行数:13,


示例17: withWriteLock

void AvatarActionHold::prepareForPhysicsSimulation() {    auto avatarManager = DependencyManager::get<AvatarManager>();    auto holdingAvatar = std::static_pointer_cast<Avatar>(avatarManager->getAvatarBySessionID(_holderID));    if (!holdingAvatar || !holdingAvatar->isMyAvatar()) {        return;    }    withWriteLock([&]{        glm::vec3 avatarRigidBodyPosition;        glm::quat avatarRigidBodyRotation;        getAvatarRigidBodyLocation(avatarRigidBodyPosition, avatarRigidBodyRotation);        if (_ignoreIK) {            return;        }        glm::vec3 palmPosition;        glm::quat palmRotation;        if (_hand == "right") {            palmPosition = holdingAvatar->getUncachedRightPalmPosition();            palmRotation = holdingAvatar->getUncachedRightPalmRotation();        } else {            palmPosition = holdingAvatar->getUncachedLeftPalmPosition();            palmRotation = holdingAvatar->getUncachedLeftPalmRotation();        }        // determine the difference in translation and rotation between the avatar's        // rigid body and the palm position.  The avatar's rigid body will be moved by bullet        // between this call and the call to getTarget, below.  A call to get*PalmPosition in        // getTarget would get the palm position of the previous location of the avatar (because        // bullet has moved the av's rigid body but the rigid body's location has not yet been        // copied out into the Avatar class.        //glm::quat avatarRotationInverse = glm::inverse(avatarRigidBodyRotation);        // the offset should be in the frame of the avatar, but something about the order        // things are updated makes this wrong:        //   _palmOffsetFromRigidBody = avatarRotationInverse * (palmPosition - avatarRigidBodyPosition);        // I'll leave it here as a comment in case avatar handling changes.        _palmOffsetFromRigidBody = palmPosition - avatarRigidBodyPosition;        // rotation should also be needed, but again, the order of updates makes this unneeded.  leaving        // code here for future reference.        // _palmRotationFromRigidBody = avatarRotationInverse * palmRotation;    });    activateBody(true);}
开发者ID:howard-stearns,项目名称:hifi,代码行数:49,


示例18: withWriteLock

bool AvatarActionHold::updateArguments(QVariantMap arguments) {    bool ok = true;    glm::vec3 relativePosition =        EntityActionInterface::extractVec3Argument("hold", arguments, "relativePosition", ok, false);    if (!ok) {        relativePosition = _relativePosition;    }    ok = true;    glm::quat relativeRotation =        EntityActionInterface::extractQuatArgument("hold", arguments, "relativeRotation", ok, false);    if (!ok) {        relativeRotation = _relativeRotation;    }        ok = true;    float timeScale =        EntityActionInterface::extractFloatArgument("hold", arguments, "timeScale", ok, false);    if (!ok) {        timeScale = _linearTimeScale;    }    ok = true;    QString hand =        EntityActionInterface::extractStringArgument("hold", arguments, "hand", ok, false);    if (!ok || !(hand == "left" || hand == "right")) {        hand = _hand;    }    if (relativePosition != _relativePosition            || relativeRotation != _relativeRotation            || timeScale != _linearTimeScale            || hand != _hand) {        withWriteLock([&] {            _relativePosition = relativePosition;            _relativeRotation = relativeRotation;            const float MIN_TIMESCALE = 0.1f;            _linearTimeScale = glm::min(MIN_TIMESCALE, timeScale);            _angularTimeScale = _linearTimeScale;            _hand = hand;            _mine = true;            _active = true;            activateBody();        });    }    return true;}
开发者ID:charukcs,项目名称:hifi,代码行数:48,



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


C++ within函数代码示例
C++ withReadLock函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。