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


C++ sle::pointer类代码示例

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


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

示例1: sleRippleState

static
std::uint32_t
rippleQuality (
    LedgerEntrySet& ledger,
    AccountID const& destination,
    AccountID const& source,
    Currency const& currency,
    SField const& sfLow,
    SField const& sfHigh)
{
    std::uint32_t uQuality (QUALITY_ONE);

    if (destination != source)
    {
        SLE::pointer sleRippleState (ledger.entryCache (ltRIPPLE_STATE,
            getRippleStateIndex (destination, source, currency)));

        // we should be able to assert(sleRippleState) here

        if (sleRippleState)
        {
            auto const& sfField = destination < source ? sfLow : sfHigh;

            uQuality = sleRippleState->isFieldPresent (sfField)
                ? sleRippleState->getFieldU32 (sfField)
                : QUALITY_ONE;

            if (!uQuality)
                uQuality = 1; // Avoid divide by zero.
        }
    }

    return uQuality;
}
开发者ID:reecer,项目名称:rippled,代码行数:34,代码来源:RippleLiquidity.cpp

示例2: applyFeature

TER ChangeTransactor::applyFeature ()
{
    uint256 feature = mTxn.getFieldH256 (sfFeature);

    SLE::pointer featureObject = mEngine->entryCache (ltFEATURES, Ledger::getLedgerFeatureIndex ());

    if (!featureObject)
        featureObject = mEngine->entryCreate (ltFEATURES, Ledger::getLedgerFeatureIndex ());

    STVector256 features = featureObject->getFieldV256 (sfFeatures);

    if (features.hasValue (feature))
        return tefALREADY;

    features.addValue (feature);
    featureObject->setFieldV256 (sfFeatures, features);
    mEngine->entryModify (featureObject);

    getApp().getFeatureTable ().enableFeature (feature);

    if (!getApp().getFeatureTable ().isFeatureSupported (feature))
        getApp().getOPs ().setFeatureBlocked ();

    return tesSUCCESS;
}
开发者ID:12w21,项目名称:rippled,代码行数:25,代码来源:ChangeTransactor.cpp

示例3: checkNoRipple

/** Check if a sequence of three accounts violates the no ripple constrains
    [first] -> [second] -> [third]
    Disallowed if 'second' set no ripple on [first]->[second] and
    [second]->[third]
*/
TER PathState::checkNoRipple (
    AccountID const& firstAccount,
    AccountID const& secondAccount,
    // This is the account whose constraints we are checking
    AccountID const& thirdAccount,
    Currency const& currency)
{
    // fetch the ripple lines into and out of this node
    SLE::pointer sleIn = view().peek (
        keylet::line(firstAccount, secondAccount, currency));
    SLE::pointer sleOut = view().peek (
        keylet::line(secondAccount, thirdAccount, currency));

    if (!sleIn || !sleOut)
    {
        terStatus = terNO_LINE;
    }
    else if (
        sleIn->getFieldU32 (sfFlags) &
            ((secondAccount > firstAccount) ? lsfHighNoRipple : lsfLowNoRipple) &&
        sleOut->getFieldU32 (sfFlags) &
            ((secondAccount > thirdAccount) ? lsfHighNoRipple : lsfLowNoRipple))
    {
        JLOG (j_.info)
            << "Path violates noRipple constraint between "
            << firstAccount << ", "
            << secondAccount << " and "
            << thirdAccount;

        terStatus = terNO_RIPPLE;
    }
    return terStatus;
}
开发者ID:alexandrev,项目名称:rippled,代码行数:38,代码来源:PathState.cpp

示例4: getMasterGenerator

