Skip to content

Commit 7bb8fa4

Browse files
committed
Main: drop custom SharedPtr indirection
1 parent a968b2b commit 7bb8fa4

39 files changed

+78
-112
lines changed

Components/MeshLodGenerator/include/OgreLodCollapseCostOutside.h

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "OgreLodPrerequisites.h"
3434
#include "OgreLodCollapseCost.h"
3535
#include "OgreLodData.h"
36-
#include "OgreSharedPtr.h"
3736
#include "OgreHeaderPrefix.h"
3837

3938
namespace Ogre

Components/MeshLodGenerator/include/OgreMeshLodGenerator.h

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "OgreLodOutputProvider.h"
3737
#include "OgreLodCollapseCost.h"
3838
#include "OgreLodCollapser.h"
39-
#include "OgreSharedPtr.h"
4039
#include "OgreSingleton.h"
4140
#include "OgreWorkQueue.h"
4241

Components/MeshLodGenerator/src/OgreLodBuffer.h

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#define _LodBuffer_H__
3131

3232
#include "OgreLodPrerequisites.h"
33-
#include "OgreSharedPtr.h"
3433
#include "OgreHeaderPrefix.h"
3534

3635
namespace Ogre

Components/MeshLodGenerator/src/OgreLodInputProviderMesh.h

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "OgreLodPrerequisites.h"
3434
#include "OgreLodInputProvider.h"
3535
#include "OgreLodData.h"
36-
#include "OgreSharedPtr.h"
3736
#include "OgreLogManager.h"
3837
#include "OgreRenderOperation.h"
3938
#include "OgreHeaderPrefix.h"

Components/MeshLodGenerator/src/OgreLodOutputProviderMesh.h

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
#include "OgreLodPrerequisites.h"
3434
#include "OgreLodOutputProvider.h"
35-
#include "OgreSharedPtr.h"
3635
#include "OgreHeaderPrefix.h"
3736

3837
namespace Ogre

Components/Overlay/include/OgreFont.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ THE SOFTWARE
3030
#include "OgreOverlayPrerequisites.h"
3131
#include "OgreResource.h"
3232
#include "OgreCommon.h"
33-
#include "OgreSharedPtr.h"
3433
#include "OgreColourValue.h"
3534
#include "OgreException.h"
3635

@@ -344,7 +343,7 @@ namespace Ogre
344343
void _setMaterial(const MaterialPtr& mat);
345344
};
346345

347-
typedef SharedPtr<Font> FontPtr;
346+
typedef shared_ptr<Font> FontPtr;
348347
/** @} */
349348
/** @} */
350349
}

