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

C++ base类代码示例

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

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



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

示例1: transform

 //////////////////////////////////////////////////////////////////////
 // Basic operations
 self_ptr transform(const transformation& t) const {
   self_ptr new_paths(new self());
   new_paths->reserve(size());
   for (typename base::const_iterator i = begin(); i != end(); ++i)
     new_paths->push_back((*i)->transform(t));
   return new_paths;
 }
开发者ID:elaboris,项目名称:gamera,代码行数:9,代码来源:pathlist.hpp


示例2: base

/**
 * Constructor of antibodies meta-problem
 *
 * Note: This problem is not intended to be used by itself. Instead use the
 * cstrs_immune_system algorithm if you want to solve constrained problems.
 *
 * @param[in] problem base::problem to be used to set up the boundaries
 * @param[in] method method_type to used for the distance computation.
 * Two posssibililties are available: HAMMING, EUCLIDEAN.
 */
antibodies_problem::antibodies_problem(const base &problem, const algorithm::cstrs_immune_system::distance_method_type method):
	base((int)problem.get_dimension(),
		 problem.get_i_dimension(),
		 problem.get_f_dimension(),
		 0,
		 0,
		 0.),
	m_original_problem(problem.clone()),
	m_pop_antigens(),
	m_method(method)
{
	if(m_original_problem->get_c_dimension() <= 0){
		pagmo_throw(value_error,"The original problem has no constraints.");
	}

	// check that the dimension of the problem is 1
	if(m_original_problem->get_f_dimension() != 1) {
		pagmo_throw(value_error,"The original fitness dimension of the problem must be one, multi objective problems can't be handled with co-evolution meta problem.");
	}

	// encoding for hamming distance
	m_bit_encoding = 25;
	m_max_encoding_integer = int(std::pow(2., m_bit_encoding));

	set_bounds(m_original_problem->get_lb(),m_original_problem->get_ub());
}
开发者ID:YS-L,项目名称:pagmo,代码行数:36,代码来源:antibodies_problem.cpp


示例3: modify_edge

 /** pass through */ 
 void modify_edge(base* parent, edge_id_t e) {
   vertex_id_t v = g->target(e);
   locks[v].lock();  
   if (basicselector == false) {
     bool t = test_vertex(v);
     bool hasv = has_vertex(v);
     if (hasv && !t) {
       // if test fails, and we currently have the vertex, this is
       // a deletion
       vset[v] = 0;
       numv.dec();
       trigger_all_erase(v);
     } else if (!hasv && t) {
       // if test succeeds, and we currently do not have the vertex,
       // this is an insertion
       vset[v] = 1;
       numv.inc();
       trigger_all_insert(v);
     }
     if (t) trigger_all_modify_edge(e);
   }
   else {
     if (has_vertex(v)) trigger_all_modify_edge(e);
   }
   locks[v].unlock();  
 }
开发者ID:ekoontz,项目名称:graphlab,代码行数:27,代码来源:restricted_vertex_set.hpp


示例4: add_to

