Rename to SharedObjectArray

Conflicts:
	Builds/VisualStudio2012/RippleD.vcxproj.filters
This commit is contained in:
Vinnie Falco
2013-07-14 17:41:02 -07:00
parent e363cbe542
commit 5c691c0883
10 changed files with 28 additions and 28 deletions

View File

@@ -120,7 +120,7 @@
<ClInclude Include="..\..\modules\beast_core\containers\beast_NamedValueSet.h" /> <ClInclude Include="..\..\modules\beast_core\containers\beast_NamedValueSet.h" />
<ClInclude Include="..\..\modules\beast_core\containers\beast_OwnedArray.h" /> <ClInclude Include="..\..\modules\beast_core\containers\beast_OwnedArray.h" />
<ClInclude Include="..\..\modules\beast_core\containers\beast_PropertySet.h" /> <ClInclude Include="..\..\modules\beast_core\containers\beast_PropertySet.h" />
<ClInclude Include="..\..\modules\beast_core\containers\beast_ReferenceCountedArray.h" /> <ClInclude Include="..\..\modules\beast_core\containers\beast_SharedObjectArray.h" />
<ClInclude Include="..\..\modules\beast_core\containers\beast_ScopedValueSetter.h" /> <ClInclude Include="..\..\modules\beast_core\containers\beast_ScopedValueSetter.h" />
<ClInclude Include="..\..\modules\beast_core\containers\beast_SharedTable.h" /> <ClInclude Include="..\..\modules\beast_core\containers\beast_SharedTable.h" />
<ClInclude Include="..\..\modules\beast_core\containers\beast_SortedLookupTable.h" /> <ClInclude Include="..\..\modules\beast_core\containers\beast_SortedLookupTable.h" />

View File

@@ -160,9 +160,6 @@
<ClInclude Include="..\..\modules\beast_core\containers\beast_PropertySet.h"> <ClInclude Include="..\..\modules\beast_core\containers\beast_PropertySet.h">
<Filter>beast_core\containers</Filter> <Filter>beast_core\containers</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\modules\beast_core\containers\beast_ReferenceCountedArray.h">
<Filter>beast_core\containers</Filter>
</ClInclude>
<ClInclude Include="..\..\modules\beast_core\containers\beast_ScopedValueSetter.h"> <ClInclude Include="..\..\modules\beast_core\containers\beast_ScopedValueSetter.h">
<Filter>beast_core\containers</Filter> <Filter>beast_core\containers</Filter>
</ClInclude> </ClInclude>
@@ -623,6 +620,9 @@
<ClInclude Include="..\..\modules\beast_crypto\beast_crypto.h"> <ClInclude Include="..\..\modules\beast_crypto\beast_crypto.h">
<Filter>beast_crypto</Filter> <Filter>beast_crypto</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\modules\beast_core\containers\beast_SharedObjectArray.h">
<Filter>beast_core\containers</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\modules\beast_core\beast_core.cpp"> <ClCompile Include="..\..\modules\beast_core\beast_core.cpp">

View File

@@ -239,7 +239,7 @@ namespace beast
#include "containers/beast_NamedValueSet.h" #include "containers/beast_NamedValueSet.h"
#include "containers/beast_OwnedArray.h" #include "containers/beast_OwnedArray.h"
#include "containers/beast_PropertySet.h" #include "containers/beast_PropertySet.h"
#include "containers/beast_ReferenceCountedArray.h" #include "containers/beast_SharedObjectArray.h"
#include "containers/beast_ScopedValueSetter.h" #include "containers/beast_ScopedValueSetter.h"
#include "containers/beast_SharedTable.h" #include "containers/beast_SharedTable.h"
#include "containers/beast_SortedLookupTable.h" #include "containers/beast_SortedLookupTable.h"

View File

@@ -43,7 +43,7 @@
You can of course have an array of pointers to any kind of object, e.g. Array <MyClass*>, but if You can of course have an array of pointers to any kind of object, e.g. Array <MyClass*>, but if
you do this, the array doesn't take any ownership of the objects - see the OwnedArray class or the you do this, the array doesn't take any ownership of the objects - see the OwnedArray class or the
ReferenceCountedArray class for more powerful ways of holding lists of objects. SharedObjectArray class for more powerful ways of holding lists of objects.
For holding lists of strings, you can use Array\<String\>, but it's usually better to use the For holding lists of strings, you can use Array\<String\>, but it's usually better to use the
specialised class StringArray, which provides more useful functions. specialised class StringArray, which provides more useful functions.
@@ -51,7 +51,7 @@
To make all the array's methods thread-safe, pass in "CriticalSection" as the templated To make all the array's methods thread-safe, pass in "CriticalSection" as the templated
TypeOfCriticalSectionToUse parameter, instead of the default DummyCriticalSection. TypeOfCriticalSectionToUse parameter, instead of the default DummyCriticalSection.
@see OwnedArray, ReferenceCountedArray, StringArray, CriticalSection @see OwnedArray, SharedObjectArray, StringArray, CriticalSection
*/ */
template <typename ElementType, template <typename ElementType,
typename TypeOfCriticalSectionToUse = DummyCriticalSection, typename TypeOfCriticalSectionToUse = DummyCriticalSection,