// Look up the master public generator for a regular seed so we may index source accounts ids.
// --> naRegularSeed
// <-- naMasterGenerator
Json::Value getMasterGenerator (
    Ledger::ref lrLedger, const RippleAddress& naRegularSeed,
    RippleAddress& naMasterGenerator, NetworkOPs& netOps)
{
    RippleAddress       na0Public;      // To find the generator's index.
    RippleAddress       na0Private;     // To decrypt the master generator's cipher.
    RippleAddress       naGenerator = RippleAddress::createGeneratorPublic (naRegularSeed);

    na0Public.setAccountPublic (naGenerator, 0);
    na0Private.setAccountPrivate (naGenerator, naRegularSeed, 0);

    SLE::pointer        sleGen          = netOps.getGenerator (lrLedger, na0Public.getAccountID ());

    if (!sleGen)
    {
        // No account has been claimed or has had it password set for seed.
        return rpcError (rpcNO_ACCOUNT);
    }

    Blob    vucCipher           = sleGen->getFieldVL (sfGenerator);
    Blob    vucMasterGenerator  = na0Private.accountPrivateDecrypt (na0Public, vucCipher);

    if (vucMasterGenerator.empty ())
    {
        return rpcError (rpcFAIL_GEN_DECRYPT);
    }

    naMasterGenerator.setGenerator (vucMasterGenerator);

    return Json::Value (Json::objectValue);
}
开发者ID:Cocongo,项目名称:rippled,代码行数:34,代码来源:GetMasterGenerator.cpp

示例5: view

TER
SetSignerList::removeSignersFromLedger (Keylet const& accountKeylet,
        Keylet const& ownerDirKeylet, Keylet const& signerListKeylet)
{
    // We have to examine the current SignerList so we know how much to
    // reduce the OwnerCount.
    SLE::pointer signers = view().peek (signerListKeylet);

    // If the signer list doesn't exist we've already succeeded in deleting it.
    if (!signers)
        return tesSUCCESS;

    STArray const& actualList = signers->getFieldArray (sfSignerEntries);
    int const removeFromOwnerCount = ownerCountDelta (actualList.size()) * -1;

    // Remove the node from the account directory.
    auto const hint = (*signers)[sfOwnerNode];

    auto viewJ = ctx_.app.journal ("View");
    TER const result  = dirDelete(ctx_.view(), false, hint,
        ownerDirKeylet.key, signerListKeylet.key, false, (hint == 0), viewJ);

    if (result == tesSUCCESS)
        adjustOwnerCount(view(),
            view().peek(accountKeylet), removeFromOwnerCount, viewJ);

    ctx_.view().erase (signers);

    return result;
}
开发者ID:E-LLP,项目名称:rippled,代码行数:30,代码来源:SetSignerList.cpp

示例6: applyAmendment

TER Change::applyAmendment ()
{
    uint256 amendment (mTxn.getFieldH256 (sfAmendment));

    SLE::pointer amendmentObject (mEngine->entryCache (
        ltAMENDMENTS, Ledger::getLedgerAmendmentIndex ()));

    if (!amendmentObject)
    {
        amendmentObject = mEngine->entryCreate(
            ltAMENDMENTS, Ledger::getLedgerAmendmentIndex());
    }

    STVector256 amendments (amendmentObject->getFieldV256 (sfAmendments));

    if (amendments.hasValue (amendment))
        return tefALREADY;

    amendments.addValue (amendment);
    amendmentObject->setFieldV256 (sfAmendments, amendments);
    mEngine->entryModify (amendmentObject);

    getApp().getAmendmentTable ().enable (amendment);

    if (!getApp().getAmendmentTable ().isSupported (amendment))
        getApp().getOPs ().setAmendmentBlocked ();

    return tesSUCCESS;
}
开发者ID:CCJY,项目名称:rippled,代码行数:29,代码来源:Change.cpp

示例7: checkNoRipple

/** Check if a sequence of three accounts violates the no ripple constrains
    [first] -> [second] -> [third]
    Disallowed if 'second' set no ripple on [first]->[second] and [second]->[third]
*/
void PathState::checkNoRipple (
    uint160 const& firstAccount,
    uint160 const& secondAccount,  // This is the account whose constraints we are checking
    uint160 const& thirdAccount,
    uint160 const& currency)
{
    // fetch the ripple lines into and out of this node
    SLE::pointer sleIn = lesEntries.entryCache (ltRIPPLE_STATE,
        Ledger::getRippleStateIndex (firstAccount, secondAccount, currency));
    SLE::pointer sleOut = lesEntries.entryCache (ltRIPPLE_STATE,
        Ledger::getRippleStateIndex (secondAccount, thirdAccount, currency));

    if (!sleIn || !sleOut)
    {
        terStatus = terNO_LINE;
    }
    else if (
        is_bit_set (sleIn->getFieldU32 (sfFlags),
            (secondAccount > firstAccount) ? lsfHighNoRipple : lsfLowNoRipple) &&
        is_bit_set (sleOut->getFieldU32 (sfFlags),
            (secondAccount > thirdAccount) ? lsfHighNoRipple : lsfLowNoRipple))
    {
        WriteLog (lsINFO, RippleCalc) << "Path violates noRipple constraint between " <<
            RippleAddress::createHumanAccountID (firstAccount) << ", " <<
            RippleAddress::createHumanAccountID (secondAccount) << " and " <<
            RippleAddress::createHumanAccountID (thirdAccount);

        terStatus = terNO_RIPPLE;
    }
}
开发者ID:Payshare,项目名称:stellard,代码行数:34,代码来源:PathState.cpp

