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


C++ pa函数代码示例

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


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

示例1: pa

HttpPostSocket::HttpPostSocket(SocketHandler& h,const std::string& url)
:HTTPSocket(h)
,m_port(80)
,m_bMultipart(false)
{
	std::string host;
	{
		Parse pa(url,"/");
		pa.getword(); // 'http:'
		host = pa.getword();
		SetUrl( "/" + pa.getrest() );
	}
	{
		Parse pa(host,":");
		m_host = pa.getword();
		m_port = (port_t)pa.getvalue();
		if (!m_port)
		{
			m_port = 80;
		}
	}
	std::string m_boundary = "----";
	for (int i = 0; i < 12; i++)
	{
		char c = 0;
		while (!isalnum(c))
		{
			c = rand() % 96 + 32;
		}
		m_boundary += c;
	}
}
开发者ID:vata,项目名称:prebcwow,代码行数:32,代码来源:HttpPostSocket.cpp

示例2: pa

    CObject *Evaluate(const CObject_Vector &jj)
    {
      if (p_v->V()->id.back()==0) {
	const CVec4Type &a(*jj[0]->Get<CVec4Type>());
	const CVec4Type &b(*jj[1]->Get<CVec4Type>());
	CVec4Type pa(p_v->J(0)->P()), pb(p_v->J(1)->P());
	CScalarType *j(CScalarType::New(-(a*b)*(pa*pb)+(a*pb)*(b*pa)));
	j->SetS(a.S()|b.S());
	return j;
      }
      if (p_v->V()->id.back()==2) {
	const CScalarType &a(*jj[0]->Get<CScalarType>());
	const CVec4Type &b(*jj[1]->Get<CVec4Type>());
	CVec4Type pa(p_v->J(0)->P()), pb(p_v->J(1)->P());
	CVec4Type s(b*(pb*(pa+pb))-(b*(pa+pb))*pb);
	CVec4Type *j(CVec4Type::New(s*a[0]));
	j->SetS(a.S()|b.S());
	return j;
      }
      if (p_v->V()->id.back()==1) {
	const CScalarType &a(*jj[1]->Get<CScalarType>());
	const CVec4Type &b(*jj[0]->Get<CVec4Type>());
	CVec4Type pa(p_v->J(1)->P()), pb(p_v->J(0)->P());
	CVec4Type s(b*(pb*(pa+pb))-(b*(pa+pb))*pb);
	CVec4Type *j(CVec4Type::New(s*a[0]));
	j->SetS(a.S()|b.S());
	return j;
      }
    }
开发者ID:thuer,项目名称:sherpa,代码行数:29,代码来源:SVV_LC.C

示例3: pa

void HTTPSocket::url_this(const std::string& url_in,std::string& protocol,std::string& host,port_t& port,std::string& url,std::string& file)
{
	Parse pa(url_in,"/");
	protocol = pa.getword(); // http
	if (!strcasecmp(protocol.c_str(), "https:"))
	{
#ifdef HAVE_OPENSSL
		EnableSSL();
#else
		Handler().LogError(this, "url_this", -1, "SSL not available", LOG_LEVEL_WARNING);
#endif
		port = 443;
	}
	else
	{
		port = 80;
	}
	host = pa.getword();
	if (strstr(host.c_str(),":"))
	{
		Parse pa(host,":");
		pa.getword(host);
		port = static_cast<port_t>(pa.getvalue());
	}
	url = "/" + pa.getrest();
	{
		Parse pa(url,"/");
		std::string tmp = pa.getword();
		while (tmp.size())
		{
			file = tmp;
			tmp = pa.getword();
		}
	}
} // url_this
开发者ID:SnowfallIndustries,项目名称:Reality,代码行数:35,代码来源:HTTPSocket.cpp

示例4: exec

  static void exec(LHS &lhs, RHS const &rhs)
  {
    if (parallel::has_same_map<D>(lhs.map(), rhs))
    {
      // Maps are same, no communication required.
      typedef typename distributed_local_block<LHS>::type lhs_local_block_type;
      typedef typename distributed_local_block<RHS>::type rhs_local_block_type;
      typedef typename block_traits<lhs_local_block_type>::plain_type 
	lhs_local_storage_type;
      typedef typename block_traits<rhs_local_block_type>::plain_type
	rhs_local_storage_type;

      lhs_local_storage_type lhs_local_block = get_local_block(lhs);
      rhs_local_storage_type rhs_local_block = get_local_block(rhs);

      Dispatcher<D, lhs_local_block_type, rhs_local_block_type>::exec(lhs_local_block,
								      rhs_local_block);
    }
    else
    {
      lhs_view_type lhs_view(lhs);
      rhs_view_type rhs_view(const_cast<RHS&>(rhs));
      parallel::Assignment<D, LHS, RHS, Assign> pa(lhs_view, rhs_view);
      pa();
    }
  }