Components/RTShaderSystem/include/OgreShaderSubRenderState.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace RTShader {
4040
* @{
4141
*/
4242

43-
typedef SharedPtr<SubRenderStateAccessor> SubRenderStateAccessorPtr;
43+
typedef shared_ptr<SubRenderStateAccessor> SubRenderStateAccessorPtr;
4444

4545
/// Computes the position of the vertex in projection space, allows using instancing
4646
_OgreRTSSExport extern const String SRS_TRANSFORM;

Components/RTShaderSystem/src/OgreShaderExHardwareSkinningTechnique.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,9 @@ class HardwareSkinning : public SubRenderState
249249
*/
250250
bool addFunctionInvocations(ProgramSet* programSet) override;
251251

252-
SharedPtr<LinearSkinning> mLinear;
253-
SharedPtr<DualQuaternionSkinning> mDualQuat;
254-
SharedPtr<HardwareSkinningTechnique> mActiveTechnique;
252+
shared_ptr<LinearSkinning> mLinear;
253+
shared_ptr<DualQuaternionSkinning> mDualQuat;
254+
shared_ptr<HardwareSkinningTechnique> mActiveTechnique;
255255

256256
///The factory which created this sub render state
257257
const HardwareSkinningFactory* mCreator;

Components/Terrain/include/OgreTerrainMaterialGenerator.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ THE SOFTWARE.
3131

3232
#include "OgreTerrainPrerequisites.h"
3333
#include "OgrePixelFormat.h"
34-
#include "OgreSharedPtr.h"
3534

3635
namespace Ogre
3736
{
@@ -191,7 +190,7 @@ namespace Ogre
191190

192191
};
193192

194-
typedef SharedPtr<TerrainMaterialGenerator> TerrainMaterialGeneratorPtr;
193+
typedef shared_ptr<TerrainMaterialGenerator> TerrainMaterialGeneratorPtr;
195194

196195
/** @} */
197196
/** @} */

OgreMain/include/Ogre.i

+4-12
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ JNIEnv* OgreJNIGetEnv() {
160160

161161
%define SHARED_PTR(classname)
162162
// %shared_ptr(type);
163-
%ignore Ogre::SharedPtr<Ogre::classname >::operator const shared_ptr<Ogre::classname >&;
164-
%template(classname ## Ptr) Ogre::SharedPtr<Ogre::classname >;
163+
%template(classname ## Ptr) std::shared_ptr<Ogre::classname >;
165164
%enddef
166165

167166
%ignore *::operator[];
@@ -266,13 +265,6 @@ ADD_REPR(TRect)
266265

267266
// Basic Data Types
268267
%include "OgreException.h"
269-
%ignore Ogre::SharedPtr::useCount;
270-
%ignore Ogre::SharedPtr::bind;
271-
%ignore Ogre::SharedPtr::getPointer;
272-
%ignore Ogre::SharedPtr::setNull;
273-
%ignore Ogre::SharedPtr::isNull;
274-
%ignore Ogre::SharedPtr::setUseCount;
275-
%include "OgreSharedPtr.h"
276268
%ignore Ogre::Any::getType; // deprecated
277269
%ignore Ogre::Any::destroy; // deprecated
278270
%ignore Ogre::Any::isEmpty; // deprecated
@@ -284,7 +276,7 @@ ADD_REPR(Radian)
284276
%template(RayTestResult) std::pair<bool, float>;
285277
%include "OgreStringVector.h"
286278
%template(StringList) std::vector<Ogre::String>; // actual vector<T>
287-
%template(StringListPtr) Ogre::SharedPtr<std::vector<Ogre::String> >;
279+
%template(StringListPtr) std::shared_ptr<std::vector<Ogre::String> >;
288280
%include "OgreFileSystemLayer.h"
289281
// Linear Algebra
290282
%ignore Ogre::Vector<2, Ogre::Real>::Vector(float, float, float);
@@ -607,8 +599,8 @@ SHARED_PTR(StringInterface);
607599
%ignore Ogre::TextureUnitState::setAnimatedTextureName( const String* const, size_t, Real = 0 );
608600
%include "OgreTextureUnitState.h"
609601
%template(ControllerFloat) Ogre::Controller<float>;
610-
%template(ControllerValueFloatPtr) Ogre::SharedPtr<Ogre::ControllerValue<float> >;
611-
%template(ControllerFunctionPtr) Ogre::SharedPtr<Ogre::ControllerFunction<float> >;
602+
%template(ControllerValueFloatPtr) std::shared_ptr<Ogre::ControllerValue<float> >;
603+
%template(ControllerFunctionPtr) std::shared_ptr<Ogre::ControllerFunction<float> >;
612604
%include "OgreControllerManager.h"
613605
%include "OgrePredefinedControllers.h"
614606
SHARED_PTR(Compositor);

OgreMain/include/OgreArchive.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ namespace Ogre {
6464
};
6565

6666
typedef std::vector<FileInfo> FileInfoList;
67-
typedef SharedPtr<FileInfoList> FileInfoListPtr;
67+
typedef shared_ptr<FileInfoList> FileInfoListPtr;
6868

6969
/** Archive-handling class.
7070

OgreMain/include/OgreController.h

+11-13
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ THE SOFTWARE.
3030

3131
#include "OgrePrerequisites.h"
3232

33-
#include "OgreSharedPtr.h"
34-
3533
namespace Ogre {
3634

3735
/** \addtogroup Core
@@ -130,11 +128,11 @@ namespace Ogre {
130128
{
131129
protected:
132130
/// Source value
133-
SharedPtr< ControllerValue<T> > mSource;
131+
shared_ptr< ControllerValue<T> > mSource;
134132
/// Destination value
135-
SharedPtr< ControllerValue<T> > mDest;
133+
shared_ptr< ControllerValue<T> > mDest;
136134
/// Function
137-
SharedPtr< ControllerFunction<T> > mFunc;
135+
shared_ptr< ControllerFunction<T> > mFunc;
138136
/// Controller is enabled or not
139137
bool mEnabled;
140138

@@ -146,8 +144,8 @@ namespace Ogre {
146144
Requires source and destination values, and a function object. None of these are destroyed
147145
with the Controller when it is deleted (they can be shared) so you must delete these as appropriate.
148146
*/
149-
Controller(const SharedPtr< ControllerValue<T> >& src,
150-
const SharedPtr< ControllerValue<T> >& dest, const SharedPtr< ControllerFunction<T> >& func)
147+
Controller(const shared_ptr< ControllerValue<T> >& src,
148+
const shared_ptr< ControllerValue<T> >& dest, const shared_ptr< ControllerFunction<T> >& func)
151149
: mSource(src), mDest(dest), mFunc(func)
152150
{
153151
mEnabled = true;
@@ -159,23 +157,23 @@ namespace Ogre {
159157

160158

161159
/// Sets the input controller value
162-
void setSource(const SharedPtr< ControllerValue<T> >& src)
160+
void setSource(const shared_ptr< ControllerValue<T> >& src)
163161
{
164162
mSource = src;
165163
}
166164
/// Gets the input controller value
167-
const SharedPtr< ControllerValue<T> >& getSource(void) const
165+
const shared_ptr< ControllerValue<T> >& getSource(void) const
168166
{
169167
return mSource;
170168
}
171169
/// Sets the output controller value
172-
void setDestination(const SharedPtr< ControllerValue<T> >& dest)
170+
void setDestination(const shared_ptr< ControllerValue<T> >& dest)
173171
{
174172
mDest = dest;
175173
}
176174

177175
/// Gets the output controller value
178-
const SharedPtr< ControllerValue<T> >& getDestination(void) const
176+
const shared_ptr< ControllerValue<T> >& getDestination(void) const
179177
{
180178
return mDest;
181179
}
@@ -194,14 +192,14 @@ namespace Ogre {
194192

195193
/** Sets the function object to be used by this controller.
196194
*/
197-
void setFunction(const SharedPtr< ControllerFunction<T> >& func)
195+
void setFunction(const shared_ptr< ControllerFunction<T> >& func)
198196
{
199197
mFunc = func;
200198
}
201199

202200
/** Returns a pointer to the function object used by this controller.
203201
*/
204-
const SharedPtr< ControllerFunction<T> >& getFunction(void) const
202+
const shared_ptr< ControllerFunction<T> >& getFunction(void) const
205203
{
206204
return mFunc;
207205
}

OgreMain/include/OgreControllerManager.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ THE SOFTWARE.
3333
#include "OgreCommon.h"
3434
#include "OgreSingleton.h"
3535
#include "OgreTextureUnitState.h"
36-
#include "OgreSharedPtr.h"
3736
#include "OgreHeaderPrefix.h"
3837

3938
namespace Ogre {
@@ -44,8 +43,8 @@ namespace Ogre {
4443
* @{
4544
*/
4645

47-
typedef SharedPtr< ControllerValue<float> > ControllerValueRealPtr;
48-
typedef SharedPtr< ControllerFunction<float> > ControllerFunctionRealPtr;
46+
typedef shared_ptr< ControllerValue<float> > ControllerValueRealPtr;
47+
typedef shared_ptr< ControllerFunction<float> > ControllerFunctionRealPtr;
4948

5049
/** Class for managing Controller instances.
5150

OgreMain/include/OgreDataStream.h

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ THE SOFTWARE.
2929
#define __DataStream_H__
3030

3131
#include "OgrePrerequisites.h"
32-
#include "OgreSharedPtr.h"
3332
#include <istream>
3433
#include "OgreHeaderPrefix.h"
3534

OgreMain/include/OgreGpuProgram.h

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ THE SOFTWARE.
3434
#include "OgreGpuProgramParams.h"
3535
#include "OgreHeaderPrefix.h"
3636
#include "OgreVector.h"
37-
#include "OgreSharedPtr.h"
3837

3938
namespace Ogre {
4039

OgreMain/include/OgreGpuProgramParams.h

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ Copyright (c) 2000-2014 Torus Knot Software Ltd
3232

3333
// Precompiler options
3434
#include "OgrePrerequisites.h"
35-
#include "OgreSharedPtr.h"
3635
#include "OgreSerializer.h"
3736
#include "OgreAny.h"
3837
#include "Threading/OgreThreadHeaders.h"

OgreMain/include/OgreHardwareBuffer.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,11 @@ namespace Ogre {
402402
: pBuf(0), pData(0) { lock(p, offset, length, options); }
403403

404404
template <typename T>
405-
HardwareBufferLockGuard(const SharedPtr<T>& p, HardwareBuffer::LockOptions options)
405+
HardwareBufferLockGuard(const shared_ptr<T>& p, HardwareBuffer::LockOptions options)
406406
: pBuf(0), pData(0) { lock(p.get(), options); }
407407

408408
template <typename T>
409-
HardwareBufferLockGuard(const SharedPtr<T>& p, size_t offset, size_t length, HardwareBuffer::LockOptions options)
409+
HardwareBufferLockGuard(const shared_ptr<T>& p, size_t offset, size_t length, HardwareBuffer::LockOptions options)
410410
: pBuf(0), pData(0) { lock(p.get(), offset, length, options); }
411411

412412
~HardwareBufferLockGuard() { unlock(); }
@@ -438,11 +438,11 @@ namespace Ogre {
438438
}
439439

440440
template <typename T>
441-
void lock(const SharedPtr<T>& p, HardwareBuffer::LockOptions options)
441+
void lock(const shared_ptr<T>& p, HardwareBuffer::LockOptions options)
442442
{ lock(p.get(), options); }
443443

444444
template <typename T>
445-
void lock(const SharedPtr<T>& p, size_t offset, size_t length, HardwareBuffer::LockOptions options)
445+
void lock(const shared_ptr<T>& p, size_t offset, size_t length, HardwareBuffer::LockOptions options)
446446
{ lock(p.get(), offset, length, options); }
447447

448448
HardwareBuffer* pBuf;

OgreMain/include/OgreHardwareIndexBuffer.h

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ THE SOFTWARE.
3131
// Precompiler options
3232
#include "OgrePrerequisites.h"
3333
#include "OgreHardwareBuffer.h"
34-
#include "OgreSharedPtr.h"
3534

3635
namespace Ogre {
3736
class HardwareBufferManagerBase;

OgreMain/include/OgreHardwarePixelBuffer.h

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ THE SOFTWARE.
3232
#include "OgrePrerequisites.h"
3333
#include "OgreHardwareBuffer.h"
3434
#include "OgreImage.h"
35-
#include "OgreSharedPtr.h"
3635
#include "OgreHeaderPrefix.h"
3736

3837
namespace Ogre {

OgreMain/include/OgreHardwareVertexBuffer.h

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ THE SOFTWARE.
3131
// Precompiler options
3232
#include "OgrePrerequisites.h"
3333
#include "OgreHardwareBuffer.h"
34-
#include "OgreSharedPtr.h"
3534
#include "OgreColourValue.h"
3635
#include "OgreHeaderPrefix.h"
3736

OgreMain/include/OgreMaterial.h

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ THE SOFTWARE.
3535
#include "OgreColourValue.h"
3636
#include "OgreBlendMode.h"
3737
#include "OgreHeaderPrefix.h"
38-
#include "OgreSharedPtr.h"
3938

4039
namespace Ogre {
4140

OgreMain/include/OgreMesh.h

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ THE SOFTWARE.
3636
#include "OgreAnimation.h"
3737
#include "OgreAnimationTrack.h"
3838
#include "OgreHeaderPrefix.h"
39-
#include "OgreSharedPtr.h"
4039
#include "OgreUserObjectBindings.h"
4140
#include "OgreVertexIndexData.h"
4241

OgreMain/include/OgrePrerequisites.h

+24-22
Original file line numberDiff line numberDiff line change
@@ -287,29 +287,31 @@ OGRE_DEBUG_NS_END
287287

288288
using std::shared_ptr;
289289
using std::unique_ptr;
290-
template<typename T> class SharedPtr;
291290

292-
typedef SharedPtr<AnimableValue> AnimableValuePtr;
293-
typedef SharedPtr<Compositor> CompositorPtr;
294-
typedef SharedPtr<DataStream> DataStreamPtr;
295-
typedef SharedPtr<GpuProgram> GpuProgramPtr;
296-
typedef SharedPtr<GpuNamedConstants> GpuNamedConstantsPtr;
297-
typedef SharedPtr<GpuLogicalBufferStruct> GpuLogicalBufferStructPtr;
298-
typedef SharedPtr<GpuSharedParameters> GpuSharedParametersPtr;
299-
typedef SharedPtr<GpuProgramParameters> GpuProgramParametersPtr;
300-
typedef SharedPtr<HardwareBuffer> HardwareBufferPtr;
301-
typedef SharedPtr<HardwareIndexBuffer> HardwareIndexBufferPtr;
302-
typedef SharedPtr<HardwarePixelBuffer> HardwarePixelBufferPtr;
303-
typedef SharedPtr<HardwareVertexBuffer> HardwareVertexBufferPtr;
304-
typedef SharedPtr<Material> MaterialPtr;
305-
typedef SharedPtr<MemoryDataStream> MemoryDataStreamPtr;
306-
typedef SharedPtr<Mesh> MeshPtr;
307-
typedef SharedPtr<PatchMesh> PatchMeshPtr;
308-
typedef SharedPtr<RenderToVertexBuffer> RenderToVertexBufferPtr;
309-
typedef SharedPtr<Resource> ResourcePtr;
310-
typedef SharedPtr<ShadowCameraSetup> ShadowCameraSetupPtr;
311-
typedef SharedPtr<Skeleton> SkeletonPtr;
312-
typedef SharedPtr<Texture> TexturePtr;
291+
using std::static_pointer_cast;
292+
using std::dynamic_pointer_cast;
293+
294+
typedef shared_ptr<AnimableValue> AnimableValuePtr;
295+
typedef shared_ptr<Compositor> CompositorPtr;
296+
typedef shared_ptr<DataStream> DataStreamPtr;
297+
typedef shared_ptr<GpuProgram> GpuProgramPtr;
298+
typedef shared_ptr<GpuNamedConstants> GpuNamedConstantsPtr;
299+
typedef shared_ptr<GpuLogicalBufferStruct> GpuLogicalBufferStructPtr;
300+
typedef shared_ptr<GpuSharedParameters> GpuSharedParametersPtr;
301+
typedef shared_ptr<GpuProgramParameters> GpuProgramParametersPtr;
302+
typedef shared_ptr<HardwareBuffer> HardwareBufferPtr;
303+
typedef shared_ptr<HardwareIndexBuffer> HardwareIndexBufferPtr;
304+
typedef shared_ptr<HardwarePixelBuffer> HardwarePixelBufferPtr;
305+
typedef shared_ptr<HardwareVertexBuffer> HardwareVertexBufferPtr;
306+
typedef shared_ptr<Material> MaterialPtr;
307+
typedef shared_ptr<MemoryDataStream> MemoryDataStreamPtr;
308+
typedef shared_ptr<Mesh> MeshPtr;
309+
typedef shared_ptr<PatchMesh> PatchMeshPtr;
310+
typedef shared_ptr<RenderToVertexBuffer> RenderToVertexBufferPtr;
311+
typedef shared_ptr<Resource> ResourcePtr;
312+
typedef shared_ptr<ShadowCameraSetup> ShadowCameraSetupPtr;
313+
typedef shared_ptr<Skeleton> SkeletonPtr;
314+
typedef shared_ptr<Texture> TexturePtr;
313315

314316
typedef RenderToVertexBufferPtr RenderToVertexBufferSharedPtr; //!< @deprecated
315317
typedef HardwareIndexBufferPtr HardwareIndexBufferSharedPtr; //!< @deprecated

0 commit comments

Comments
 (0)