示例8: checkFreeze

/** Check if an expanded path violates freeze rules */
void PathState::checkFreeze()
{
    assert (nodes_.size() >= 2);

    // A path with no intermediaries -- pure issue/redeem
    // cannot be frozen.
    if (nodes_.size() == 2)
        return;

    SLE::pointer sle;

    for (std::size_t i = 0; i < (nodes_.size() - 1); ++i)
    {
        // Check each order book for a global freeze
        if (nodes_[i].uFlags & STPathElement::typeIssuer)
        {
            sle = view().peek (keylet::account(nodes_[i].issue_.account));

            if (sle && sle->isFlag (lsfGlobalFreeze))
            {
                terStatus = terNO_LINE;
                return;
            }
        }

        // Check each account change to make sure funds can leave
        if (nodes_[i].uFlags & STPathElement::typeAccount)
        {
            Currency const& currencyID = nodes_[i].issue_.currency;
            AccountID const& inAccount = nodes_[i].account_;
            AccountID const& outAccount = nodes_[i+1].account_;

            if (inAccount != outAccount)
            {
                sle = view().peek (keylet::account(outAccount));

                if (sle && sle->isFlag (lsfGlobalFreeze))
                {
                    terStatus = terNO_LINE;
                    return;
                }

                sle = view().peek (keylet::line(inAccount,
                        outAccount, currencyID));

                if (sle && sle->isFlag (
                    (outAccount > inAccount) ? lsfHighFreeze : lsfLowFreeze))
                {
                    terStatus = terNO_LINE;
                    return;
                }
            }
        }
    }
}
开发者ID:alexandrev,项目名称:rippled,代码行数:56,代码来源:PathState.cpp

示例9: assert

ter
createoffer::checkacceptasset(issueref issue) const
{
    /* only valid for custom currencies */
    assert (!isxrp (issue.currency));
    assert (!isvbc (issue.currency));

    sle::pointer const issueraccount = mengine->entrycache (
        ltaccount_root, getaccountrootindex (issue.account));

    if (!issueraccount)
    {
        if (m_journal.warning) m_journal.warning <<
            "delay: can't receive ious from non-existent issuer: " <<
            to_string (issue.account);

        return (mparams & tapretry)
            ? terno_account
            : tecno_issuer;
    }

    if (issueraccount->getfieldu32 (sfflags) & lsfrequireauth)
    {
        sle::pointer const trustline (mengine->entrycache (
            ltripple_state, getripplestateindex (
                mtxnaccountid, issue.account, issue.currency)));

        if (!trustline)
        {
            return (mparams & tapretry)
                ? terno_line
                : tecno_line;
        }

        // entries have a canonical representation, determined by a
        // lexicographical "greater than" comparison employing strict weak
        // ordering. determine which entry we need to access.
        bool const canonical_gt (mtxnaccountid > issue.account);

        bool const is_authorized (trustline->getfieldu32 (sfflags) &
            (canonical_gt ? lsflowauth : lsfhighauth));

        if (!is_authorized)
        {
            if (m_journal.debug) m_journal.debug <<
                "delay: can't receive ious from issuer without auth.";

            return (mparams & tapretry)
                ? terno_auth
                : tecno_auth;
        }
    }

    return tessuccess;
}
开发者ID:moorecoin,项目名称:MooreCoinService,代码行数:55,代码来源:CreateOffer.cpp

示例10: canonical_gt

