本文整理汇总了C++中pb函数的典型用法代码示例。如果您正苦于以下问题:C++ pb函数的具体用法?C++ pb怎么用?C++ pb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pB
void pB()
{
switch (ch) {
case 'b':
pb(); pB();
break;
case 'c':
pc(); pC();
break;
default :
error();
}
}
示例2: pA
void pA()
{
switch (ch) {
case 'a':
pa(); pA();
break;
case 'b':
pb(); pB();
break;
default:
error();
}
}
示例3: intersection_unoptimized
template<class K> Object intersection_unoptimized(const Rectangle_2<K> &a, const Rectangle_2<K> &b) {
typedef K::Point_2 Point_2;
typedef std::vector<Point_2> Container;
typedef Polygon_2<K, Container> Polygon_2;
typedef Polygon_with_holes_2<K,Container> Polygon_with_holes_2;
if(a.is_degenerate() || b.is_degenerate()) return Object();
Container pa(a.center()ontainer(true)), pb(b.center()ontainer(true));
std::vector<Polygon_with_holes_2> res;
Polygon_2 polya(pa.begin(),pa.end()), polyb(pb.begin(),pb.end());
intersection(polya,polyb,std::back_inserter(res));
return (res.empty())?Object():make_object(res.back().outer_boundary().container());
}
示例4: suggestPixelFormat
//-----------------------------------------------------------------------
void RenderTarget::writeContentsToFile(const String& filename)
{
PixelFormat pf = suggestPixelFormat();
uchar *data = OGRE_ALLOC_T(uchar, mWidth * mHeight * PixelUtil::getNumElemBytes(pf), MEMCATEGORY_RENDERSYS);
PixelBox pb(mWidth, mHeight, 1, pf, data);
copyContentsToMemory(pb, pb);
Image().loadDynamicImage(data, mWidth, mHeight, 1, pf, false, 1, 0).save(filename);
OGRE_FREE(data, MEMCATEGORY_RENDERSYS);
}
示例5: pushswap
void pushswap(t_struct **la, t_struct **lb)
{
int min;
while (*la)
{
min = find_min(*la);
while ((*la)->val != min)
ra(la);
pb(lb, la);
}
while (*lb)
pa(la, lb);
}
示例6: splay
void splay(int x){
int s = 1,i = x,y; tmp[1] = i;
while(!isroot(i)) tmp[++s] = i = f[i];
while(s) pb(tmp[s--]);
while(!isroot(x)){
y = f[x];
if (!isroot(y)){
if ((son[f[y]][0] == y) ^ (son[y][0] == x))
rotate(x); else rotate(y);
}
rotate(x);
}
up(x);
}
示例7: LieAlgebraSizeMismatchError
/// the Poisson bracket of two polynomials in this algebra
Polynomial ClassicalLieAlgebra::poissonBracket(const Polynomial& polA,
const Polynomial& polB) const {
if (!(hasElt(polA) && hasElt(polB)))
throw LieAlgebraSizeMismatchError();
assert(polA.hasSameNumVars(polB));
Polynomial pb(zero());
Polynomial pbA(zero());
Polynomial pbB(zero());
for (Index d = 0; d < dof_; ++d) {
pbA = (polA.diff(iQ(d)) * polB.diff(iP(d)));
pbB = (polA.diff(iP(d)) * polB.diff(iQ(d)));
pb += (pbA - pbB);
}
return pb;
}
示例8: EraseAll
void Programmer::WriteInfoPage(const uint8_t chipID[5])
{
// first parse the chipID
// do an erase all
// we must do this for the chip to allow an InfoPage erase
EraseAll();
ProgressBar pb("Writing IP");
// send the erase page command
req_erase_page_t erasePage;
erasePage.page_num = 0;
erasePage.length = sizeof erasePage;
erasePage.request = reqErasePageIP;
reqSetChecksum(erasePage);
SendRequest(erasePage);
pb.Refresh(0.3);
// validate the response
resp_simple_t resp;
ReadResponse1(resp);
if (resp.response != req2resp(reqErasePageIP))
throw std::string("Unexpected response from programmer while erase page in WriteInfoPage()");
// now init and send the new InfoPage
req_write_flash_t writeFlash;
writeFlash.length = sizeof writeFlash;
writeFlash.address = 0;
writeFlash.request = reqWriteInfoPage;
memset(writeFlash.data, 0xff, sizeof writeFlash.data);
memcpy(writeFlash.data + 0x0B, chipID, CHIP_ID_BYTES);
reqSetChecksum(writeFlash);
SendRequest(writeFlash);
pb.Refresh(0.6);
// validate
ReadResponse1(resp);
if (resp.response != req2resp(reqWriteInfoPage))
throw std::string("Unexpected response from programmer while writing page in WriteInfoPage()");
pb.Refresh(1);
}
示例9: UsartPeripheral
Usart3::Usart3(
uint32_t baudRate_,
uint16_t wordLength_,
uint16_t parity_,
uint16_t stopBits_,
uint16_t flowControl_,
uint16_t mode_) : UsartPeripheral(USART3,DMA1_Channel2,DMA1_Channel3,2,USART3_IRQn) {
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3,ENABLE);
GpioPort pb(GPIOB);
pb.initialise(GPIO_Speed_50MHz,GPIO_Mode_AF_PP,GPIO_Pin_TX); // TX
pb.initialise(GPIO_Speed_50MHz,GPIO_Mode_IN_FLOATING,GPIO_Pin_RX); // RX
initialisePeripheral(baudRate_,wordLength_,parity_,stopBits_,flowControl_,mode_);
}
示例10: publishFrame
// bool publishFrame(Ogre::RenderWindow * render_object, const std::string frame_id)
bool publishFrame(Ogre::RenderTexture * render_object, const std::string frame_id)
{
if (pub_.getTopic() == "")
{
return false;
}
if (frame_id == "")
{
return false;
}
// RenderTarget::writeContentsToFile() used as example
int height = render_object->getHeight();
int width = render_object->getWidth();
// the results of pixel format have to be used to determine
// image.encoding
Ogre::PixelFormat pf = render_object->suggestPixelFormat();
uint pixelsize = Ogre::PixelUtil::getNumElemBytes(pf);
uint datasize = width * height * pixelsize;
// 1.05 multiplier is to avoid crash when the window is resized.
// There should be a better solution.
uchar *data = OGRE_ALLOC_T(uchar, datasize * 1.05, Ogre::MEMCATEGORY_RENDERSYS);
Ogre::PixelBox pb(width, height, 1, pf, data);
render_object->copyContentsToMemory(pb, Ogre::RenderTarget::FB_AUTO);
sensor_msgs::Image image;
image.header.stamp = ros::Time::now();
image.header.seq = image_id_++;
image.header.frame_id = frame_id;
image.height = height;
image.width = width;
image.step = pixelsize * width;
if (pixelsize == 3)
image.encoding = sensor_msgs::image_encodings::RGB8; // would break if pf changes
else if (pixelsize == 4)
image.encoding = sensor_msgs::image_encodings::RGBA8; // would break if pf changes
else
{
ROS_ERROR_STREAM("unknown pixe format " << pixelsize << " " << pf);
}
image.is_bigendian = (OGRE_ENDIAN == OGRE_ENDIAN_BIG);
image.data.resize(datasize);
memcpy(&image.data[0], data, datasize);
pub_.publish(image);
OGRE_FREE(data, Ogre::MEMCATEGORY_RENDERSYS);
}
示例11: ft_algo
void ft_algo(t_tab **op, t_swap **ba, t_swap **bb, unsigned int i)
{
if (i / 8)
ft_algo(op, ba, bb, (i / 8));
if (i % 8 < 3)
op[i % 8](ba);
else if (i % 8 == 3 && *bb)
pb(bb, ba);
else if (i % 8 == 4 && *ba)
pa(ba, bb);
else if (i % 8 == 5)
op[3](bb);
else if (i % 8 == 6)
op[4](bb);
else if (i % 8 == 7)
op[5](bb);
}
示例12: JudgeIntersection
void Partition::FindPartitionFace(SFace* Fa, SFace* Fb)
{
//比较两个面是否有相邻curve_edge, 如果有那么就判断两面是否是分割面 否则continue
for(auto i = Fa->faceBounds_.begin(); i != Fa->faceBounds_.end(); i++)
{
for(auto ia = ((*i)->edgeLoop_).begin(); ia != ((*i)->edgeLoop_).end(); ia++)
{
size_t curveFaceAId = (*ia)->edgeCurveId_;
for(auto j = Fb->faceBounds_.begin(); j != Fb->faceBounds_.end(); j++)
{
for(auto jb = ((*j)->edgeLoop_).begin(); jb != ((*j)->edgeLoop_).end(); jb++)
{
size_t curveFaceBId = (*jb)->edgeCurveId_;
orientationFaceA oriA;
oriA.advancedFaceOri = Fa->adFaceSameSense_;
oriA.boundsOri = (*i)->boundsOri_;
oriA.orientedEdgeOri = (*ia)->orientedEdgeOri_;
oriA.edgeCurveOri = (*ia)->edgeCurvesameSense_;
char* curveName = (*ia)->curveName_;
EdgeCurveVertex curveA, curveB;
curveA.cartesianStart = (*ia)->edgeStart_;
curveA.cartesianEnd = (*ia)->edgeEnd_;
curveA.cartesianStart = (*jb)->edgeStart_;
curveA.cartesianEnd = (*jb)->edgeEnd_;
CPoint3D pointA = ((CIRCLE*)(*ia))->position_.point;//圆心
if(curveFaceBId == curveFaceAId)
{
//判断是否是分割面
bool isPartitionFace = JudgeIntersection(Fa, Fb, curveName,
oriA, curveA, curveB, pointA);
if(isPartitionFace)
{
pair<size_t, SFace*> pa(Fa->entityID_, Fa);
pair<size_t, SFace*> pb(Fb->entityID_, Fb);
partitionFaceList_.insert(pa);
partitionFaceList_.insert(pb);
}
else
continue;
}
}
}
}
}
}
示例13: run
virtual void run()
{
python_bridge pb( "processor", "processor" );
for( int i=0; i<N; i++ )
{
// check input event
const eva::event& e = _inp->next();
assert( e.get_header()._id == i );
pb.exec( e.get_raw(), eva::event::size, next().get_raw(), eva::event::size );
// produce output event
//next().get_header()._id = i;
commit();
}
}
示例14: after
ATOOLS::Vec4D_Vector Combine
(const Cluster_Amplitude &l,int i,int j,int k,const ATOOLS::Flavour &mo)
{
Mass_Selector *p_ms=ampl.MS();
if (i>j) std::swap<int>(i,j);
Vec4D_Vector after(ampl.Legs().size()-1);
double mb2(0.0);
if (i<2) {
mb2=ampl.Leg(1-i)->Mom().Abs2();
double mfb2(p_ms->Mass2(ampl.Leg(1-i)->Flav()));
if ((mfb2==0.0 && IsZero(mb2,1.0e-6)) || IsEqual(mb2,mfb2,1.0e-6)) mb2=mfb2;
}
Vec4D pi(ampl.Leg(i)->Mom()), pj(ampl.Leg(j)->Mom());
Vec4D pk(ampl.Leg(k)->Mom()), pb(i<2?ampl.Leg(1-i)->Mom():Vec4D());
double mi2=pi.Abs2(), mfi2=p_ms->Mass2(ampl.Leg(i)->Flav());
double mj2=pj.Abs2(), mfj2=p_ms->Mass2(ampl.Leg(j)->Flav());
double mk2=pk.Abs2(), mfk2=p_ms->Mass2(ampl.Leg(k)->Flav());
if ((mfi2==0.0 && IsZero(mi2,1.0e-6)) || IsEqual(mi2,mfi2,1.0e-6)) mi2=mfi2;
if ((mfj2==0.0 && IsZero(mj2,1.0e-6)) || IsEqual(mj2,mfj2,1.0e-6)) mj2=mfj2;
if ((mfk2==0.0 && IsZero(mk2,1.0e-6)) || IsEqual(mk2,mfk2,1.0e-6)) mk2=mfk2;
double mij2=p_ms->Mass2(mo);
Kin_Args lt;
if (i>1) {
if (k>1) lt=ClusterFFDipole(mi2,mj2,mij2,mk2,pi,pj,pk,2);
else lt=ClusterFIDipole(mi2,mj2,mij2,mk2,pi,pj,-pk,2);
if ((k==0 && lt.m_pk[3]<0.0) ||
(k==1 && lt.m_pk[3]>0.0) || lt.m_pk[0]<0.0) return Vec4D_Vector();
}
else {
if (k>1) {
lt=ClusterIFDipole(mi2,mj2,mij2,mk2,mb2,-pi,pj,pk,-pb,2);
}
else lt=ClusterIIDipole(mi2,mj2,mij2,mk2,-pi,pj,-pk,2);
if ((i==0 && lt.m_pi[3]<0.0) ||
(i==1 && lt.m_pi[3]>0.0) || lt.m_pi[0]<0.0) return Vec4D_Vector();
}
if (lt.m_stat<0) return Vec4D_Vector();
for (size_t l(0), m(0);m<ampl.Legs().size();++m) {
if (m==(size_t)j) continue;
if (m==(size_t)i) after[l]=i>1?lt.m_pi:-lt.m_pi;
else if (m==(size_t)k) after[l]=k>1?lt.m_pk:-lt.m_pk;
else after[l]=lt.m_lam*ampl.Leg(m)->Mom();
++l;
}
return after;
}
示例15: tri_simple
void tri_simple(t_lst *l, t_options *options, int *tri)
{
while ((l->a)->length > 0)
{
more_effective_moving(l, find_min(&l->a), options);
pb(l);
if (options->v == 1)
show_piles(l, "pb");
}
while ((l->b)->length > 0)
{
pa(l);
if (options->v == 1)
show_piles(l, "pa");
}
*tri = 2;
}