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


C++ Link类代码示例

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


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

示例1: set_neighbours

Link* Link::set_neighbours()
{
	Link* p = this;
	Link* mark = this;

	if (p->prev && p->succ) return p;

	p = p->to_first_total();

	while (p->value < this->value) // Если есть элемент на схожем уровне с нашим, то запоминаем его в маркер.
	{ // Следуем вперёд до тех пор, пока не найдём самые ближние элементы (prev) и (succ).
		while (p->upper && p->level < level) p = p->upper;
		if (p->level == level) // Если найден элемент на этом уровне, запомним его и продолжим поиск дальше.
		{
			mark = p;
			while (p->lower)
			{
				p = p->lower;
			}
		}

		if (p->succ) p = p->succ;
	}
	if (mark && mark != this)
	{
		this->prev = mark;
		this->prev->succ = this;
	}

	mark = 0;

	p = p->to_first_total();

	while (p->level != this->level && p->succ) // Тоже самое для элемента succ
	{
		if (p->succ) p = p->succ;
		while (p->upper && p->value > value && p->level < level) p = p->upper;
		if (p->level == level && p->value > this->value) // Если найден элемент на этом уровне, запомним его и продолжим поиск дальше.
		{
			mark = p;

		}
	}

	if (mark && mark != this)
	{
		this->succ = mark;
		this->succ->prev = this;
	}

	return this;
}
开发者ID:kordax,项目名称:Stroustrup,代码行数:52,代码来源:18.11.3.cpp

示例2: self

EditableSceneBodyImpl::EditableSceneBodyImpl(EditableSceneBody* self, BodyItemPtr& bodyItem)
    : self(self),
      bodyItem(bodyItem),
      kinematicsBar(KinematicsBar::instance()),
      modified(SgUpdate::MODIFIED)
{
    pointedSceneLink = 0;
    outlinedLink = 0;
    targetLink = 0;

    positionDragger = new PositionDragger;
    positionDragger->setDraggerAlwaysShown(true);
    positionDragger->sigDragStarted().connect(boost::bind(&EditableSceneBodyImpl::onDraggerIKstarted, this));
    positionDragger->sigPositionDragged().connect(boost::bind(&EditableSceneBodyImpl::onDraggerIKdragged, this));
    
    dragMode = DRAG_NONE;
    isDragging = false;
    isEditMode = false;

    markerGroup = new SgGroup;
    markerGroup->setName("Marker");
    self->addChild(markerGroup);

    double radius = 0;
    const int n = self->numSceneLinks();
    for(int i=0; i < n; ++i){
        SceneLink* sLink = self->sceneLink(i);
        BoundingBox bb = sLink->boundingBox();
        double radius0 = (bb.max() - bb.center()).norm();
        if(radius0 > radius){
            radius = radius0;
        }
    }
    cmMarker = new CrossMarker(0.25, Vector3f(0.0f, 1.0f, 0.0f), 2.0);
    cmMarker->setName("centerOfMass");
    cmMarker->setSize(radius);
    isCmVisible = false;

    LeggedBodyHelperPtr legged = getLeggedBodyHelper(self->body());
    if(legged->isValid() && legged->numFeet() > 0){
        Link* footLink = legged->footLink(0);
        const double r = calcLinkMarkerRadius(self->sceneLink(footLink->index()));
        zmpMarker = new SphereMarker(r, Vector3f(0.0f, 1.0f, 0.0f), 0.3);
        zmpMarker->setName("ZMP");
        zmpMarker->addChild(new CrossMarker(r * 2.5, Vector3f(0.0f, 1.0f, 0.0f), 2.0f));
    } else {
        zmpMarker = new SphereMarker(0.1, Vector3f(0.0f, 1.0f, 0.0f), 0.3);
    }
    isZmpVisible = false;

    self->sigGraphConnection().connect(boost::bind(&EditableSceneBodyImpl::onSceneGraphConnection, this, _1));
}
开发者ID:orikuma,项目名称:choreonoid,代码行数:52,代码来源:EditableSceneBody.cpp

示例3: getCurrentLink

void DBWorker::updateTab(int tabId, QString url, QString title, QString path)
{
    Link currentLink = getCurrentLink(tabId);
    if (!currentLink.isValid()) {
        qWarning() << "attempt to update url that is not stored in db." << tabId << title << url << path << currentLink.linkId() << currentLink.url();
        return;
    }
#ifdef DEBUG_LOGS
    qDebug() << tabId << title << url << path;
#endif
    updateLink(currentLink.linkId(), url, title, path);
    emit tabChanged(getTabData(tabId));
}
开发者ID:Hmaal,项目名称:sailfish-browser,代码行数:13,代码来源:dbworker.cpp

示例4: addSelfCollision

void BodyLinkViewImpl::addSelfCollision(const CollisionLinkPair& collisionPair, QString& collisionString)
{
    Link* oppositeLink;
    if(collisionPair.link[0] == currentLink){
        oppositeLink = collisionPair.link[1];
    } else {
        oppositeLink = collisionPair.link[0];
    }
    if(!collisionString.isEmpty()){
        collisionString += " ";
    }
    collisionString += oppositeLink->name().c_str();
}
开发者ID:haraisao,项目名称:choreonoid,代码行数:13,代码来源:BodyLinkView.cpp

示例5: GetFromMap

//----------------------------------------------------------------------------
Object* Stream::GetFromMap (Object* pkLinkID)
{
    map<Object*,void*>::iterator kOIter = m_kMap.find(pkLinkID);
    if ( kOIter != m_kMap.end() )
    {
        Link* pkLink = (Link*) kOIter->second;
        return pkLink->GetObject();
    }
    else
    {
        return NULL;
    }
}
开发者ID:Steven0818,项目名称:Deform,代码行数:14,代码来源:WmlStream.cpp

