• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ rf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: o

DgOutLocFile& 
DgOutGeoJSONFile::insert (DgPolygon& poly, const string* label,
   const DgLocation* cent)
{
   DgOutGeoJSONFile& o(*this);   

   rf().convert(poly);

   o << "{\"type\":\"Feature\",";
   o << "\"properties\":{";
   if (label)
      o << "\"name\":" << *label;
   o << "},";
   o << "\"geometry\":{";
   o << "\"type\":\"Polygon\",";
   o << "\"coordinates\":[[";

   vector<DgAddressBase *>& v = poly.addressVec();
   for(vector<DgAddressBase *>::iterator i = v.begin(); v.end() != i; ++i)
   {
         o.insert(rf().getVecAddress(*(*i)));
         o << ",";
   }

   // rewrite first vertex:
   o.insert(rf().getVecAddress(*v[0]));

   o << "]]}},";
   o.flush();

   return *this;
}
开发者ID:cran,项目名称:dggridR,代码行数:32,代码来源:DgOutGeoJSONFile.cpp


示例2: test1

static int
test1(gs_state * pgs, gs_memory_t * mem)
{
    int n;

    gs_scale(pgs, 72.0, 72.0);
    gs_translate(pgs, 4.25, 5.5);
    gs_scale(pgs, 4.0, 4.0);
    gs_newpath(pgs);
    for (n = 200; --n >= 0;) {
        int j;

#define rf() (rand() / (1.0 * 0x10000 * 0x8000))
        double r = rf(), g = rf(), b = rf();
        double x0 = rf(), y0 = rf(), x1 = rf(), y1 = rf(), x2 = rf(), y2 = rf();

        gs_setrgbcolor(pgs, r, g, b);
        for (j = 0; j < 6; j++) {
            gs_gsave(pgs);
            gs_rotate(pgs, 60.0 * j);
            gs_moveto(pgs, x0, y0);
            gs_lineto(pgs, x1, y1);
            gs_lineto(pgs, x2, y2);
            gs_fill(pgs);
            gs_grestore(pgs);
        }
    }
#undef mem
    return 0;
}
开发者ID:BorodaZizitopa,项目名称:ghostscript,代码行数:30,代码来源:gslib.c


示例3: rf

int daFakeStarCoin::onCreate() {

	allocator.link(-1, GameHeaps[0], 0, 0x20);

	nw4r::g3d::ResFile rf(getResource("star_coin", "g3d/star_coin.brres"));
	bodyModel.setup(rf.GetResMdl("star_coinA"), &allocator, 0x224, 1, 0);
	SetupTextures_MapObj(&bodyModel, 0);

	allocator.unlink();

	ActivePhysics::Info HitMeBaby;
	HitMeBaby.xDistToCenter = 0.0;
	HitMeBaby.yDistToCenter = -3.0;
	HitMeBaby.xDistToEdge = 12.0;
	HitMeBaby.yDistToEdge = 15.0;
	HitMeBaby.category1 = 0x5;
	HitMeBaby.category2 = 0x0;
	HitMeBaby.bitfield1 = 0x4F;
	HitMeBaby.bitfield2 = 0xFFFFFFFF;
	HitMeBaby.unkShort1C = 0;
	HitMeBaby.callback = &dEn_c::collisionCallback;

	this->aPhysics.initWithStruct(this, &HitMeBaby);
	this->aPhysics.addToList();

	this->scale.x = 1.0;
	this->scale.y = 1.0;
	this->scale.z = 1.0;

	this->pos.x -= 120.0;
	this->pos.z = 3300.0;

	this->onExecute();
	return true;
}
开发者ID:InfosHack,项目名称:NewerSMBW,代码行数:35,代码来源:fakeStarCoin.cpp


示例4: rf