View File

@@ -37,7 +37,7 @@
It inherits from a critical section class to allow the arrays to use It inherits from a critical section class to allow the arrays to use
the "empty base class optimisation" pattern to reduce their footprint. the "empty base class optimisation" pattern to reduce their footprint.
@see Array, OwnedArray, ReferenceCountedArray @see Array, OwnedArray, SharedObjectArray
*/ */
template <class ElementType, class TypeOfCriticalSectionToUse> template <class ElementType, class TypeOfCriticalSectionToUse>
class ArrayAllocationBase class ArrayAllocationBase

View File

@@ -41,7 +41,7 @@
To make all the array's methods thread-safe, pass in "CriticalSection" as the templated To make all the array's methods thread-safe, pass in "CriticalSection" as the templated
TypeOfCriticalSectionToUse parameter, instead of the default DummyCriticalSection. TypeOfCriticalSectionToUse parameter, instead of the default DummyCriticalSection.
@see Array, ReferenceCountedArray, StringArray, CriticalSection @see Array, SharedObjectArray, StringArray, CriticalSection
*/ */
template <class ObjectClass, template <class ObjectClass,
class TypeOfCriticalSectionToUse = DummyCriticalSection> class TypeOfCriticalSectionToUse = DummyCriticalSection>

View File

@@ -34,7 +34,7 @@
/** /**
Holds a list of objects derived from SharedObject. Holds a list of objects derived from SharedObject.
A ReferenceCountedArray holds objects derived from SharedObject, A SharedObjectArray holds objects derived from SharedObject,
and takes care of incrementing and decrementing their ref counts when they and takes care of incrementing and decrementing their ref counts when they
are added and removed from the array. are added and removed from the array.
@@ -44,7 +44,7 @@
@see Array, OwnedArray, StringArray @see Array, OwnedArray, StringArray
*/ */
template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection> template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
class ReferenceCountedArray class SharedObjectArray
{ {
public: public:
typedef SharedObjectPtr<ObjectClass> ObjectClassPtr; typedef SharedObjectPtr<ObjectClass> ObjectClassPtr;
@@ -53,13 +53,13 @@ public:
/** Creates an empty array. /** Creates an empty array.
@see SharedObject, Array, OwnedArray @see SharedObject, Array, OwnedArray
*/ */
ReferenceCountedArray() noexcept SharedObjectArray() noexcept
: numUsed (0) : numUsed (0)
{ {
} }
/** Creates a copy of another array */ /** Creates a copy of another array */
ReferenceCountedArray (const ReferenceCountedArray& other) noexcept SharedObjectArray (const SharedObjectArray& other) noexcept
{ {
const ScopedLockType lock (other.getLock()); const ScopedLockType lock (other.getLock());
numUsed = other.size(); numUsed = other.size();
@@ -73,9 +73,9 @@ public:
/** Creates a copy of another array */ /** Creates a copy of another array */
template <class OtherObjectClass, class OtherCriticalSection> template <class OtherObjectClass, class OtherCriticalSection>
ReferenceCountedArray (const ReferenceCountedArray<OtherObjectClass, OtherCriticalSection>& other) noexcept SharedObjectArray (const SharedObjectArray<OtherObjectClass, OtherCriticalSection>& other) noexcept
{ {
const typename ReferenceCountedArray<OtherObjectClass, OtherCriticalSection>::ScopedLockType lock (other.getLock()); const typename SharedObjectArray<OtherObjectClass, OtherCriticalSection>::ScopedLockType lock (other.getLock());
numUsed = other.size(); numUsed = other.size();
data.setAllocatedSize (numUsed); data.setAllocatedSize (numUsed);
memcpy (data.elements, other.getRawDataPointer(), numUsed * sizeof (ObjectClass*)); memcpy (data.elements, other.getRawDataPointer(), numUsed * sizeof (ObjectClass*));
@@ -88,9 +88,9 @@ public:
/** Copies another array into this one. /** Copies another array into this one.
Any existing objects in this array will first be released. Any existing objects in this array will first be released.
*/ */
ReferenceCountedArray& operator= (const ReferenceCountedArray& other) noexcept SharedObjectArray& operator= (const SharedObjectArray& other) noexcept
{ {
ReferenceCountedArray otherCopy (other); SharedObjectArray otherCopy (other);
swapWithArray (otherCopy); swapWithArray (otherCopy);
return *this; return *this;
} }
@@ -99,9 +99,9 @@ public:
Any existing objects in this array will first be released. Any existing objects in this array will first be released.
*/ */
template <class OtherObjectClass> template <class OtherObjectClass>
ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const ReferenceCountedArray<OtherObjectClass, TypeOfCriticalSectionToUse>& other) noexcept SharedObjectArray<ObjectClass, TypeOfCriticalSectionToUse>& operator= (const SharedObjectArray<OtherObjectClass, TypeOfCriticalSectionToUse>& other) noexcept
{ {
ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other); SharedObjectArray<ObjectClass, TypeOfCriticalSectionToUse> otherCopy (other);
swapWithArray (otherCopy); swapWithArray (otherCopy);
return *this; return *this;
} }
@@ -109,7 +109,7 @@ public:
/** Destructor. /** Destructor.
Any objects in the array will be released, and may be deleted if not referenced from elsewhere. Any objects in the array will be released, and may be deleted if not referenced from elsewhere.
*/ */
~ReferenceCountedArray() ~SharedObjectArray()
{ {
clear(); clear();
} }
@@ -409,7 +409,7 @@ public:
all available elements will be copied. all available elements will be copied.
@see add @see add
*/ */
void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom, void addArray (const SharedObjectArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
int startIndex = 0, int startIndex = 0,
int numElementsToAdd = -1) noexcept int numElementsToAdd = -1) noexcept
{ {
@@ -740,7 +740,7 @@ public:
If you need to exchange two arrays, this is vastly quicker than using copy-by-value If you need to exchange two arrays, this is vastly quicker than using copy-by-value
because it just swaps their internal pointers. because it just swaps their internal pointers.
*/ */
void swapWithArray (ReferenceCountedArray& otherArray) noexcept void swapWithArray (SharedObjectArray& otherArray) noexcept
{ {
const ScopedLockType lock1 (getLock()); const ScopedLockType lock1 (getLock());
const ScopedLockType lock2 (otherArray.getLock()); const ScopedLockType lock2 (otherArray.getLock());
@@ -754,7 +754,7 @@ public:
@returns true only if the other array contains the same objects in the same order @returns true only if the other array contains the same objects in the same order
*/ */
bool operator== (const ReferenceCountedArray& other) const noexcept bool operator== (const SharedObjectArray& other) const noexcept
{ {
const ScopedLockType lock2 (other.getLock()); const ScopedLockType lock2 (other.getLock());
const ScopedLockType lock1 (getLock()); const ScopedLockType lock1 (getLock());
@@ -773,7 +773,7 @@ public:
@see operator== @see operator==
*/ */
bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const noexcept bool operator!= (const SharedObjectArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const noexcept
{ {
return ! operator== (other); return ! operator== (other);
} }

View File

@@ -53,7 +53,7 @@
To make all the set's methods thread-safe, pass in "CriticalSection" as the templated To make all the set's methods thread-safe, pass in "CriticalSection" as the templated
TypeOfCriticalSectionToUse parameter, instead of the default DummyCriticalSection. TypeOfCriticalSectionToUse parameter, instead of the default DummyCriticalSection.
@see Array, OwnedArray, ReferenceCountedArray, StringArray, CriticalSection @see Array, OwnedArray, SharedObjectArray, StringArray, CriticalSection
*/ */
template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection> template <class ElementType, class TypeOfCriticalSectionToUse = DummyCriticalSection>
class SortedSet class SortedSet

View File

@@ -57,7 +57,7 @@
the pointers can be passed between threads safely. For a faster but non-thread-safe the pointers can be passed between threads safely. For a faster but non-thread-safe
version, use SingleThreadedSharedObject instead. version, use SingleThreadedSharedObject instead.
@see SharedObjectPtr, ReferenceCountedArray, SingleThreadedSharedObject @see SharedObjectPtr, SharedObjectArray, SingleThreadedSharedObject
*/ */
class BEAST_API SharedObject : Uncopyable class BEAST_API SharedObject : Uncopyable
{ {
@@ -126,7 +126,7 @@ private:
efficient). efficient).
For more details on how to use it, see the SharedObject class notes. For more details on how to use it, see the SharedObject class notes.
@see SharedObject, SharedObjectPtr, ReferenceCountedArray @see SharedObject, SharedObjectPtr, SharedObjectArray
*/ */
class BEAST_API SingleThreadedSharedObject : public Uncopyable class BEAST_API SingleThreadedSharedObject : public Uncopyable
{ {

View File

@@ -122,7 +122,7 @@ private:
This is currently used by some templated classes, and most compilers should This is currently used by some templated classes, and most compilers should
manage to optimise it out of existence. manage to optimise it out of existence.
@see CriticalSection, Array, OwnedArray, ReferenceCountedArray @see CriticalSection, Array, OwnedArray, SharedObjectArray
*/ */
class BEAST_API DummyCriticalSection : Uncopyable class BEAST_API DummyCriticalSection : Uncopyable
{ {