开发者ID:fsheikh,项目名称:openvsip,代码行数:26,代码来源:assign.hpp

示例5: pa

    CObject *Evaluate(const CObject_Vector &jj)
    {
      if (p_v->V()->id.back()==0) {
	const CVec4Type &a(*jj[0]->template Get<CVec4Type>());
	const CVec4Type &b(*jj[1]->template Get<CVec4Type>());
	const CVec4Type &c(*jj[2]->template Get<CVec4Type>()); 
	Vec4D pa(p_v->J(0)->P()), pb(p_v->J(1)->P()), pc(p_v->J(2)->P());
	CScalarType *j(CScalarType::New
		       ((a*b)*(c*(pa-pb))+
			(b*c)*(a*(pb-pc))+
			(c*a)*(b*(pc-pa))));
	j->SetS(a.S()|b.S()|c.S());
	return j;
      }
      const CVec4Type &a(*jj[m_n[1]]->template Get<CVec4Type>());
      const CVec4Type &b(*jj[m_n[2]]->template Get<CVec4Type>());
      const CScalarType &e(*jj[m_n[0]]->template Get<CScalarType>()); 
      Vec4D pa(p_v->J(m_n[1])->P()), pb(p_v->J(m_n[2])->P());
      Vec4D pe(p_v->J(m_n[0])->P());
      CVec4Type *j(CVec4Type::New
		   (e[0]*((a*b)*CVec4Type(pa-pb)
			  +(a*ATOOLS::Vec4<SType>(pb+pb+pa+pe))*b
			  -(b*ATOOLS::Vec4<SType>(pa+pa+pb+pe))*a)));
      j->SetS(a.S()|b.S()|e.S());
      return j;
    }
开发者ID:alisw,项目名称:SHERPA,代码行数:26,代码来源:SVVV_LC.C

示例6: main

int main(int, char**)
{
    {
        typedef std::piecewise_linear_distribution<> D;
        typedef D::param_type P;
        P pa({}, f);
        std::vector<double> iv = pa.intervals();
        assert(iv.size() == 2);
        assert(iv[0] == 0);
        assert(iv[1] == 1);
        std::vector<double> dn = pa.densities();
        assert(dn.size() == 2);
        assert(dn[0] == 1);
        assert(dn[1] == 1);
    }
    {
        typedef std::piecewise_linear_distribution<> D;
        typedef D::param_type P;
        P pa({12}, f);
        std::vector<double> iv = pa.intervals();
        assert(iv.size() == 2);
        assert(iv[0] == 0);
        assert(iv[1] == 1);
        std::vector<double> dn = pa.densities();
        assert(dn.size() == 2);
        assert(dn[0] == 1);
        assert(dn[1] == 1);
    }
    {
        typedef std::piecewise_linear_distribution<> D;
        typedef D::param_type P;
        P pa({10, 12}, f);
        std::vector<double> iv = pa.intervals();
        assert(iv.size() == 2);
        assert(iv[0] == 10);
        assert(iv[1] == 12);
        std::vector<double> dn = pa.densities();
        assert(dn.size() == 2);
        assert(dn[0] == 20./44);
        assert(dn[1] == 24./44);
    }
    {
        typedef std::piecewise_linear_distribution<> D;
        typedef D::param_type P;
        P pa({6, 10, 14}, f);
        std::vector<double> iv = pa.intervals();
        assert(iv.size() == 3);
        assert(iv[0] == 6);
        assert(iv[1] == 10);
        assert(iv[2] == 14);
        std::vector<double> dn = pa.densities();
        assert(dn.size() == 3);
        assert(dn[0] == 0.075);
        assert(dn[1] == 0.125);
        assert(dn[2] == 0.175);
    }

  return 0;
}
开发者ID:ingowald,项目名称:llvm-project,代码行数:59,代码来源:param_ctor_init_func.pass.cpp

示例7: main

int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
    {
        typedef std::piecewise_constant_distribution<> D;
        typedef D::param_type P;
        P pa({}, f);
        std::vector<double> iv = pa.intervals();
        assert(iv.size() == 2);
        assert(iv[0] == 0);
        assert(iv[1] == 1);
        std::vector<double> dn = pa.densities();
        assert(dn.size() == 1);
        assert(dn[0] == 1);
    }
    {
        typedef std::piecewise_constant_distribution<> D;
        typedef D::param_type P;
        P pa({12}, f);
        std::vector<double> iv = pa.intervals();
        assert(iv.size() == 2);
        assert(iv[0] == 0);
        assert(iv[1] == 1);
        std::vector<double> dn = pa.densities();
        assert(dn.size() == 1);
        assert(dn[0] == 1);
    }
    {
        typedef std::piecewise_constant_distribution<> D;
        typedef D::param_type P;
        P pa({12, 14}, f);
        std::vector<double> iv = pa.intervals();
        assert(iv.size() == 2);
        assert(iv[0] == 12);
        assert(iv[1] == 14);
        std::vector<double> dn = pa.densities();
        assert(dn.size() == 1);
        assert(dn[0] == 0.5);
    }
    {
        typedef std::piecewise_constant_distribution<> D;
        typedef D::param_type P;
        P pa({5.5, 7.5, 11.5}, f);
        std::vector<double> iv = pa.intervals();
        assert(iv.size() == 3);
        assert(iv[0] == 5.5);
        assert(iv[1] == 7.5);
        assert(iv[2] == 11.5);
        std::vector<double> dn = pa.densities();
        assert(dn.size() == 2);
        assert(dn[0] == 0.203125);
        assert(dn[1] == 0.1484375);
    }
#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
开发者ID:okuoku,项目名称:libcxx,代码行数:55,代码来源:param_ctor_init_func.pass.cpp

示例8: pa

void HTTPSocket::OnLine(const std::string& line)
{
	if (m_first)
	{
		Parse pa(line);
		std::string str = pa.getword();
		if (str.substr(0,4) == "HTTP") // response
		{
			m_http_version = str;
			m_status = pa.getword();
			m_status_text = pa.getrest();
			m_response = true;
		}
		else // request
		{
			m_method = str;
			m_url = pa.getword();
			size_t spl = m_url.find("?");
			if (spl != std::string::npos)
			{
				m_uri = m_url.substr(0,spl);
				m_query_string = m_url.substr(spl + 1);
			}
			else
			{
				m_uri = m_url;
			}
			m_http_version = pa.getword();
			m_request = true;
		}
		m_first = false;
		OnFirst();
		return;
	}
	if (!line.size())
	{
//		SetLineProtocol(false);
		m_header = false;
		OnHeaderComplete();
		return;
	}
	Parse pa(line,":");
	std::string key = pa.getword();
	std::string value = pa.getrest();
	OnHeader(key,value);
	/* If remote end tells us to keep connection alive, and we're operating
	in http/1.1 mode (not http/1.0 mode), then we mark the socket to be
	retained. */
/*	if (!strcasecmp(key.c_str(), "connection") &&
	    !strcasecmp(value.c_str(), "keep-alive") )
	{
		SetRetain();
	}*/
}
开发者ID:9thsector,项目名称:Server,代码行数:54,代码来源:HTTPSocket.cpp

示例9: init

void init(){
  grabber.init(pa("-i"));

  bool c_arg = pa("-c");

  gui << Draw().handle("draw").label("input image")
      << Image().handle("cropped").label("cropped")
      << ( VBox().maxSize(c_arg ? 0 : 12,99).minSize(c_arg ? 0 : 12,1)
           << Button("save as ..").handle("saveAs")
           << Button("overwrite input").handle("overwrite")
           << Combo("0,90,180,270").handle("rot").label("rotation")
           << CheckBox("rectangular",!pa("-r")).handle("rect")
           << Button("Batch crop...").handle("batch")
           << ( HBox().label("rectification size")
                << Spinner(1,4096,640).handle("s1")
                << Label(":")
                << Spinner(1,4096,480).handle("s2")
                )
           << (HBox() 
               << Fps().handle("fps")
               << CamCfg()
               )
           )
      << Show();


  if(!c_arg){
    gui["batch"].registerCallback(batch_crop);
  }
  const ImgBase *image = grabber.grab();
  if(!c_arg){
    mouse_1 = new Mouse1(image->getSize());
    gui["draw"].install(mouse_1);
  }
  mouse_2 = new Mouse2(image->getSize());
  gui["draw"].install(mouse_2);
  
  DrawHandle draw = gui["draw"];
  draw->setImageInfoIndicatorEnabled(false);
  
  if(!c_arg){
    gui["rect"].registerCallback(rectangular_changed);
    rectangular_changed();
    if(*pa("-i",0) != "file" || FileList(*pa("-i",1)).size() != 1){
      gui["overwrite"].disable();
    }else{
      gui["overwrite"].registerCallback(overwrite);
    }
    gui["saveAs"].registerCallback(save_as);
  }

}
开发者ID:ethz-asl,项目名称:iclcv,代码行数:52,代码来源:crop.cpp

示例10: main

