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


C++ weak_ptr::expired方法代码示例

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


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

示例1: MakeStrongPtr

shared_ptr<Type> MakeStrongPtr(weak_ptr<Type> pWeakPtr)
{
    if (!pWeakPtr.expired())
        return shared_ptr<Type>(pWeakPtr);
    else
        return shared_ptr<Type>();
}
开发者ID:Ostkaka,项目名称:ANT,代码行数:7,代码来源:templates.hpp

示例2: Init

void PropertyList::Init(weak_ptr<Leaf> leaf, wxListCtrl* ctrList)
{
    mLeaf.reset();
    mCtrList = 0;

    if (
        (leaf.expired()) ||
        (ctrList == 0)
        )
        {
            return;
        }

    mLeaf = leaf;
    mCtrList = ctrList;

    shared_ptr<Property> property = wxGetApp().GetProperty();
    if (property.get() != 0)
        {
            property->GetClassList(mLeaf.lock(), mClassList);
        }

    mCtrList->ClearAll();
    mCtrList->InsertColumn(0, _T("name"), wxLIST_FORMAT_LEFT, 120);
    mCtrList->InsertColumn(1, _T("value"), wxLIST_FORMAT_LEFT, 600);
}
开发者ID:BerlinUnited,项目名称:SimSpark-SPL,代码行数:26,代码来源:propertylist.cpp

示例3: registerObjects

Factory::Factory(weak_ptr<RootObject> root)
{
    _root = root;
    if (!root.expired() && root.lock()->getType() == "scene")
        _isScene = true;

    registerObjects();
}
开发者ID:paperManu,项目名称:splash,代码行数:8,代码来源:factory.cpp

示例4: save

 virtual void RK_CALL save(ReaK::serialization::oarchive& A, unsigned int) const {
   if(Parent.expired())
     A & RK_SERIAL_SAVE_WITH_ALIAS("Parent",shared_ptr<serialization::serializable>());
   else
     A & RK_SERIAL_SAVE_WITH_ALIAS("Parent",Parent.lock());
   A & RK_SERIAL_SAVE_WITH_NAME(Position)
     & RK_SERIAL_SAVE_WITH_NAME(Rotation);
 };
开发者ID:ahmadyan,项目名称:ReaK,代码行数:8,代码来源:pose_2D.hpp

示例5: runtime_error

  inline shared_ptr<System> MultiSystemAccess::getSystem2() const {
 
    if (mySystem2.expired()) {
       throw std::runtime_error("expired system2");
    }

    return mySystem2.lock();
  }
开发者ID:Clemson-MSE,项目名称:espressopp,代码行数:8,代码来源:MultiSystemAccess.hpp

示例6: getGlobalPose

 /**
  * Returns this 2D pose relative to the global (null) coordinate system.
  */
 self getGlobalPose() const {
   if(!Parent.expired()) {
     self result = Parent.lock()->getGlobalPose();
     result.Position += result.Rotation * Position;
     result.Rotation *= Rotation;
     return result;
   } else
     return *this;
 };
开发者ID:ahmadyan,项目名称:ReaK,代码行数:12,代码来源:pose_2D.hpp

示例7: SquareSetCheck

//check if it's the right place to set square if so ,set it
void Tetris::SquareSetCheck(const TETRIS_TYPE t_type,weak_ptr<Square> t_wsquare)
{
	if(!t_wsquare.expired()){
		shared_ptr<Square> t_ssquare = t_wsquare.lock();
		if(t_ssquare->ConflictCheck(t_type) == true)
		{
			t_ssquare->SetSquare(t_type);
		}
	}else{
		LogWriter::me->WriteLog("square expired in SquareSetCheck");
	}
}
开发者ID:qqqqzift,项目名称:Tetris_Clover,代码行数:13,代码来源:tetris.cpp

示例8: getPoseRelativeTo

 /**
  * Returns this 2D pose relative to pose P.
  */
 self getPoseRelativeTo(const shared_ptr< const self >& P) const {
   if(!P)
     return getGlobalPose();
   if(isParentPose(P)) {
     if(Parent.lock() == P)
       return *this;
     else
       return Parent.lock()->getPoseRelativeTo(P) * (*this);
   } else if(P->isParentPose( rtti::rk_static_ptr_cast< const self >(mThis)))
     return ~(P->getPoseRelativeTo( rtti::rk_static_ptr_cast< const self >(mThis)));
   else if(Parent.expired())
     return (~(P->getGlobalPose())) * (*this);
   else
     return Parent.lock()->getPoseRelativeTo(P) * (*this);
 };
开发者ID:ahmadyan,项目名称:ReaK,代码行数:18,代码来源:pose_2D.hpp

示例9: isParentPose

    /**
     * Returns true if P is part of the parent chain from this pose.
     */
    bool isParentPose(const shared_ptr< const self >& P) const {
      if(Parent.expired()) {
	if(P)
	  return true;
	else
	  return false;
      } else {
	if(P)
	  return false;
	else if(P == Parent.lock())
          return true;
	else
	  return Parent.lock()->isParentPose(P);
      };
    };
开发者ID:ahmadyan,项目名称:ReaK,代码行数:18,代码来源:pose_2D.hpp

示例10: SquareCtrl

//read input key to move square
void Tetris::SquareCtrl(const TETRIS_TYPE t_type,weak_ptr<Square> t_wsquare)
{
	if(!t_wsquare.expired()){
		shared_ptr<Square> t_ssquare = t_wsquare.lock();
		KeyboardUpdate();
		//down button is pressed
		if(((KeyboardGet(KEY_INPUT_DOWN) > 0)&&(t_type == TETRIS_UP))|| 
			((KeyboardGet(KEY_INPUT_UP) > 0)&&(t_type == TETRIS_DOWN))||
			((KeyboardGet(KEY_INPUT_RIGHT) > 0)&&(t_type == TETRIS_RIGHT))||
			((KeyboardGet(KEY_INPUT_LEFT) > 0)&&(t_type == TETRIS_LEFT))
			){
			t_ssquare->Move(kGODOWN,t_type);
		}
		//left button is pressed
		else if(((KeyboardGet(KEY_INPUT_LEFT) > 0)&&(t_type == TETRIS_UP))|| 
			((KeyboardGet(KEY_INPUT_RIGHT) > 0)&&(t_type == TETRIS_DOWN))||
			((KeyboardGet(KEY_INPUT_DOWN) > 0)&&(t_type == TETRIS_LEFT))||
			((KeyboardGet(KEY_INPUT_UP) > 0)&&(t_type == TETRIS_RIGHT))
			){
			t_ssquare->Move(kGOLEFT,t_type);
		}
		//right button is pressed
		else if(((KeyboardGet(KEY_INPUT_RIGHT) > 0)&&(t_type == TETRIS_UP))|| 
			((KeyboardGet(KEY_INPUT_LEFT) > 0)&&(t_type == TETRIS_DOWN))||
			((KeyboardGet(KEY_INPUT_UP) > 0)&&(t_type == TETRIS_LEFT))||
			((KeyboardGet(KEY_INPUT_DOWN) > 0)&&(t_type == TETRIS_RIGHT))
			){	
			t_ssquare->Move(kGORIGHT,t_type);
		}
		else if(((KeyboardGet(KEY_INPUT_UP) > 0)&&(t_type == TETRIS_UP))|| 
			((KeyboardGet(KEY_INPUT_DOWN) > 0)&&(t_type == TETRIS_DOWN))||
			((KeyboardGet(KEY_INPUT_RIGHT) > 0)&&(t_type == TETRIS_LEFT))||
			((KeyboardGet(KEY_INPUT_LEFT) > 0)&&(t_type == TETRIS_RIGHT))
			){
			t_ssquare->Turn(t_type);
		}else if(KeyboardGet(KEY_INPUT_SPACE ) > 0){
			CtrlBoardChangine(t_type);
		}
		else if (KeyboardGet(KEY_INPUT_Z) == 1){
			SpeedUp();
		}
		else if (KeyboardGet(KEY_INPUT_X) == 1){
			SpeedDown();
		}

	}
}
开发者ID:qqqqzift,项目名称:Tetris_Clover,代码行数:48,代码来源:tetris.cpp

示例11: Reflect

void DirectusMaterial::Reflect(weak_ptr<GameObject> gameobject)
{
    m_inspectedMaterial = weak_ptr<Material>();

    // Catch the evil case
    if (gameobject.expired())
    {
        this->hide();
        return;
    }

    MeshRenderer* meshRenderer = gameobject.lock()->GetComponent<MeshRenderer>().lock().get();
    if (!meshRenderer)
    {
        this->hide();
        return;
    }



    m_inspectedMaterial = meshRenderer->GetMaterial();
    if (m_inspectedMaterial.expired())
    {
        this->hide();
        return;
    }

    // Do the actual reflection
    ReflectName();
    ReflectShader();
    ReflectAlbedo();
    ReflectRoughness();
    ReflectMetallic();
    ReflectNormal();
    ReflectHeight();
    ReflectOcclusion();
    ReflectEmission();
    ReflectMask();
    ReflectTiling();
    ReflectOffset();

    SetPropertiesVisible(m_inspectedMaterial.lock()->IsEditable() ? true : false);

    // Make this widget visible
    this->show();
}
开发者ID:PanosK92,项目名称:Directus3D,代码行数:46,代码来源:DirectusMaterial.cpp

示例12: SetParent

void kinematicFrame::SetParent(weak_ptr<Leaf> parent)
{
    shared_ptr<SimSpark> spark = wxGetApp().GetSpark();
    if (spark.get() == 0)
        {
            return;
        }

    if (parent.expired())
    {
        mParent = Leaf::CachedPath<zeitgeist::Leaf>();
    } else
    {
        std::string path = parent.lock()->GetFullPath();
        mParent.SetKey(Core::CacheKey(spark->GetCore()->GetRoot(), path));
    }

    UpdateCached();
}
开发者ID:GiorgosMethe,项目名称:SimSpark-SPL,代码行数:19,代码来源:kinematicframe.cpp

示例13: SetLeaf

void propertyframe::SetLeaf(weak_ptr<Leaf> leaf)
{
    shared_ptr<SimSpark> spark = wxGetApp().GetSpark();
    if (spark.get() == 0)
        {
            return;
        }

    if (leaf.expired())
    {
        mPath = Leaf::CachedPath<zeitgeist::Leaf>();
    } else
    {
        std::string path = leaf.lock()->GetFullPath();
        mPath.SetKey(Core::CacheKey(spark->GetCore()->GetRoot(), path));
    }

    UpdateCached();
    RefreshProperties();
}
开发者ID:BerlinUnited,项目名称:SimSpark-SPL,代码行数:20,代码来源:propertyframe.cpp

示例14: Reflect

void DirectusAudioListener::Reflect(weak_ptr<GameObject> gameobject)
{
    m_inspectedAudioListener = nullptr;

    // Catch the evil case
    if (gameobject.expired())
    {
        this->hide();
        return;
    }

    // Catch the seed of the evil
    m_inspectedAudioListener = gameobject.lock()->GetComponent<AudioListener>().lock().get();
    if (!m_inspectedAudioListener)
    {
        this->hide();
        return;
    }

    // Make this widget visible
    this->show();
}
开发者ID:PanosK92,项目名称:Directus3D,代码行数:22,代码来源:DirectusAudioListener.cpp

示例15: addAnnotation

bool Object::addAnnotation(weak_ptr<Annotation> annotation) {
  if (!isActive()) return false;
  if (annotation.expired()) return false;
  return addAnnotation(annotation.lock());
}
开发者ID:lasmue,项目名称:annotatorlib,代码行数:5,代码来源:Object.cpp


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