Skip to content

Commit

Permalink
Main: drop custom SharedPtr indirection
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Nov 9, 2024
1 parent f0b87ee commit 643ec9c
Show file tree
Hide file tree
Showing 33 changed files with 61 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "OgreLodPrerequisites.h"
#include "OgreLodCollapseCost.h"
#include "OgreLodData.h"
#include "OgreSharedPtr.h"
#include "OgreHeaderPrefix.h"

namespace Ogre
Expand Down
1 change: 0 additions & 1 deletion Components/MeshLodGenerator/include/OgreMeshLodGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "OgreLodOutputProvider.h"
#include "OgreLodCollapseCost.h"
#include "OgreLodCollapser.h"
#include "OgreSharedPtr.h"
#include "OgreSingleton.h"
#include "OgreWorkQueue.h"

Expand Down
1 change: 0 additions & 1 deletion Components/MeshLodGenerator/src/OgreLodBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#define _LodBuffer_H__

#include "OgreLodPrerequisites.h"
#include "OgreSharedPtr.h"
#include "OgreHeaderPrefix.h"

namespace Ogre
Expand Down
1 change: 0 additions & 1 deletion Components/MeshLodGenerator/src/OgreLodInputProviderMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "OgreLodPrerequisites.h"
#include "OgreLodInputProvider.h"
#include "OgreLodData.h"
#include "OgreSharedPtr.h"
#include "OgreLogManager.h"
#include "OgreRenderOperation.h"
#include "OgreHeaderPrefix.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

#include "OgreLodPrerequisites.h"
#include "OgreLodOutputProvider.h"
#include "OgreSharedPtr.h"
#include "OgreHeaderPrefix.h"

namespace Ogre
Expand Down
3 changes: 1 addition & 2 deletions Components/Overlay/include/OgreFont.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ THE SOFTWARE
#include "OgreOverlayPrerequisites.h"
#include "OgreResource.h"
#include "OgreCommon.h"
#include "OgreSharedPtr.h"
#include "OgreColourValue.h"
#include "OgreException.h"

Expand Down Expand Up @@ -344,7 +343,7 @@ namespace Ogre
void _setMaterial(const MaterialPtr& mat);
};