void unipoly::add_to(base &x, base &y)
{
	unipoly& px = x.as_unipoly();
	unipoly py;
	base a;
	INT d1, d2, d3, i;
	
	if (s_kind() != UNIPOLY) {
		cout << "unipoly::add_to() this not a unipoly\n";
		exit(1);
		}
	if (x.s_kind() != UNIPOLY) {
		cout << "unipoly::add_to() x is not a unipoly\n";
		exit(1);
		}
	d1 = degree();
	d2 = px.degree();
	d3 = MAXIMUM(d1, d2);
	
	py.m_l(d3 + 1);
	a = s_i(0);
	a.zero();
	for (i = 0; i <= d1; i++) {
		py[i] = s_i(i);
		}
	for (; i <= d3; i++) {
		py[i] = a;
		}
	for (i = 0; i <= d2; i++) {
		py[i] += px.s_i(i);
		}
	py.swap(y);
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:33,代码来源:unipoly.C


示例5: mult_to

void unipoly::mult_to(base &x, base &y)
{
	unipoly& px = x.as_unipoly();
	unipoly py;
	base a;
	INT d1, d2, d3, i, j, k;
	
	if (s_kind() != UNIPOLY) {
		cout << "unipoly::mult_to() this not a unipoly\n";
		exit(1);
		}
	if (x.s_kind() != UNIPOLY) {
		cout << "unipoly::mult_to() x is not a unipoly\n";
		exit(1);
		}
	d1 = degree();
	d2 = px.degree();
	d3 = d1 + d2;
	
	py.m_l(d3 + 1);
	a = s_i(0);
	a.zero();
	for (i = 0; i <= d3; i++) {
		py[i] = a;
		}
	for (i = 0; i <= d1; i++) {
		for (j = 0; j <= d2; j++) {
			k = i + j;
			a.mult(s_i(i), px.s_i(j));
			py[k] += a;
			}
		}
	py.swap(y);
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:34,代码来源:unipoly.C


示例6: base_meta

/**
 * Constructor using initial constrained problem
 *
 * @param[in] problem base::problem to be modified to use a constrained to
 * multi-objective handling technique.
 * @param[in] method method_type to be modified to use a single constrained
 * to multi-objective approach defined with OBJ_CSTRS, OBJ_CSTRSVIO or OBJ_EQVIO_INEQVIO
 *
 */
con2mo::con2mo(const base &problem, const method_type method):
		base_meta(
		 problem,
		 problem.get_dimension(),
		 problem.get_i_dimension(),
		 __mo_dimension__(problem, method),
		 0,
		 0,
		 std::vector<double>()),
	m_method(method)
{}
开发者ID:DinCahill,项目名称:pagmo,代码行数:20,代码来源:con2mo.cpp


示例7: copyobject_to

void hollerith::copyobject_to(base &x)
{
#ifdef HOLLERITH_COPY_VERBOSE
	cout << "in hollerith::copyobject_to()\n";
#endif
	x.freeself();
	hollerith & xx = x.change_to_hollerith();
	if (s() == NULL)
		return;
	xx.init(s());
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:11,代码来源:hollerith.C


示例8: copyobject_to

void number_partition::copyobject_to(base &x)
{
#ifdef PARTITION_COPY_VERBOSE
	cout << "number_partition::copyobject_to()\n";
	print_as_vector(cout);
#endif
	Vector::copyobject_to(x);
	x.as_number_partition().settype_number_partition();
#ifdef PARTITION_COPY_VERBOSE
	x.as_number_partition().print_as_vector(cout);
#endif
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:12,代码来源:number_partition.C


示例9: normalize

void unipoly::normalize(base &p)
{
	if (p.s_kind() != UNIPOLY) {
		cout << "unipoly::normalize() p not an UNIPOLY" << endl;
		exit(1);
		}
	unipoly p1 = p.as_unipoly();
	unipoly q, r;
	
	integral_division(p1, q, r, 0); 
	swap(r);
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:12,代码来源:unipoly.C


示例10: copyobject_to

void unipoly::copyobject_to(base &x)
{
#ifdef COPY_VERBOSE
	cout << "unipoly::copyobject_to()\n";
	print_as_vector(cout);
#endif
	Vector::copyobject_to(x);
	x.as_unipoly().settype_unipoly();
#ifdef COPY_VERBOSE
	x.as_unipoly().print_as_vector(cout);
#endif
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:12,代码来源:unipoly.C


示例11: compare_with

INT hollerith::compare_with(base &a)
{
	BYTE *p1, *p2;
	
	if (a.s_kind() != HOLLERITH) {
		cout << "hollerith::compare_with() a is not a hollerith object" << endl;
		exit(1);
		}
	p1 = s();
	p2 = a.as_hollerith().s();
	return strcmp(p1, p2);
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:12,代码来源:hollerith.C


示例12: copyobject_to

void geometry::copyobject_to(base &x)
{
#ifdef GEOMETRY_COPY_VERBOSE
	cout << "geometry::copyobject_to()\n";
	print_as_vector(cout);
#endif
	Vector::copyobject_to(x);
	x.as_geometry().settype_geometry();
#ifdef GEOMETRY_COPY_VERBOSE
	x.as_geometry().print_as_vector(cout);
#endif
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:12,代码来源:geometry.C


示例13: s_kind

void base::copyobject_to(base &x)
{
	kind k = s_kind();
	OBJECTSELF s = self;
	
	if (k != BASE) {
		cout << "error: base::copyobject_to() for object of kind " << kind_ascii(k) << endl;
		exit(1);
		}
	cout << "warning: base::copyobject_to() for object: " << *this << "\n";
	x.freeself();
	x.c_kind(k);
	x.self = s;
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:14,代码来源:base.C


示例14: clearself

base::base(const base &x)
	// copy constructor:    this := x
{
	// cout << "base::copy constructor for object: " << x << "\n";
	clearself();
#if 0
	if (x.k != x.s_virtual_kind()) {
		x.c_kind(k);
		}
#endif
	// cout << "base::copy constructor, calling copyobject_to()\n";
	const_cast<base &>(x).copyobject_to(*this);
	// cout << "base::copy constructor finished\n";
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:14,代码来源:base.C


示例15: swap

void base::swap(base &a)
{
	kind k, ka;
	OBJECTSELF s, sa;
	
	k = s_kind();
	ka = a.s_kind();
	s = self;
	sa = a.self;
	c_kind(ka);
	self = sa;
	a.c_kind(k);
	a.self = s;
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:14,代码来源:base.C


示例16: manage

	static void
	manage(any_storage& d, const any_storage& s, any_ops::op_code op)
	{
		switch(op)
		{
		case equals:
			{
				const auto p(d.access<any_storage*>());

				d.access<bool>() = get_reference(*p) == get_reference(s);
			}
			break;
		default:
			base::manage(d, s, op);
		}
	}
开发者ID:jwk000,项目名称:YSLib,代码行数:16,代码来源:any_iterator.hpp


示例17: proprietor

void Spinner::Private::Draw(const Context &context) {
  angle += 5.f;
  if (angle > 360.f) angle = 0.f;

  Canvas *canvas = context.canvas();
  int scale = context.surface()->GetScale();
  canvas->Scale(scale, scale);

  const RectF &rect = proprietor()->GetBounds();
  float radius = base::Clamp(std::min(rect.width(), rect.height()) / 2.f - 50.f,
                             50.f, 200.f);

  Paint paint;
  paint.SetAntiAlias(true);

  paint.SetColor(background);
  paint.SetStyle(Paint::Style::kStyleFill);
  canvas->DrawRect(rect, paint);

  paint.SetColor(ColorF(foreground));
  paint.SetStyle(Paint::Style::kStyleStroke);
  paint.SetStrokeWidth(6.f);

  canvas->DrawArc(RectF(rect.center_x() - radius,
                        rect.center_y() - radius,
                        rect.center_x() + radius,
                        rect.center_y() + radius),
                  angle, 300.f, false, paint);

  frame_callback.Setup(context.surface());
}
开发者ID:lineCode,项目名称:framework,代码行数:31,代码来源:spinner.cpp


示例18: make_record_iterator

 typename vector_assignment_dataset<LA>::record_iterator_type
 vector_assignment_dataset<LA>::begin() const {
   if (nrecords > 0)
     return make_record_iterator(0, &(finite_data[0]), &(vector_data[0]));
   else
     return make_record_iterator(0);
 }
开发者ID:vdeepak13,项目名称:sill,代码行数:7,代码来源:vector_assignment_dataset.hpp


示例19: main

int main(int argc, char* argv[]) {
  // Even if using just client calls, we set up a service. Client calls
  // will use the service's io_manager and use it to collect stats
  // automatically.
  ServiceManager service(8 /* num_workers */);
  HTTPService http_service(15000, &service);

  // Open and "fire" N parallel clients.
  const int parallel = 32;
  Client clients[parallel];
  for (int i=0; i<parallel; ++i) {
    ConnectCallback* connect_cb = makeCallableOnce(&Client::start, &clients[i]);
    http_service.asyncConnect("127.0.0.1", 15001, connect_cb);
  }

  // Launch a progress meter in the background. If things hang, let
  // the meter kill this process.
  ProgressMeter meter(&service);
  Callback<void>* progress_cb = makeCallableOnce(&ProgressMeter::check, &meter);
  IOManager* io_manager = service.io_manager();
  io_manager->addTimer(1.0 /*sec*/ , progress_cb);

  // We'd need a '/quit' request to break out of the server.
  // TODO have SIGINT break out nicely as well.
  service.run();

  return 0;
}
开发者ID:Matt8109,项目名称:HighPerformanceWebServer,代码行数:28,代码来源:client_async.cpp


示例20: descendFromMultiSPs

// Do gradient descend from multiple starting points
void GradientMatcher::descendFromMultiSPs() {
  printXXMatrWithScore(xx_len_);
  mul_desc_.clear();
  for (int i = 0; i < NUMOFINITDESCENDPOINTS; ++i) {
    mul_desc_.push_back(new MulDesc(n_features_));
  }
  sign_count_.clear();
  sign_count_.resize(n_features_);

  WaitAllDone* waitAllDone = new WaitAllDone();

  finishedCounter = 0;
  for (int ind = 0; ind < NUMOFINITDESCENDPOINTS; ++ind) {
    Person::randWeightsGenerator(mul_desc_[ind]->guessWArr, n_features_);

    Callback<void>* task = makeCallableOnce(&GradientMatcher::feedRandCandsResults,
        this, mul_desc_[ind], 0.001, -1, (double*)NULL);
    thr_pool_->addTask(task);
    // feedRandCandsResults(mul_desc_.back()->guessWArr);
  }
  Callback<void>* allDone = makeCallableOnce(&WaitAllDone::jobsDoneSignal,
      waitAllDone);
  thr_pool_->addTask(allDone);
  waitAllDone->wait();

  std::cerr << "-----------------------------" << "NumFinished: " << finishedCounter
    << std::endl;
  // signCountDowork(mul_desc_.back()->guessWArr, signCounter);
  printSignCounter(sign_count_);
  delete waitAllDone;
}
开发者ID:oveis,项目名称:Heuristic,代码行数:32,代码来源:gradient_matcher.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ base_stream类代码示例发布时间:2022-05-31
下一篇:
C++ baro_t类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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