// load biterm topic assignments output by training precess
// each line is a doc, format:w1-w2:topic_w1-topic_w2 ...
// set topic recorder _nwz and _nw_z
void Infer::load_model() {
  ostringstream ss;
  ss << "dbz.k" << K;
  string pt = train_dir + ss.str();
  
  cout << "->load dbz from:" << pt << endl;
  ifstream rf( pt.c_str() );
  if (!rf) {
	EXIT_ERR("file not find:", pt.c_str());
  }

  string line;
  while(getline(rf, line)) {
	// read a doc
    istringstream iss(line);
	
	int w1, w2, k1, k2;
	char c1, c2, c3;
    while (iss >> w1 >> c1 >> w2 >> c2 >> k1 >> c3 >> k2) {
		// allocacte _nwz
	  while (_nwz.size() < w2+1) {
		vector<int> tmp(K);
		_nwz.push_back(tmp);
	  }
	  assert(k1 < K && k2 < K);
	  _nwz[w1][k1]++;
	  _nw_z[k1]++;
	  _nwz[w2][k2]++;
	  _nw_z[k2]++;
	}
  }

  printf("M=%d\n", _nwz.size());
}
开发者ID:ylqfp,项目名称:tmrf,代码行数:37,代码来源:infer.cpp


示例5: p

void MessageOverlay::paintEvent(QPaintEvent *)
{
    QPainter p(this);
    QRect r(rect());
    QRectF rf(r.x()+0.5, r.y()+0.5, r.width()-1, r.height()-1);
    QColor borderCol=palette().color(QPalette::Highlight).darker(120);
    QColor col=palette().color(QPalette::Window);
    QPainterPath path=Utils::buildPath(rf, r.height()/4.0);
    col.setAlphaF(0.8);
    p.setRenderHint(QPainter::Antialiasing, true);
    p.fillPath(path, col);
    p.setPen(QPen(borderCol, qMax(2, r.height()/16)));
    p.drawPath(path);

    int pad=r.height()/4;
    if (cancelButton->isVisible()) {
        if (Qt::LeftToRight==layoutDirection() && !closeOnLeft) {
            rf.adjust(pad, pad, -((pad*2)+cancelButton->width()), -pad);
        } else {
            rf.adjust(((pad*2)+cancelButton->width()), pad, -pad, -pad);
        }
    } else {
        rf.adjust(pad, pad, -pad, -pad);
    }
    QFont fnt(QApplication::font());
    fnt.setBold(true);
    QFontMetrics fm(fnt);
    col=palette().color(QPalette::WindowText);

    p.setPen(col);
    p.setFont(fnt);
    p.drawText(rf, fm.elidedText(text, Qt::ElideRight, r.width(), QPalette::WindowText), QTextOption(Qt::LeftToRight==layoutDirection() ? Qt::AlignLeft : Qt::AlignRight));
    p.end();
}
开发者ID:BinChengfei,项目名称:cantata,代码行数:34,代码来源:messageoverlay.cpp


示例6: rf

char rf(const char* str, char current){
  if(*str=='\0')
    return current;
  if(*str=='@')
    current = *(str+1);
  return rf(str+1, current);
}
开发者ID:atommed,项目名称:OP_repo,代码行数:7,代码来源:main.c


示例7: linux

/*!
  \internal
  Read some random bytes into \a keybuf.

  If on linux (ie read embedded) the os MUST have /dev/[u]random
  available.
  */