示例6: test_sendError_connected

void Linktest::test_sendError_connected()
{
    CommSocket_flush_called = false;

    m_encoder = new Atlas::Objects::ObjectsEncoder(*m_bridge);
    m_link->setEncoder(m_encoder);

    Operation op;

    m_link->sendError(op, "test error message", "");

    ASSERT_TRUE(CommSocket_flush_called);
}
开发者ID:9cat,项目名称:cyphesis,代码行数:13,代码来源:Linktest.cpp

示例7: changeLinkIds

void Signature::changeLinkIds(int idFrom, int idTo)
{
	std::map<int, Link>::iterator iter = _links.find(idFrom);
	if(iter != _links.end())
	{
		Link link = iter->second;
		_links.erase(iter);
		link.setTo(idTo);
		_links.insert(std::make_pair(idTo, link));
		_linksModified = true;
		UDEBUG("(%d) neighbor ids changed from %d to %d", _id, idFrom, idTo);
	}
}
开发者ID:konanrobot,项目名称:Rtabmap_IMU,代码行数:13,代码来源:Signature.cpp

示例8:

std::ostream& operator<<(std::ostream& os, JointPath& path)
{
    int n = path.numJoints();
    for(int i=0; i < n; ++i){
        Link* link = path.joint(i);
        os << link->name();
        if(i != n){
            os << (path.isJointDownward(i) ? " => " : " <= ");
        }
    }
    os << std::endl;
    return os;
}
开发者ID:fkanehiro,项目名称:choreonoid,代码行数:13,代码来源:JointPath.cpp

示例9: reverse

Link* Link::reverse() // Шагаем назад на один шаг
{
	if (!prev && !lower) return this; // Если идти назад некуда
	Link* p = this;

	if (p->value == 1 && p->level > 1)
	{
		if (p->lower) p = p->lower;
		p = p->to_last();
	}
	if (p->prev) p = p->prev;

	return p;
}
开发者ID:kordax,项目名称:Stroustrup,代码行数:14,代码来源:18.11.2.cpp

示例10:

std::ostream& operator<<(std::ostream& os, LinkTraverse& traverse)
{
    int n = traverse.numLinks();
    for(int i=0; i < n; ++i){
        Link* link = traverse[i];
        os << link->name();
        if(i != n){
            os << (traverse.isDownward(i) ? " => " : " <= ");
        }
    }
    os << std::endl;

    return os;
}
开发者ID:SeishoIrie,项目名称:choreonoid-deb,代码行数:14,代码来源:LinkTraverse.cpp

示例11: TestCreate

void TestCreate() {
  ScopedPass pass("Link::Create()");
  OrNeuron neuron1;
  OrNeuron neuron2;
  Link * link = Link::Create(neuron1, neuron2);
  assert(neuron1.GetOutputCount() == 1);
  assert(neuron1.GetInputCount() == 0);
  assert(neuron2.GetOutputCount() == 0);
  assert(neuron2.GetInputCount() == 1);
  assert(&link->GetSender() == &neuron1);
  assert(&link->GetReceiver() == &neuron2);
  assert(link->GetSenderNext() == nullptr);
  assert(link->GetReceiverNext() == nullptr);
  
  Link * link1 = Link::Create(neuron1, neuron2);
  assert(neuron1.GetOutputCount() == 2);
  assert(neuron1.GetInputCount() == 0);
  assert(neuron2.GetOutputCount() == 0);
  assert(neuron2.GetInputCount() == 2);
  assert(&link1->GetSender() == &neuron1);
  assert(&link1->GetReceiver() == &neuron2);
  assert(link1->GetSenderNext() == link);
  assert(link1->GetReceiverNext() == link);
  assert(link->GetSenderNext() == nullptr);
  assert(link->GetReceiverNext() == nullptr);
  
  link->Remove();
  link1->Remove();
}
开发者ID:unixpickle,项目名称:AI-attempts,代码行数:29,代码来源:test-link.cpp

示例12: init_links

void init_links(int num, const char *ip, int port){
	fdes = new Fdevents();
	free_links = new std::vector<Link *>();

	for(int i=0; i<num; i++){
		Link *link = Link::connect(ip, port);
		if(!link){
			fprintf(stderr, "connect error! %s\n", strerror(errno));
			exit(0);
		}
		fdes->set(link->fd(), FDEVENT_IN, 0, link);
		free_links->push_back(link);
	}
}
开发者ID:2php,项目名称:ssdb,代码行数:14,代码来源:ssdb-bench.cpp

示例13: find

Link* Link::find(Link* n)
{
    Link* p = n;

    p = p->to_first();

    while (p)
    {
        if (p->level == level && p->value == value) return p;
        p = p->succ;
    }

    return 0;
}
开发者ID:kordax,项目名称:Stroustrup,代码行数:14,代码来源:main.cpp

示例14: find

Link* Link::find(Link* n)
{
	Link* p = this;

	p = p->to_first();

	while (p)
	{
		if (n->level == p->level && n->value == p->value) return p;
		p = p->succ;
	}

	return 0;
}
开发者ID:kordax,项目名称:Stroustrup,代码行数:14,代码来源:18.11.2.cpp

示例15: get_instance

Get_Instance_Status Link_Provider::get_instance(
    const Link* model,
    Link*& instance)
{
    Link* link = _map.lookup(model);

    if (link)
    {
        instance = link->clone();
        return GET_INSTANCE_OK;
    }

    return GET_INSTANCE_NOT_FOUND;
}
开发者ID:LegalizeAdulthood,项目名称:cimple,代码行数:14,代码来源:Link_Provider.cpp


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