typedef SharedPtr<Font> FontPtr;
typedef shared_ptr<Font> FontPtr;
/** @} */
/** @} */
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace RTShader {
* @{
*/

typedef SharedPtr<SubRenderStateAccessor> SubRenderStateAccessorPtr;
typedef shared_ptr<SubRenderStateAccessor> SubRenderStateAccessorPtr;

/// Computes the position of the vertex in projection space, allows using instancing
_OgreRTSSExport extern const String SRS_TRANSFORM;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ class HardwareSkinning : public SubRenderState
*/
bool addFunctionInvocations(ProgramSet* programSet) override;

SharedPtr<LinearSkinning> mLinear;
SharedPtr<DualQuaternionSkinning> mDualQuat;
SharedPtr<HardwareSkinningTechnique> mActiveTechnique;
shared_ptr<LinearSkinning> mLinear;
shared_ptr<DualQuaternionSkinning> mDualQuat;
shared_ptr<HardwareSkinningTechnique> mActiveTechnique;

///The factory which created this sub render state
const HardwareSkinningFactory* mCreator;
Expand Down
3 changes: 1 addition & 2 deletions Components/Terrain/include/OgreTerrainMaterialGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ THE SOFTWARE.

#include "OgreTerrainPrerequisites.h"
#include "OgrePixelFormat.h"
#include "OgreSharedPtr.h"

namespace Ogre
{
Expand Down Expand Up @@ -191,7 +190,7 @@ namespace Ogre

};

typedef SharedPtr<TerrainMaterialGenerator> TerrainMaterialGeneratorPtr;
typedef shared_ptr<TerrainMaterialGenerator> TerrainMaterialGeneratorPtr;

/** @} */
/** @} */
Expand Down
16 changes: 4 additions & 12 deletions OgreMain/include/Ogre.i
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ JNIEnv* OgreJNIGetEnv() {

%define SHARED_PTR(classname)
// %shared_ptr(type);
%ignore Ogre::SharedPtr<Ogre::classname >::operator const shared_ptr<Ogre::classname >&;
%template(classname ## Ptr) Ogre::SharedPtr<Ogre::classname >;
%template(classname ## Ptr) std::shared_ptr<Ogre::classname >;
%enddef

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

// Basic Data Types
%include "OgreException.h"
%ignore Ogre::SharedPtr::useCount;
%ignore Ogre::SharedPtr::bind;
%ignore Ogre::SharedPtr::getPointer;
%ignore Ogre::SharedPtr::setNull;
%ignore Ogre::SharedPtr::isNull;
%ignore Ogre::SharedPtr::setUseCount;
%include "OgreSharedPtr.h"
%ignore Ogre::Any::getType; // deprecated
%ignore Ogre::Any::destroy; // deprecated
%ignore Ogre::Any::isEmpty; // deprecated
Expand All @@ -284,7 +276,7 @@ ADD_REPR(Radian)
%template(RayTestResult) std::pair<bool, float>;
%include "OgreStringVector.h"
%template(StringList) std::vector<Ogre::String>; // actual vector<T>
%template(StringListPtr) Ogre::SharedPtr<std::vector<Ogre::String> >;
%template(StringListPtr) std::shared_ptr<std::vector<Ogre::String> >;
%include "OgreFileSystemLayer.h"
// Linear Algebra
%ignore Ogre::Vector<2, Ogre::Real>::Vector(float, float, float);
Expand Down Expand Up @@ -607,8 +599,8 @@ SHARED_PTR(StringInterface);
%ignore Ogre::TextureUnitState::setAnimatedTextureName( const String* const, size_t, Real = 0 );
%include "OgreTextureUnitState.h"
%template(ControllerFloat) Ogre::Controller<float>;
%template(ControllerValueFloatPtr) Ogre::SharedPtr<Ogre::ControllerValue<float> >;
%template(ControllerFunctionPtr) Ogre::SharedPtr<Ogre::ControllerFunction<float> >;
%template(ControllerValueFloatPtr) std::shared_ptr<Ogre::ControllerValue<float> >;
%template(ControllerFunctionPtr) std::shared_ptr<Ogre::ControllerFunction<float> >;
%include "OgreControllerManager.h"
%include "OgrePredefinedControllers.h"
SHARED_PTR(Compositor);
Expand Down
2 changes: 1 addition & 1 deletion OgreMain/include/OgreArchive.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace Ogre {
};

typedef std::vector<FileInfo> FileInfoList;
typedef SharedPtr<FileInfoList> FileInfoListPtr;
typedef shared_ptr<FileInfoList> FileInfoListPtr;

/** Archive-handling class.
Expand Down
24 changes: 11 additions & 13 deletions OgreMain/include/OgreController.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ THE SOFTWARE.

#include "OgrePrerequisites.h"

#include "OgreSharedPtr.h"

namespace Ogre {

/** \addtogroup Core
Expand Down Expand Up @@ -130,11 +128,11 @@ namespace Ogre {
{
protected:
/// Source value
SharedPtr< ControllerValue<T> > mSource;
shared_ptr< ControllerValue<T> > mSource;
/// Destination value
SharedPtr< ControllerValue<T> > mDest;
shared_ptr< ControllerValue<T> > mDest;
/// Function
SharedPtr< ControllerFunction<T> > mFunc;
shared_ptr< ControllerFunction<T> > mFunc;
/// Controller is enabled or not
bool mEnabled;

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


/// Sets the input controller value
void setSource(const SharedPtr< ControllerValue<T> >& src)
void setSource(const shared_ptr< ControllerValue<T> >& src)
{
mSource = src;
}
/// Gets the input controller value
const SharedPtr< ControllerValue<T> >& getSource(void) const
const shared_ptr< ControllerValue<T> >& getSource(void) const
{
return mSource;
}
/// Sets the output controller value
void setDestination(const SharedPtr< ControllerValue<T> >& dest)
void setDestination(const shared_ptr< ControllerValue<T> >& dest)
{
mDest = dest;
}

/// Gets the output controller value
const SharedPtr< ControllerValue<T> >& getDestination(void) const
const shared_ptr< ControllerValue<T> >& getDestination(void) const
{
return mDest;
}
Expand All @@ -194,14 +192,14 @@ namespace Ogre {

/** Sets the function object to be used by this controller.
*/
void setFunction(const SharedPtr< ControllerFunction<T> >& func)
void setFunction(const shared_ptr< ControllerFunction<T> >& func)
{
mFunc = func;
}

/** Returns a pointer to the function object used by this controller.
*/
const SharedPtr< ControllerFunction<T> >& getFunction(void) const
const shared_ptr< ControllerFunction<T> >& getFunction(void) const
{
return mFunc;
}
Expand Down
5 changes: 2 additions & 3 deletions OgreMain/include/OgreControllerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ THE SOFTWARE.
#include "OgreCommon.h"
#include "OgreSingleton.h"
#include "OgreTextureUnitState.h"
#include "OgreSharedPtr.h"
#include "OgreHeaderPrefix.h"

namespace Ogre {
Expand All @@ -44,8 +43,8 @@ namespace Ogre {
* @{
*/

typedef SharedPtr< ControllerValue<float> > ControllerValueRealPtr;
typedef SharedPtr< ControllerFunction<float> > ControllerFunctionRealPtr;
typedef shared_ptr< ControllerValue<float> > ControllerValueRealPtr;
typedef shared_ptr< ControllerFunction<float> > ControllerFunctionRealPtr;

/** Class for managing Controller instances.
Expand Down
1 change: 0 additions & 1 deletion OgreMain/include/OgreDataStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ THE SOFTWARE.
#define __DataStream_H__

#include "OgrePrerequisites.h"
#include "OgreSharedPtr.h"
#include <istream>
#include "OgreHeaderPrefix.h"

Expand Down
1 change: 0 additions & 1 deletion OgreMain/include/OgreGpuProgram.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ THE SOFTWARE.
#include "OgreGpuProgramParams.h"
#include "OgreHeaderPrefix.h"
#include "OgreVector.h"
#include "OgreSharedPtr.h"

namespace Ogre {

Expand Down
1 change: 0 additions & 1 deletion OgreMain/include/OgreGpuProgramParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Copyright (c) 2000-2014 Torus Knot Software Ltd

// Precompiler options
#include "OgrePrerequisites.h"
#include "OgreSharedPtr.h"
#include "OgreSerializer.h"
#include "OgreAny.h"
#include "Threading/OgreThreadHeaders.h"
Expand Down
8 changes: 4 additions & 4 deletions OgreMain/include/OgreHardwareBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,11 @@ namespace Ogre {
: pBuf(0), pData(0) { lock(p, offset, length, options); }

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

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

~HardwareBufferLockGuard() { unlock(); }
Expand Down Expand Up @@ -438,11 +438,11 @@ namespace Ogre {
}

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

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

HardwareBuffer* pBuf;
Expand Down
1 change: 0 additions & 1 deletion OgreMain/include/OgreHardwareIndexBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ THE SOFTWARE.
// Precompiler options
#include "OgrePrerequisites.h"
#include "OgreHardwareBuffer.h"
#include "OgreSharedPtr.h"

namespace Ogre {
class HardwareBufferManagerBase;
Expand Down
1 change: 0 additions & 1 deletion OgreMain/include/OgreHardwarePixelBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ THE SOFTWARE.
#include "OgrePrerequisites.h"
#include "OgreHardwareBuffer.h"
#include "OgreImage.h"
#include "OgreSharedPtr.h"
#include "OgreHeaderPrefix.h"

namespace Ogre {
Expand Down
1 change: 0 additions & 1 deletion OgreMain/include/OgreHardwareVertexBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ THE SOFTWARE.
// Precompiler options
#include "OgrePrerequisites.h"
#include "OgreHardwareBuffer.h"
#include "OgreSharedPtr.h"
#include "OgreColourValue.h"
#include "OgreHeaderPrefix.h"

Expand Down
1 change: 0 additions & 1 deletion OgreMain/include/OgreMaterial.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ THE SOFTWARE.
#include "OgreColourValue.h"
#include "OgreBlendMode.h"
#include "OgreHeaderPrefix.h"
#include "OgreSharedPtr.h"

namespace Ogre {

Expand Down
1 change: 0 additions & 1 deletion OgreMain/include/OgreMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ THE SOFTWARE.
#include "OgreAnimation.h"
#include "OgreAnimationTrack.h"
#include "OgreHeaderPrefix.h"
#include "OgreSharedPtr.h"
#include "OgreUserObjectBindings.h"
#include "OgreVertexIndexData.h"

Expand Down
46 changes: 24 additions & 22 deletions OgreMain/include/OgrePrerequisites.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,29 +287,31 @@ OGRE_DEBUG_NS_END

using std::shared_ptr;
using std::unique_ptr;
template<typename T> class SharedPtr;

typedef SharedPtr<AnimableValue> AnimableValuePtr;
typedef SharedPtr<Compositor> CompositorPtr;
typedef SharedPtr<DataStream> DataStreamPtr;
typedef SharedPtr<GpuProgram> GpuProgramPtr;
typedef SharedPtr<GpuNamedConstants> GpuNamedConstantsPtr;
typedef SharedPtr<GpuLogicalBufferStruct> GpuLogicalBufferStructPtr;
typedef SharedPtr<GpuSharedParameters> GpuSharedParametersPtr;
typedef SharedPtr<GpuProgramParameters> GpuProgramParametersPtr;
typedef SharedPtr<HardwareBuffer> HardwareBufferPtr;
typedef SharedPtr<HardwareIndexBuffer> HardwareIndexBufferPtr;
typedef SharedPtr<HardwarePixelBuffer> HardwarePixelBufferPtr;
typedef SharedPtr<HardwareVertexBuffer> HardwareVertexBufferPtr;
typedef SharedPtr<Material> MaterialPtr;
typedef SharedPtr<MemoryDataStream> MemoryDataStreamPtr;
typedef SharedPtr<Mesh> MeshPtr;
typedef SharedPtr<PatchMesh> PatchMeshPtr;
typedef SharedPtr<RenderToVertexBuffer> RenderToVertexBufferPtr;
typedef SharedPtr<Resource> ResourcePtr;
typedef SharedPtr<ShadowCameraSetup> ShadowCameraSetupPtr;
typedef SharedPtr<Skeleton> SkeletonPtr;
typedef SharedPtr<Texture> TexturePtr;
using std::static_pointer_cast;
using std::dynamic_pointer_cast;

typedef shared_ptr<AnimableValue> AnimableValuePtr;
typedef shared_ptr<Compositor> CompositorPtr;
typedef shared_ptr<DataStream> DataStreamPtr;
typedef shared_ptr<GpuProgram> GpuProgramPtr;
typedef shared_ptr<GpuNamedConstants> GpuNamedConstantsPtr;
typedef shared_ptr<GpuLogicalBufferStruct> GpuLogicalBufferStructPtr;
typedef shared_ptr<GpuSharedParameters> GpuSharedParametersPtr;
typedef shared_ptr<GpuProgramParameters> GpuProgramParametersPtr;
typedef shared_ptr<HardwareBuffer> HardwareBufferPtr;
typedef shared_ptr<HardwareIndexBuffer> HardwareIndexBufferPtr;
typedef shared_ptr<HardwarePixelBuffer> HardwarePixelBufferPtr;
typedef shared_ptr<HardwareVertexBuffer> HardwareVertexBufferPtr;
typedef shared_ptr<Material> MaterialPtr;
typedef shared_ptr<MemoryDataStream> MemoryDataStreamPtr;
typedef shared_ptr<Mesh> MeshPtr;
typedef shared_ptr<PatchMesh> PatchMeshPtr;
typedef shared_ptr<RenderToVertexBuffer> RenderToVertexBufferPtr;
typedef shared_ptr<Resource> ResourcePtr;
typedef shared_ptr<ShadowCameraSetup> ShadowCameraSetupPtr;
typedef shared_ptr<Skeleton> SkeletonPtr;
typedef shared_ptr<Texture> TexturePtr;

typedef RenderToVertexBufferPtr RenderToVertexBufferSharedPtr; //!< @deprecated
typedef HardwareIndexBufferPtr HardwareIndexBufferSharedPtr; //!< @deprecated
Expand Down
Loading

0 comments on commit 643ec9c

Please sign in to comment.