void EnumDataKey(int nTabLevel, ISpDataKey *pSpDataKey) {
    HRESULT hr = S_OK;
    
    // enumerate subkeys recursively
    for (ULONG k = 0; ; k++) {
        LPWSTR key = nullptr;
        hr = pSpDataKey->EnumKeys(k, &key);
        if (SPERR_NO_MORE_ITEMS == hr) {
            // done
            break;
        } else if (FAILED(hr)) {
            ERR(L"ISpDataKey::EnumKeys failed: hr = 0x%08x", hr);
            continue;
        }
        CoTaskMemFreeOnExit fKey(key);
        
        Tab(nTabLevel);
        LOG(L"%s", key);
        
        ISpDataKey *pSubKey = nullptr;
        hr = pSpDataKey->OpenKey(key, &pSubKey);
        if (FAILED(hr)) {
            ERR(L"ISpDataKey::OpenKeys failed: hr = 0x%08x", hr);
            continue;
        }
        ReleaseOnExit rSubKey(pSubKey);
        
        EnumDataKey(nTabLevel + 1, pSubKey);
    }
    
    // enumerate values
    for (ULONG v = 0; ; v++) {
        LPWSTR val = nullptr;
        hr = pSpDataKey->EnumValues(v, &val);
        if (SPERR_NO_MORE_ITEMS == hr) {
            // done
            break;
        } else if (FAILED(hr)) {
            ERR(L"ISpDataKey::EnumKeys failed: hr = 0x%08x", hr);
            continue;
        }
        CoTaskMemFreeOnExit fVal(val);
        
        // how do we know whether it's a string or a DWORD?
        LPWSTR data = nullptr;
        hr = pSpDataKey->GetStringValue(val, &data);
        if (FAILED(hr)) {
            ERR(L"ISpDataKey::GetStringValue failed: hr = 0x%08x", hr);
            continue;
        }
        CoTaskMemFreeOnExit fData(data);
        
        Tab(nTabLevel);
        if (0 == wcscmp(val, L"")) {
            LOG(L"(default) = %s", data);
        } else {
            LOG(L"%s = %s", val, data);
        }
    }
}
Пример #2
0
/** 
 * Evaluate the variational implicit surface.  This is the
 * Interval version of proc.
 * @param b The Box3d region over which to evaluate the function.
 */
Intervald InterfaceRBF::proc(const Box<double>&  b) 
{
  Intervald fVal(0.0);
  
  for (unsigned int i = 0; i < centers.size(); i++)
    fVal += Intervald(centers[i].w) * _phiFunction->phi(Box3d(b - Box3d(centers[i].c)));

  fVal += Intervald(m_p[3]) * b[2];
  fVal += Intervald(m_p[2]) * b[1];
  fVal += Intervald(m_p[1]) * b[0];
  fVal += Intervald(m_p[0]);

  return fVal; 
};
Пример #3
0
  /** \brief Check whether the token at a given position is a value token.

    Value tokens are either values or constants.

    \param a_Tok [out] If a value token is found it will be placed here.
    \return true if a value token has been found.
  */
  bool ParserTokenReader::IsValTok(token_type &a_Tok)
  {
    assert(m_pConstDef);
    assert(m_pParser);

    string_type strTok;
    value_type fVal(0);
    int iEnd(0);
    
    // 2.) Check for user defined constant
    // Read everything that could be a constant name
    iEnd = ExtractToken(m_pParser->ValidNameChars(), strTok, m_iPos);
    if (iEnd!=m_iPos)
    {
      valmap_type::const_iterator item = m_pConstDef->find(strTok);
      if (item!=m_pConstDef->end())
      {
        m_iPos = iEnd;
        a_Tok.SetVal(item->second, strTok);

        if (m_iSynFlags & noVAL)
          Error(ecUNEXPECTED_VAL, m_iPos - (int)strTok.length(), strTok);

        m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN; 
        return true;
      }
    }

    // 3.call the value recognition functions provided by the user
    // Call user defined value recognition functions
    std::list<identfun_type>::const_iterator item = m_vIdentFun.begin();
    for (item = m_vIdentFun.begin(); item!=m_vIdentFun.end(); ++item)
    {
      int iStart = m_iPos;
      if ( (*item)(m_strFormula.c_str() + m_iPos, &m_iPos, &fVal)==1 )
      {
        strTok.assign(m_strFormula.c_str(), iStart, m_iPos);
        if (m_iSynFlags & noVAL)
          Error(ecUNEXPECTED_VAL, m_iPos - (int)strTok.length(), strTok);

        a_Tok.SetVal(fVal, strTok);
        m_iSynFlags = noVAL | noVAR | noFUN | noBO | noINFIXOP | noSTR | noASSIGN;
        return true;
      }
    }

    return false;
  }