int main(int n, char **args){
  pa_init(n,args,"[m]-input|-i(2) -rectification|-r -create-crop-rect-output-only|-ccroo|-c "
          "-estimate-image-size-only -estimate-image-ar-only "
          "-compute-optimal-scaling-size(target-width) -compute-optimal-scaling-size-input-size(Size=0x0)");
  if(pa("-estimate-image-size-only").as<bool>() || pa("-estimate-image-ar-only").as<bool>() || pa("-compute-optimal-scaling-size").as<bool>()){
    GenericGrabber g(pa("-input"));
    Size s = g.grab()->getSize();
    if(pa("-estimate-image-size-only")){
      std::cout << s << std::endl;
    }
    if(pa("-estimate-image-ar-only")){
      std::cout << float(s.width)/float(s.height) << std::endl;
    }
    if(pa("-compute-optimal-scaling-size")){
      int W = pa("-compute-optimal-scaling-size");
      Size sinput = pa("-compute-optimal-scaling-size-input-size");
      if(sinput == Size(0,0)) sinput = s;
      float f = float(W)/float(sinput.width);
      std::cout << Size(W,round(sinput.height * f)) << std::endl;
    }

    return 0;
  }
  ICLApp app(n,args,"",init,run);
  int result = app.exec();
  std::cout << lastRect << std::endl;
  return result;
}
开发者ID:ethz-asl,项目名称:iclcv,代码行数:28,代码来源:crop.cpp

示例11: init

void init(){
  gui << Image().handle("image").minSize(16,12);
  gui << ( HBox().maxSize(100,2)
           << Fps(10).handle("fps").maxSize(100,2).minSize(5,2)
           << CamCfg("")
           )
      << Show();

  grabber.init(pa("-i"));
  if(pa("-size")){
    grabber.useDesired<Size>(pa("-size"));
  }

}
开发者ID:ethz-asl,项目名称:iclcv,代码行数:14,代码来源:viewer.cpp

示例12: force_pte

void force_pte(pte_t *pmle, int flags) {
    if (!pte_present(*pmle)) {
        void *npg;
        if (flags & USE_BOOT_ALLOCATE) {
            npg = get_mem(PAGE_SIZE, PAGE_SIZE);
        } else {
            npg = get_page0(0);
        }

        assert(npg != 0);
        assert((pa(npg) & ((1 << 12) - 1)) == 0);

        *pmle = pa(npg) | PTE_PRESENT | PTE_WRITE;
    }
}
开发者ID:olga24912,项目名称:term4-os,代码行数:15,代码来源:paging.c

示例13: p

// virtual
void SmallRuler::paintEvent(QPaintEvent *e)
{

    QPainter p(this);
    QRect r = e->rect();
    p.setClipRect(r);

    double f, fend;
    p.setPen(palette().dark().color());

    const int zoneStart = (int)(m_zoneStart * m_scale);
    const int zoneEnd = (int)(m_zoneEnd * m_scale);

    p.fillRect(zoneStart, height() / 2, zoneEnd - zoneStart, height() / 2, m_zoneColor);

    if (r.top() < 9) {
        // draw the little marks
        fend = m_scale * m_small;
        if (fend > 2) for (f = 0; f < width(); f += fend) {
                p.drawLine((int)f, 1, (int)f, 3);
            }

        // draw medium marks
        fend = m_scale * m_medium;
        if (fend > 2) for (f = 0; f < width(); f += fend) {
                p.drawLine((int)f, 1, (int)f, 5);
            }
    }

    // draw pointer
    QPolygon pa(3);
    pa.setPoints(3, m_cursorPosition - 5, 14, m_cursorPosition + 5, 14, m_cursorPosition/*+0*/, 9);
    p.setBrush(palette().dark().color());
    p.drawPolygon(pa);
}
开发者ID:rayl,项目名称:kdenlive,代码行数:36,代码来源:smallruler.cpp

示例14: place

static void		place(t_env *env, t_sort *s)
{
	pa(env);
	s->j++;
	s->k++;
	set_direction(env, s);
}
开发者ID:GabrielPora,项目名称:WeThinkCode,代码行数:7,代码来源:sort.c

示例15: initPainter

void VariableCapacitor::drawShape(QPainter &p) {
	initPainter(p);

	// Get centre point of component.
	int _y = (int)y();
	int _x = (int)x();

	p.drawRect(_x - 8, _y - 8, 5, 16);
	p.drawRect(_x + 3, _y - 8, 5, 16);

// 	p.drawLine( _x-8, _y, _x-16, _y );
// 	p.drawLine( _x+8, _y, _x+16, _y );

	// Diagonally pointing arrow
	QPointArray pa(3);
	pa[0] = QPoint(-4, 0);
	pa[1] = QPoint(-2, 4);
	pa[2] = QPoint(0, 0);

	pa.translate(_x + 16, _y - 8);
	p.setBrush(p.pen().color());
	p.drawPolygon(pa);

	p.drawLine(_x - 16, _y + 8, _x + 16, _y - 8);

	deinitPainter(p);
}
开发者ID:zoltanp,项目名称:ktechlab-0.3,代码行数:27,代码来源:variablecapacitor.cpp


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