TER
CreateOffer::checkAcceptAsset(IssueRef issue) const
{
    /* Only valid for custom currencies */
    assert (!isXRP (issue.currency));

    SLE::pointer const issuerAccount = mEngine->entryCache (
        ltACCOUNT_ROOT, Ledger::getAccountRootIndex (issue.account));

    if (!issuerAccount)
    {
        if (m_journal.warning) m_journal.warning <<
            "delay: can't receive IOUs from non-existent issuer: " <<
            to_string (issue.account);

        return (mParams & tapRETRY)
            ? terNO_ACCOUNT
            : tecNO_ISSUER;
    }

    if (issuerAccount->getFieldU32 (sfFlags) & lsfRequireAuth)
    {
        SLE::pointer const trustLine (mEngine->entryCache (
            ltRIPPLE_STATE, Ledger::getRippleStateIndex (
                mTxnAccountID, issue.account, issue.currency)));

        if (!trustLine)
        {
            return (mParams & tapRETRY)
                ? terNO_LINE
                : tecNO_LINE;
        }

        // Entries have a canonical representation, determined by a
        // lexicographical "greater than" comparison employing strict weak
        // ordering. Determine which entry we need to access.
        bool const canonical_gt (mTxnAccountID > issue.account);

        bool const is_authorized (trustLine->getFieldU32 (sfFlags) &
            (canonical_gt ? lsfLowAuth : lsfHighAuth));

        if (!is_authorized)
        {
            if (m_journal.debug) m_journal.debug <<
                "delay: can't receive IOUs from issuer without auth.";

            return (mParams & tapRETRY)
                ? terNO_AUTH
                : tecNO_AUTH;
        }
    }

    return tesSUCCESS;
}
开发者ID:CCJY,项目名称:rippled,代码行数:54,代码来源:CreateOffer.cpp

示例11: fillItems

void AccountItems::fillItems (const uint160& accountID, Ledger::ref ledger)
{
    uint256 const rootIndex = Ledger::getOwnerDirIndex (accountID);
    uint256 currentIndex    = rootIndex;

    // VFALCO TODO Rewrite all infinite loops to have clear terminating
    //             conditions defined in one location.
    //
    while (1)
    {
        SLE::pointer ownerDir   = ledger->getDirNode (currentIndex);

        // VFALCO TODO Rewrite to not return from the middle of the function
        if (!ownerDir)
            return;

        BOOST_FOREACH (uint256 const & uNode, ownerDir->getFieldV256 (sfIndexes).peekValue ())
        {
            // VFALCO TODO rename getSLEi() to something legible.
            SLE::pointer sleCur = ledger->getSLEi (uNode);

            if (!sleCur)
            {
                // item in directory not in ledger
            }
            else
            {
                AccountItem::pointer item = mOfType->makeItem (accountID, sleCur);

                // VFALCO NOTE Under what conditions would makeItem() return nullptr?
                // DJS NOTE If the item wasn't one this particular AccountItems was interested in
                // (For example, if the owner is only interested in ripple lines and this is an offer)
                if (item)
                {
                    mItems.push_back (item);
                }
            }
        }

        std::uint64_t uNodeNext    = ownerDir->getFieldU64 (sfIndexNext);

        // VFALCO TODO Rewrite to not return from the middle of the function
        if (!uNodeNext)
            return;

        currentIndex = Ledger::getDirNodeIndex (rootIndex, uNodeNext);
    }
}
开发者ID:BattleProgrammer,项目名称:stellard,代码行数:48,代码来源:AccountItems.cpp

示例12: removeSignersFromLedger

TER
SetSignerList::destroySignerList ()
{
    auto const accountKeylet = keylet::account (account_);
    // Destroying the signer list is only allowed if either the master key
    // is enabled or there is a regular key.
    SLE::pointer ledgerEntry = view().peek (accountKeylet);
    if ((ledgerEntry->isFlag (lsfDisableMaster)) &&
        (!ledgerEntry->isFieldPresent (sfRegularKey)))
            return tecNO_ALTERNATIVE_KEY;

    auto const ownerDirKeylet = keylet::ownerDir (account_);
    auto const signerListKeylet = keylet::signers (account_);
    return removeSignersFromLedger(
        accountKeylet, ownerDirKeylet, signerListKeylet);
}
开发者ID:E-LLP,项目名称:rippled,代码行数:16,代码来源:SetSignerList.cpp

示例13: applyFee

TER Change::applyFee ()
{

    SLE::pointer feeObject = mEngine->entryCache (
        ltFEE_SETTINGS, Ledger::getLedgerFeeIndex ());

    if (!feeObject)
        feeObject = mEngine->entryCreate (
            ltFEE_SETTINGS, Ledger::getLedgerFeeIndex ());

    m_journal.trace << 
        "Previous fee object: " << feeObject->getJson (0);

    feeObject->setFieldU64 (
        sfBaseFee, mTxn.getFieldU64 (sfBaseFee));
    feeObject->setFieldU32 (
        sfReferenceFeeUnits, mTxn.getFieldU32 (sfReferenceFeeUnits));
    feeObject->setFieldU32 (
        sfReserveBase, mTxn.getFieldU32 (sfReserveBase));
    feeObject->setFieldU32 (
        sfReserveIncrement, mTxn.getFieldU32 (sfReserveIncrement));

    mEngine->entryModify (feeObject);

    m_journal.trace << 
        "New fee object: " << feeObject->getJson (0);
    m_journal.warning << "Fees have been changed";
    return tesSUCCESS;
}
开发者ID:CCJY,项目名称:rippled,代码行数:29,代码来源:Change.cpp

示例14: fillItems

void AccountItems::fillItems (Account const& accountID, Ledger::ref ledger)
{
    uint256 const rootIndex = Ledger::getOwnerDirIndex (accountID);
    uint256 currentIndex    = rootIndex;

    // VFALCO TODO Rewrite all infinite loops to have clear terminating
    //             conditions defined in one location.
    //
    while (1)
    {
        SLE::pointer ownerDir   = ledger->getDirNode (currentIndex);

        // VFALCO TODO Rewrite to not return from the middle of the function
        if (!ownerDir)
            return;

        for (auto const& uNode: ownerDir->getFieldV256 (sfIndexes).peekValue ())
        {
            // VFALCO TODO rename getSLEi() to something legible.
            SLE::pointer sleCur = ledger->getSLEi (uNode);

            if (sleCur)
            {
                // The item in the directory is in ledger
                auto item = mOfType->makeItem (accountID, sleCur);

                // makeItem() returns nullptr if the item wasn't one this
                // particular AccountItems was interested in - for example, if
                // the owner is only interested in ripple lines and this is an
                // offer.
                if (item)
                    mItems.push_back (item);
            }
        }

        std::uint64_t uNodeNext    = ownerDir->getFieldU64 (sfIndexNext);

        if (!uNodeNext)
            return;

        currentIndex = Ledger::getDirNodeIndex (rootIndex, uNodeNext);
    }
}
开发者ID:RagnarDanneskjold,项目名称:rippled,代码行数:43,代码来源:AccountItems.cpp

示例15: checkFreeze

/** Check if an expanded path violates freeze rules */
void PathState::checkFreeze()
{
    assert(vpnNodes.size() >= 2);
    
    // A path with no intermediaries -- pure issue/redeem
    // cannot be frozen.
    if(vpnNodes.size() == 2)
        return;
       
    for(std::size_t i = 0; i < (vpnNodes.size() - 1); ++i)
    {  
        // Check each account change to make sure funds can leave
        if(vpnNodes[i].uFlags & STPathElement::typeAccount)
        {
            uint160 const& currencyID = vpnNodes[i].uCurrencyID;
            uint160 const& inAccount = vpnNodes[i].uAccountID;
       
            uint160 const& issuingAccount = vpnNodes[i+1].uAccountID;
            
            if(inAccount != issuingAccount)
            {
                SLE::pointer sle = lesEntries.entryCache(ltACCOUNT_ROOT,
                    Ledger::getAccountRootIndex(issuingAccount));
                
                if(sle && sle->isFlag(lsfRequireAuth))
                {
                    sle = lesEntries.entryCache(ltRIPPLE_STATE,
                        Ledger::getRippleStateIndex(inAccount,
                        issuingAccount, currencyID));
                
                    if(sle && !sle->isFlag(
                        (issuingAccount > inAccount) ? lsfHighAuth : lsfLowAuth))
                    {
                        terStatus = terNO_LINE;
                        return;
                    }
                    
                }
            }
        }
    }
}
开发者ID:Payshare,项目名称:stellard,代码行数:43,代码来源:PathState.cpp


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