void KeyFiler::randomizeKey( char keybuf[] )
{
    qint64 rc;
    QFile rf( RAND_DEV );
    if ( !rf.open( QIODevice::ReadOnly ))
    {
        time_t curTime = time(0);
        perror( "open " RAND_DEV );
#if defined(Q_OS_LINUX) || defined(_OS_LINUX_)
        qFatal( "Safe execution requires " RAND_DEV );
#endif
        qWarning( "Warning: Using inferior random numbers!" );
        srandom(curTime);  // this is very crappy
        long int r;
        for ( int i = 0; i < QSXE_KEY_LEN; i++ )
        {
            r = random();
            keybuf[i] = (char)r;
        }
    }
    else
    {
        rc = rf.read( keybuf, QSXE_KEY_LEN );
        rf.close();
        if ( rc != QSXE_KEY_LEN )
            qFatal( "read %s: %s", RAND_DEV, strerror(errno) );
    }
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:35,代码来源:keyfiler.cpp


示例8: r

void Label::OnDraw(Graphics *g) 
{
	if (_bmp == NULL)
		return;

	Rect r(_x, _y, _w, _h);
	g->DrawImage(_bmp, r, 0, 0, _w, _h, UnitPixel);	


	wstring wtext;	
	wtext.assign(_text.begin(), _text.end());

	SolidBrush b(_font_color);

	wstring wffname;
	wffname.assign(_font_family.begin(), _font_family.end());
	FontFamily ff(wffname.c_str());

	StringFormat sf(0, LANG_NEUTRAL);
	sf.SetLineAlignment(Gdiplus::StringAlignmentCenter);

	if (_align == TEXT_ALIGN_LEFT)
		sf.SetAlignment(Gdiplus::StringAlignmentNear);
	else if (_align == TEXT_ALIGN_CENTER)
		sf.SetAlignment(Gdiplus::StringAlignmentCenter);
	else if (_align == TEXT_ALIGN_RIGHT)
		sf.SetAlignment(Gdiplus::StringAlignmentFar);

	RectF rf(_x, _y, _w, _h);
	Font font(&ff, _font_size, Gdiplus::FontStyleRegular, UnitPixel);
	g->DrawString(wtext.c_str(), wtext.length(), &font, rf, &sf, &b);

}
开发者ID:beatwise,项目名称:wisegui-library,代码行数:33,代码来源:label.cpp


示例9: rf

int LogisticRegression::gradientAscent() {
	long double* deviations = new long double[sampleNum];
	int iterations = 0;
	do {
		++iterations;

		/*
		 * How to handle the case that 'z' is either too big or too small???
		 */
		// calculate deviations for all samples, one per sample.
		for(int i = 0; i < sampleNum; ++i)
			deviations[i] = categories[i] - rf(trainingSamples.getSample(i), 
				parameters, featureNum);

		// adjust parameters
		for(int j = 0; j < featureNum; ++j) {
			long double factor = 0.0;
			for(int i = 0; i < sampleNum; ++i) 
				factor +=  trainingSamples.getSample(i)[j] * deviations[i];
			parameters[j] += alpha * factor;
		}
	} while(convergent(deviations, categoryRange) == false);
	delete[] deviations;

	return iterations;
}
开发者ID:JackieXie168,项目名称:machine_learning,代码行数:26,代码来源:LogisticRegression.cpp


示例10: stylesheets_upgrade

void stylesheets_upgrade()
// Upgrade older stylesheets to the currently used format.
{
  // Make the \r marker a section heading instead of a normal paragraph.
  {
    ReadFiles rf(Directories->get_stylesheets(), "", ".xml1");
    for (unsigned int i = 0; i < rf.files.size(); i++) {
      ustring filename = gw_build_filename(Directories->get_stylesheets(), rf.files[i]);
      gw_message(_("Updating stylesheet: ") + filename);
      ReadText rt (filename, true, false);
      stylesheet_upgrade_value (rt.lines, "r", "subtype", "2");
      unix_unlink (filename.c_str());
      ustring newfilename(filename);
      newfilename.replace(newfilename.length() - 1, 1, "2");
      write_lines (newfilename, rt.lines);
    }
  }

  // Note: The stylesheet.xml template has been updated thus far.
  // Every update listed below still needs to be entered into the template.

  // At the end of everything, check that we have at least one stylesheet.  
  {
    vector < ustring > stylesheets;
    stylesheet_get_ones_available(stylesheets);
    if (stylesheets.size() == 0) {
      stylesheet_create_new(STANDARDSHEET, stFull);
    }
  }
}
开发者ID:postiffm,项目名称:bibledit-gtk,代码行数:30,代码来源:stylesheetutils.cpp


示例11: rf

int rf(int x)
{
	int temp = two(x) ;
	if ( temp == 1)
		return (x + 1);
	return rf( x + (1 << (temp - 1)));
}
开发者ID:suikay,项目名称:acm,代码行数:7,代码来源:4368731_TLE.cpp


示例12: rf

void MaxCutHyperheuristic::UpdateBestModel(std::string code, Prob problem,
                                           const std::vector<double>& metrics,
                                           double* bestProbability,
                                           Prob* bestProblem,
                                           std::string* bestCode,
                                           int* numBest) {
  std::ostringstream fname;
  fname << "hhdata/" << code << ".rf";
  std::string filename = fname.str();
  if (FileExists(filename)) {
    RandomForest rf(filename);
    double probability = rf.Predict(metrics);
    if (probability > *bestProbability) {
      // New best
      *bestProbability = probability;
      *bestProblem = problem;
      *bestCode = code;
      *numBest = 1;
    } else if (probability == *bestProbability &&
               Random::RandInt(0, *numBest) == *numBest) {
      // Tied the best and selected by streaming algorithm
      *bestProblem = problem;
      *bestCode = code;
      ++(*numBest);
    }
  }
}
开发者ID:MQLib,项目名称:MQLib,代码行数:27,代码来源:hyperheuristic.cpp


示例13: Mine_LoadLibraryExW

/// Mine entry point for intercepted function
/// \param lpLibFileName Library file name
/// \param hFile File handle
/// \param dwFlags load flags
/// \return Loaded module.
static HMODULE WINAPI Mine_LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
{
    RefTracker rf(&s_dwInsideLoadLibrary);

    if (s_dwInsideLoadLibrary == 1)
    {
        LogTrace(traceENTER, "lpLibFilename = %S, hFile = %p, dwFlags = %d", lpLibFileName, hFile, dwFlags);
    }

    HMODULE res = Real_LoadLibraryExW(lpLibFileName, hFile, dwFlags);
    DWORD realError = GetLastError();

    if (my_lstrcmpW(lpLibFileName, L"comctl32.dll") != 0)
    {
        // This function uses MessageBox - which will load comctl32.dll if necessary
        // To avoid recursion problems, only call it when a different DLL is being loaded.
        CheckForDebuggerAttach();
    }

    if (s_dwInsideLoadLibrary == 1)
    {
        CheckWrappers();
        LogTrace(traceEXIT, "returned 0x%p", res);
    }

    SetLastError(realError);
    return res;
}
开发者ID:StephenThomasUWTSD,项目名称:CodeXL,代码行数:33,代码来源:LoadLibrary.cpp


示例14: main

int main(int argc, char* argv[])
{

  DCapp app(dn, ".dita", ".ditamap");

  app.Init(argc, argv);

  if (!app.Proc(D2M::SwitchList)) {
    fprintf(stderr, "usage: %s [-v] [-t \"Map Title\"] [-d \"D:\\path\\to\\DTDs\"]"
			"\n        [-i inifile.ini] [-o mapfile.ditamap] topicfile.dita\n", argv[0]);
    exit(dc_err_arg);
  }

  D2M::Verbose = app.verbose();

  XMLrfile rf(D2M::TopicFileName = app.rfile());
  if (rf.FErr() != fok)
    rf.Err();
	else
		D2M::TopicFile = &rf;

  HTMwfile wf(D2M::MapFileName = app.wfile());
  if (wf.FErr() != fok)
    wf.Err();
	else
		D2M::MapFile = &wf;

	// look in current directory for correct ini file
	DCirfile *inif = new DCirfile(D2M::IniFileName);

	if (inif->FErr() != fok) {
		delete inif;
		inif = new DCirfile("xml2htm.ini");
	}

	if (inif->FErr() != fok) {
		delete inif;
		inif = new DCirfile("xml2rtf.ini");
	}

	if ((inif->FErr() != fok)
	 && strcmp(D2M::IniFileName, "dita2map.ini")) {
		delete inif;
		inif = new DCirfile("dita2map.ini");
	}

	if (inif->FErr() == fok)
		D2M::IniFile = inif;  // make accessible everywhere

	D2M::InitCurrProps(); // set up vars per ini file


	D2M::ProcessTopic();

  rf.CloseFile();
  wf.CloseFile();
  wf.Err();      // if error, exits with the err (and a message)
  return dc_ok;  // so if we get here, it worked
}
开发者ID:omsys-dev,项目名称:original-source,代码行数:59,代码来源:DITA2map.cpp


示例15: ellf

float ellf(float phi, float ak)
{
	float rf(float x, float y, float z);
	float s;

	s=sin(phi);
	return s*rf(SQR(cos(phi)),(1.0-s*ak)*(1.0+s*ak),1.0);
}
开发者ID:bamford,项目名称:astrobamf,代码行数:8,代码来源:ellf.c


示例16: proc_read

static size_t      proc_read(    struct uufile *f, void *dest, size_t bytes)
{
    size_t (*rf)( struct uufile *f, void *dest, size_t bytes) = f->impl;

    if(rf == 0)
        return -1;

    return rf( f, dest, bytes);
}
开发者ID:animotron,项目名称:animos,代码行数:9,代码来源:fs_proc.c


示例17: int

void *loadall(struct arreader *a, int (*rf)( void *data, int len ), int size )
{
    char *ret = calloc( size+1, 1 );
    if( ret == 0 || size != rf( ret, size ) )
        die( a, "can't loadall");

    //printf("/=\n'%.*s'\n", size, ret );
    return ret;
}
开发者ID:NoSuchProcess,项目名称:phantomuserland,代码行数:9,代码来源:arlib.c


示例18: provenance

ErrorList::Provenance::Provenance( const String &src, int off, std::string msg ) : provenance( src ), msg( msg ) {
    if ( src.size() and off >= 0 ) {
        ReadFile rf( src.c_str() );
        _init( rf.data, rf.data + off );
    } else {
        line = -1;
        col  = -1;
    }
}
开发者ID:hleclerc,项目名称:Stela,代码行数:9,代码来源:ErrorList.cpp


示例19: resource_get_resources

vector < ustring > resource_get_resources(vector < ustring > &filenames, bool list_deleted_ones)
{
  // Storage.
  vector < ustring > resources;
  filenames.clear();

  // Read the user's templates.
  ReadDirectories rd(Directories->get_resources(), "", "");
  for (unsigned int i = 0; i < rd.directories.size(); i++) {
    ustring filename = gw_build_filename(Directories->get_resources(), rd.directories[i], resource_template_ini ());
    if (g_file_test(filename.c_str(), G_FILE_TEST_IS_REGULAR)) {
      filenames.push_back(filename);
      resources.push_back(resource_get_title(filename));
    }
  }

  // Make a list of "deleted" resources and add to it the unwanted ones.
  // Add the user's resources to these too in order that the user's resources
  // override any templates named the same.
  ustring deleted_filename;
  if (!list_deleted_ones)
    deleted_filename = gw_build_filename(Directories->get_resources(), "deleted");
  ReadText rt(deleted_filename, true, true);
  set < ustring > unwanted_ones(rt.lines.begin(), rt.lines.end());
  for (unsigned int i = 0; i < resources.size(); i++) {
    unwanted_ones.insert(resources[i]);
  }

  // Add some standard templates to the "deleted" resource. Reason:
  // Some standard templates have been added that come with Bibledit.
  // These templates reference material that is not available by default,
  // but requires user action to install that. To facilitate easy creation
  // if these resources by the user, some templates have been added. These
  // templates are not for display, but only to base a new template upon.
  // Therefore these templates should not normally be visible, only when used
  // to create a new resource based upon these.
  if (!list_deleted_ones) {
    unwanted_ones.insert("NetBible");
  }
  // Read the templates that come with Bibledit.
  ReadFiles rf(Directories->get_package_data(), "resource", ".ini");
  for (unsigned int i = 0; i < rf.files.size(); i++) {
    ustring filename = gw_build_filename(Directories->get_package_data(), rf.files[i]);
    ustring title = resource_get_title(filename);
    if (unwanted_ones.find(title) != unwanted_ones.end())
      continue;
    filenames.push_back(filename);
    resources.push_back(title);
  }

  // Sort them.
  quick_sort(resources, filenames, 0, resources.size());

  // Give resources.
  return resources;
}
开发者ID:postiffm,项目名称:bibledit-gtk,代码行数:56,代码来源:resource_utils.cpp


示例20: rf

QDebug Q_GUI_EXPORT &operator<<(QDebug &s, const QVectorPath &path)
{
    QRealRect vectorPathBounds = path.controlPointRect();
    QRectF rf(vectorPathBounds.x1, vectorPathBounds.y1,
              vectorPathBounds.x2 - vectorPathBounds.x1, vectorPathBounds.y2 - vectorPathBounds.y1);
    s << "QVectorPath(size:" << path.elementCount()
      << " hints:" << hex << path.hints()
      << rf << ")";
    return s;
}
开发者ID:Fale,项目名称:qtmoko,代码行数:10,代码来源:qpaintengineex.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rf_has函数代码示例发布时间:2022-05-30
下一篇:
C++ rewinddir函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap