replace boost::shared_ptr in extern and components

pull/228/head
Bret Curtis 7 years ago
parent dd882b69c6
commit 07f75e1104

@ -17,13 +17,13 @@ namespace MWSound
class Sound;
class Stream;
struct Sound_Decoder;
typedef boost::shared_ptr<Sound_Decoder> DecoderPtr;
typedef std::shared_ptr<Sound_Decoder> DecoderPtr;
}
namespace MWBase
{
typedef boost::shared_ptr<MWSound::Sound> SoundPtr;
typedef boost::shared_ptr<MWSound::Stream> SoundStreamPtr;
typedef std::shared_ptr<MWSound::Sound> SoundPtr;
typedef std::shared_ptr<MWSound::Stream> SoundStreamPtr;
/// \brief Interface for sound manager (implemented in MWSound)
class SoundManager

@ -546,7 +546,7 @@ namespace MWRender
if(!mResourceSystem->getVFS()->exists(kfname))
return;
boost::shared_ptr<AnimSource> animsrc;
std::shared_ptr<AnimSource> animsrc;
animsrc.reset(new AnimSource);
animsrc->mKeyframes = mResourceSystem->getKeyframeManager()->get(kfname);
@ -598,7 +598,7 @@ namespace MWRender
mStates.clear();
for(size_t i = 0;i < sNumBlendMasks;i++)
mAnimationTimePtr[i]->setTimePtr(boost::shared_ptr<float>());
mAnimationTimePtr[i]->setTimePtr(std::shared_ptr<float>());
mAccumCtrl = NULL;
@ -881,12 +881,12 @@ namespace MWRender
active = state;
}
mAnimationTimePtr[blendMask]->setTimePtr(active == mStates.end() ? boost::shared_ptr<float>() : active->second.mTime);
mAnimationTimePtr[blendMask]->setTimePtr(active == mStates.end() ? std::shared_ptr<float>() : active->second.mTime);
// add external controllers for the AnimSource active in this blend mask
if (active != mStates.end())
{
boost::shared_ptr<AnimSource> animsrc = active->second.mSource;
std::shared_ptr<AnimSource> animsrc = active->second.mSource;
for (AnimSource::ControllerMap::iterator it = animsrc->mControllerMap[blendMask].begin(); it != animsrc->mControllerMap[blendMask].end(); ++it)
{
@ -1406,9 +1406,9 @@ namespace MWRender
params.mEffectId = effectId;
params.mBoneName = bonename;
params.mAnimTime = boost::shared_ptr<EffectAnimationTime>(new EffectAnimationTime);
params.mAnimTime = std::shared_ptr<EffectAnimationTime>(new EffectAnimationTime);
SceneUtil::AssignControllerSourcesVisitor assignVisitor(boost::shared_ptr<SceneUtil::ControllerSource>(params.mAnimTime));
SceneUtil::AssignControllerSourcesVisitor assignVisitor(std::shared_ptr<SceneUtil::ControllerSource>(params.mAnimTime));
node->accept(assignVisitor);
overrideFirstRootTexture(texture, mResourceSystem, node);

@ -69,7 +69,7 @@ private:
void operator= (const PartHolder&);
PartHolder(const PartHolder&);
};
typedef boost::shared_ptr<PartHolder> PartHolderPtr;
typedef std::shared_ptr<PartHolder> PartHolderPtr;
class Animation : public osg::Referenced
{
@ -146,13 +146,13 @@ protected:
class AnimationTime : public SceneUtil::ControllerSource
{
private:
boost::shared_ptr<float> mTimePtr;
std::shared_ptr<float> mTimePtr;
public:
void setTimePtr(boost::shared_ptr<float> time)
void setTimePtr(std::shared_ptr<float> time)
{ mTimePtr = time; }
boost::shared_ptr<float> getTimePtr() const
std::shared_ptr<float> getTimePtr() const
{ return mTimePtr; }
virtual float getValue(osg::NodeVisitor* nv);
@ -170,13 +170,13 @@ protected:
struct AnimSource;
struct AnimState {
boost::shared_ptr<AnimSource> mSource;
std::shared_ptr<AnimSource> mSource;
float mStartTime;
float mLoopStartTime;
float mLoopStopTime;
float mStopTime;
typedef boost::shared_ptr<float> TimePtr;
typedef std::shared_ptr<float> TimePtr;
TimePtr mTime;
float mSpeedMult;
@ -212,7 +212,7 @@ protected:
typedef std::map<std::string,AnimState> AnimStateMap;
AnimStateMap mStates;
typedef std::vector<boost::shared_ptr<AnimSource> > AnimSourceList;
typedef std::vector<std::shared_ptr<AnimSource> > AnimSourceList;
AnimSourceList mAnimSources;
osg::ref_ptr<osg::Group> mInsert;
@ -234,7 +234,7 @@ protected:
typedef std::multimap<osg::ref_ptr<osg::Node>, osg::ref_ptr<osg::NodeCallback> > ControllerMap;
ControllerMap mActiveControllers;
boost::shared_ptr<AnimationTime> mAnimationTimePtr[sNumBlendMasks];
std::shared_ptr<AnimationTime> mAnimationTimePtr[sNumBlendMasks];
// Stored in all lowercase for a case-insensitive lookup
typedef std::map<std::string, osg::ref_ptr<osg::MatrixTransform> > NodeMap;
@ -251,7 +251,7 @@ protected:
{
std::string mModelName; // Just here so we don't add the same effect twice
PartHolderPtr mObjects;
boost::shared_ptr<EffectAnimationTime> mAnimTime;
std::shared_ptr<EffectAnimationTime> mAnimTime;
float mMaxControllerLength;
int mEffectId;
bool mLoop;

@ -59,7 +59,7 @@ CreatureWeaponAnimation::CreatureWeaponAnimation(const MWWorld::Ptr &ptr, const
updateParts();
}
mWeaponAnimationTime = boost::shared_ptr<WeaponAnimationTime>(new WeaponAnimationTime(this));
mWeaponAnimationTime = std::shared_ptr<WeaponAnimationTime>(new WeaponAnimationTime(this));
}
void CreatureWeaponAnimation::showWeapons(bool showWeapon)
@ -143,7 +143,7 @@ void CreatureWeaponAnimation::updatePart(PartHolderPtr& scene, int slot)
else
mAmmunition.reset();
boost::shared_ptr<SceneUtil::ControllerSource> source;
std::shared_ptr<SceneUtil::ControllerSource> source;
if (slot == MWWorld::InventoryStore::Slot_CarriedRight)
source = mWeaponAnimationTime;

@ -61,7 +61,7 @@ namespace MWRender
bool mShowWeapons;
bool mShowCarriedLeft;
boost::shared_ptr<WeaponAnimationTime> mWeaponAnimationTime;
std::shared_ptr<WeaponAnimationTime> mWeaponAnimationTime;
};
}

@ -1,13 +1,12 @@
#ifndef OPENMW_MWRENDER_EFFECTMANAGER_H
#define OPENMW_MWRENDER_EFFECTMANAGER_H
#include <string>
#include <map>
#include <memory>
#include <string>
#include <osg/ref_ptr>
#include <boost/shared_ptr.hpp>
namespace osg
{
class Group;
@ -44,7 +43,7 @@ namespace MWRender
struct Effect
{
float mMaxControllerLength;
boost::shared_ptr<EffectAnimationTime> mAnimTime;
std::shared_ptr<EffectAnimationTime> mAnimTime;
};
typedef std::map<osg::ref_ptr<osg::PositionAttitudeTransform>, Effect> EffectMap;

@ -286,8 +286,8 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr<osg::Group> par
{
mNpc = mPtr.get<ESM::NPC>()->mBase;
mHeadAnimationTime = boost::shared_ptr<HeadAnimationTime>(new HeadAnimationTime(mPtr));
mWeaponAnimationTime = boost::shared_ptr<WeaponAnimationTime>(new WeaponAnimationTime(this));
mHeadAnimationTime = std::shared_ptr<HeadAnimationTime>(new HeadAnimationTime(mPtr));
mWeaponAnimationTime = std::shared_ptr<WeaponAnimationTime>(new WeaponAnimationTime(this));
for(size_t i = 0;i < ESM::PRT_Count;i++)
{
@ -778,7 +778,7 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g
osg::Node* node = mObjectParts[type]->getNode();
if (node->getNumChildrenRequiringUpdateTraversal() > 0)
{
boost::shared_ptr<SceneUtil::ControllerSource> src;
std::shared_ptr<SceneUtil::ControllerSource> src;
if (type == ESM::PRT_Head)
{
src = mHeadAnimationTime;

@ -64,8 +64,8 @@ private:
// Field of view to use when rendering first person meshes
float mFirstPersonFieldOfView;
boost::shared_ptr<HeadAnimationTime> mHeadAnimationTime;
boost::shared_ptr<WeaponAnimationTime> mWeaponAnimationTime;
std::shared_ptr<HeadAnimationTime> mHeadAnimationTime;
std::shared_ptr<WeaponAnimationTime> mWeaponAnimationTime;
bool mSoundsDisabled;

@ -47,7 +47,7 @@ namespace
}
osg::ref_ptr<NifOsg::FlipController> controller (new NifOsg::FlipController(0, 0.3f/rippleFrameCount, textures));
controller->setSource(boost::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource));
controller->setSource(std::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource));
node->addUpdateCallback(controller);
osg::ref_ptr<osg::StateSet> stateset (new osg::StateSet);

@ -1525,7 +1525,7 @@ void SkyManager::setWeather(const WeatherResult& weather)
}
mParticleEffect = mSceneManager->getInstance(mCurrentParticleEffect, mParticleNode);
SceneUtil::AssignControllerSourcesVisitor assignVisitor(boost::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource));
SceneUtil::AssignControllerSourcesVisitor assignVisitor(std::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource));
mParticleEffect->accept(assignVisitor);
AlphaFader::SetupVisitor alphaFaderSetupVisitor;

@ -488,7 +488,7 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha)
float fps = mFallback->getFallbackFloat("Water_SurfaceFPS");
osg::ref_ptr<NifOsg::FlipController> controller (new NifOsg::FlipController(0, 1.f/fps, textures));
controller->setSource(boost::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource));
controller->setSource(std::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource));
node->setUpdateCallback(controller);
stateset->setTextureAttributeAndModes(0, textures[0], osg::StateAttribute::ON);

@ -92,7 +92,7 @@ namespace MWSound
}
MWBase::SoundStreamPtr mAudioTrack;
boost::shared_ptr<MWSoundDecoderBridge> mDecoderBridge;
std::shared_ptr<MWSoundDecoderBridge> mDecoderBridge;
};
@ -156,9 +156,9 @@ namespace MWSound
boost::shared_ptr<Video::MovieAudioDecoder> MovieAudioFactory::createDecoder(Video::VideoState* videoState)
std::shared_ptr<Video::MovieAudioDecoder> MovieAudioFactory::createDecoder(Video::VideoState* videoState)
{
boost::shared_ptr<MWSound::MovieAudioDecoder> decoder(new MWSound::MovieAudioDecoder(videoState));
std::shared_ptr<MWSound::MovieAudioDecoder> decoder(new MWSound::MovieAudioDecoder(videoState));
decoder->setupFormat();
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();

@ -8,7 +8,7 @@ namespace MWSound
class MovieAudioFactory : public Video::MovieAudioFactory
{
virtual boost::shared_ptr<Video::MovieAudioDecoder> createDecoder(Video::VideoState* videoState);
virtual std::shared_ptr<Video::MovieAudioDecoder> createDecoder(Video::VideoState* videoState);
};
}

@ -73,7 +73,7 @@ namespace MWWorld
struct State
{
osg::ref_ptr<osg::PositionAttitudeTransform> mNode;
boost::shared_ptr<MWRender::EffectAnimationTime> mEffectAnimationTime;
std::shared_ptr<MWRender::EffectAnimationTime> mEffectAnimationTime;
int mActorId;

@ -17,7 +17,7 @@ public:
virtual ~ConstrainedFileStream();
};
typedef boost::shared_ptr<std::istream> IStreamPtr;
typedef std::shared_ptr<std::istream> IStreamPtr;
IStreamPtr openConstrainedFileStream(const char *filename, size_t start=0, size_t length=0xFFFFFFFF);

@ -92,7 +92,7 @@ public:
/// Get the name of the file
std::string getFilename() const { return filename; }
};
typedef boost::shared_ptr<const Nif::NIFFile> NIFFilePtr;
typedef std::shared_ptr<const Nif::NIFFile> NIFFilePtr;

@ -156,10 +156,10 @@ typedef KeyMapT<osg::Vec3f,&NIFStream::getVector3> Vector3KeyMap;
typedef KeyMapT<osg::Vec4f,&NIFStream::getVector4> Vector4KeyMap;
typedef KeyMapT<osg::Quat,&NIFStream::getQuaternion> QuaternionKeyMap;
typedef boost::shared_ptr<FloatKeyMap> FloatKeyMapPtr;
typedef boost::shared_ptr<Vector3KeyMap> Vector3KeyMapPtr;
typedef boost::shared_ptr<Vector4KeyMap> Vector4KeyMapPtr;
typedef boost::shared_ptr<QuaternionKeyMap> QuaternionKeyMapPtr;
typedef std::shared_ptr<FloatKeyMap> FloatKeyMapPtr;
typedef std::shared_ptr<Vector3KeyMap> Vector3KeyMapPtr;
typedef std::shared_ptr<Vector4KeyMap> Vector4KeyMapPtr;
typedef std::shared_ptr<QuaternionKeyMap> QuaternionKeyMapPtr;
} // Namespace
#endif //#ifndef OPENMW_COMPONENTS_NIF_NIFKEY_HPP

@ -53,7 +53,7 @@ namespace NifOsg
{
}
ValueInterpolator(boost::shared_ptr<const MapT> keys, ValueT defaultVal = ValueT())
ValueInterpolator(std::shared_ptr<const MapT> keys, ValueT defaultVal = ValueT())
: mKeys(keys)
, mDefaultVal(defaultVal)
{
@ -125,7 +125,7 @@ namespace NifOsg
mutable typename MapT::MapType::const_iterator mLastLowKey;
mutable typename MapT::MapType::const_iterator mLastHighKey;
boost::shared_ptr<const MapT> mKeys;
std::shared_ptr<const MapT> mKeys;
ValueT mDefaultVal;
};

@ -334,7 +334,7 @@ namespace NifOsg
continue;
osg::ref_ptr<NifOsg::KeyframeController> callback(new NifOsg::KeyframeController(key->data.getPtr()));
callback->setFunction(boost::shared_ptr<NifOsg::ControllerFunction>(new NifOsg::ControllerFunction(key)));
callback->setFunction(std::shared_ptr<NifOsg::ControllerFunction>(new NifOsg::ControllerFunction(key)));
if (target.mKeyframeControllers.find(strdata->string) != target.mKeyframeControllers.end())
std::cerr << "Warning: controller " << strdata->string << " present more than once in " << nif->getFilename() << ", ignoring later version" << std::endl;
@ -411,9 +411,9 @@ namespace NifOsg
{
bool autoPlay = animflags & Nif::NiNode::AnimFlag_AutoPlay;
if (autoPlay)
toSetup->setSource(boost::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource));
toSetup->setSource(std::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource));
toSetup->setFunction(boost::shared_ptr<ControllerFunction>(new ControllerFunction(ctrl)));
toSetup->setFunction(std::shared_ptr<ControllerFunction>(new ControllerFunction(ctrl)));
}
osg::ref_ptr<osg::LOD> handleLodNode(const Nif::NiLODNode* niLodNode)

@ -28,22 +28,22 @@ namespace SceneUtil
return mSource->getValue(nv);
}
void Controller::setSource(boost::shared_ptr<ControllerSource> source)
void Controller::setSource(std::shared_ptr<ControllerSource> source)
{
mSource = source;
}
void Controller::setFunction(boost::shared_ptr<ControllerFunction> function)
void Controller::setFunction(std::shared_ptr<ControllerFunction> function)
{
mFunction = function;
}
boost::shared_ptr<ControllerSource> Controller::getSource() const
std::shared_ptr<ControllerSource> Controller::getSource() const
{
return mSource;
}
boost::shared_ptr<ControllerFunction> Controller::getFunction() const
std::shared_ptr<ControllerFunction> Controller::getFunction() const
{
return mFunction;
}
@ -107,7 +107,7 @@ namespace SceneUtil
{
}
AssignControllerSourcesVisitor::AssignControllerSourcesVisitor(boost::shared_ptr<ControllerSource> toAssign)
AssignControllerSourcesVisitor::AssignControllerSourcesVisitor(std::shared_ptr<ControllerSource> toAssign)
: ControllerVisitor()
, mToAssign(toAssign)
{

@ -1,8 +1,7 @@
#ifndef OPENMW_COMPONENTS_SCENEUTIL_CONTROLLER_H
#define OPENMW_COMPONENTS_SCENEUTIL_CONTROLLER_H
#include <boost/shared_ptr.hpp>
#include <memory>
#include <osg/NodeVisitor>
namespace SceneUtil
@ -43,17 +42,17 @@ namespace SceneUtil
float getInputValue(osg::NodeVisitor* nv);
void setSource(boost::shared_ptr<ControllerSource> source);
void setFunction(boost::shared_ptr<ControllerFunction> function);
void setSource(std::shared_ptr<ControllerSource> source);
void setFunction(std::shared_ptr<ControllerFunction> function);
boost::shared_ptr<ControllerSource> getSource() const;
boost::shared_ptr<ControllerFunction> getFunction() const;
std::shared_ptr<ControllerSource> getSource() const;
std::shared_ptr<ControllerFunction> getFunction() const;
private:
boost::shared_ptr<ControllerSource> mSource;
std::shared_ptr<ControllerSource> mSource;
// The source value gets passed through this function before it's passed on to the DestValue.
boost::shared_ptr<ControllerFunction> mFunction;
std::shared_ptr<ControllerFunction> mFunction;
};
/// Pure virtual base class - visit() all controllers that are attached as UpdateCallbacks in a scene graph.
@ -78,14 +77,14 @@ namespace SceneUtil
{
public:
AssignControllerSourcesVisitor();
AssignControllerSourcesVisitor(boost::shared_ptr<ControllerSource> toAssign);
AssignControllerSourcesVisitor(std::shared_ptr<ControllerSource> toAssign);
/// Assign the wanted ControllerSource. May be overridden in derived classes.
/// By default assigns the ControllerSource passed to the constructor of this class if no ControllerSource is assigned to that controller yet.
virtual void visit(osg::Node& node, Controller& ctrl);
private:
boost::shared_ptr<ControllerSource> mToAssign;
std::shared_ptr<ControllerSource> mToAssign;
};
/// Finds the maximum of all controller functions in the given scene graph

@ -3,7 +3,6 @@
#include "audiodecoder.hpp"
#include <boost/shared_ptr.hpp>
namespace Video
{
@ -11,7 +10,7 @@ namespace Video
class MovieAudioFactory
{
public:
virtual boost::shared_ptr<MovieAudioDecoder> createDecoder(VideoState* videoState) = 0;
virtual std::shared_ptr<MovieAudioDecoder> createDecoder(VideoState* videoState) = 0;
virtual ~MovieAudioFactory() {}
};

@ -27,7 +27,7 @@ void VideoPlayer::setAudioFactory(MovieAudioFactory *factory)
mAudioFactory.reset(factory);
}
void VideoPlayer::playVideo(boost::shared_ptr<std::istream> inputstream, const std::string& name)
void VideoPlayer::playVideo(std::shared_ptr<std::istream> inputstream, const std::string& name)
{
if(mState)
close();

@ -44,7 +44,7 @@ namespace Video
/// Play the given video. If a video is already playing, the old video is closed first.
/// @note The video will be unpaused by default. Use the pause() and play() methods to control pausing.
/// @param name A name for the video stream - only used for logging purposes.
void playVideo (boost::shared_ptr<std::istream> inputstream, const std::string& name);
void playVideo (std::shared_ptr<std::istream> inputstream, const std::string& name);
/// Get the current playback time position in the video, in seconds
double getCurrentTime();

@ -626,7 +626,7 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx)
return 0;
}
void VideoState::init(boost::shared_ptr<std::istream> inputstream, const std::string &name)
void VideoState::init(std::shared_ptr<std::istream> inputstream, const std::string &name)
{
int video_index = -1;
int audio_index = -1;

@ -94,7 +94,7 @@ struct VideoState {
void setAudioFactory(MovieAudioFactory* factory);
void init(boost::shared_ptr<std::istream> inputstream, const std::string& name);
void init(std::shared_ptr<std::istream> inputstream, const std::string& name);
void deinit();
void setPaused(bool isPaused);
@ -127,11 +127,11 @@ struct VideoState {
osg::ref_ptr<osg::Texture2D> mTexture;
MovieAudioFactory* mAudioFactory;
boost::shared_ptr<MovieAudioDecoder> mAudioDecoder;
std::shared_ptr<MovieAudioDecoder> mAudioDecoder;
ExternalClock mExternalClock;
boost::shared_ptr<std::istream> stream;
std::shared_ptr<std::istream> stream;
AVFormatContext* format_ctx;
int av_sync_type;

Loading…
Cancel
Save