mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-01 00:15:51 +00:00
Rename to SharedObjectArray
Conflicts: Builds/VisualStudio2012/RippleD.vcxproj.filters
This commit is contained in:
@@ -120,7 +120,7 @@
|
||||
<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_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_SharedTable.h" />
|
||||
<ClInclude Include="..\..\modules\beast_core\containers\beast_SortedLookupTable.h" />
|
||||
|
||||
@@ -160,9 +160,6 @@
|
||||
<ClInclude Include="..\..\modules\beast_core\containers\beast_PropertySet.h">
|
||||
<Filter>beast_core\containers</Filter>
|
||||
</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">
|
||||
<Filter>beast_core\containers</Filter>
|
||||
</ClInclude>
|
||||
@@ -623,6 +620,9 @@
|
||||
<ClInclude Include="..\..\modules\beast_crypto\beast_crypto.h">
|
||||
<Filter>beast_crypto</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\beast_core\containers\beast_SharedObjectArray.h">
|
||||
<Filter>beast_core\containers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\modules\beast_core\beast_core.cpp">
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace beast
|
||||
#include "containers/beast_NamedValueSet.h"
|
||||
#include "containers/beast_OwnedArray.h"
|
||||
#include "containers/beast_PropertySet.h"
|
||||
#include "containers/beast_ReferenceCountedArray.h"
|
||||
#include "containers/beast_SharedObjectArray.h"
|
||||
#include "containers/beast_ScopedValueSetter.h"
|
||||
#include "containers/beast_SharedTable.h"
|
||||
#include "containers/beast_SortedLookupTable.h"
|
||||
|
||||
@@ -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 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
|
||||
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
|
||||
TypeOfCriticalSectionToUse parameter, instead of the default DummyCriticalSection.
|
||||
|
||||
@see OwnedArray, ReferenceCountedArray, StringArray, CriticalSection
|
||||
@see OwnedArray, SharedObjectArray, StringArray, CriticalSection
|
||||
*/
|
||||
template <typename ElementType,
|
||||
typename TypeOfCriticalSectionToUse = DummyCriticalSection,
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
It inherits from a critical section class to allow the arrays to use
|
||||
the "empty base class optimisation" pattern to reduce their footprint.
|
||||
|
||||
@see Array, OwnedArray, ReferenceCountedArray
|
||||
@see Array, OwnedArray, SharedObjectArray
|
||||
*/
|
||||
template <class ElementType, class TypeOfCriticalSectionToUse>
|
||||
class ArrayAllocationBase
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
To make all the array's methods thread-safe, pass in "CriticalSection" as the templated
|
||||
TypeOfCriticalSectionToUse parameter, instead of the default DummyCriticalSection.
|
||||
|
||||
@see Array, ReferenceCountedArray, StringArray, CriticalSection
|
||||
@see Array, SharedObjectArray, StringArray, CriticalSection
|
||||
*/
|
||||
template <class ObjectClass,
|
||||
class TypeOfCriticalSectionToUse = DummyCriticalSection>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
/**
|
||||
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
|
||||
are added and removed from the array.
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
@see Array, OwnedArray, StringArray
|
||||
*/
|
||||
template <class ObjectClass, class TypeOfCriticalSectionToUse = DummyCriticalSection>
|
||||
class ReferenceCountedArray
|
||||
class SharedObjectArray
|
||||
{
|
||||
public:
|
||||
typedef SharedObjectPtr<ObjectClass> ObjectClassPtr;
|
||||
@@ -53,13 +53,13 @@ public:
|
||||
/** Creates an empty array.
|
||||
@see SharedObject, Array, OwnedArray
|
||||
*/
|
||||
ReferenceCountedArray() noexcept
|
||||
SharedObjectArray() noexcept
|
||||
: numUsed (0)
|
||||
{
|
||||
}
|
||||
|
||||
/** Creates a copy of another array */
|
||||
ReferenceCountedArray (const ReferenceCountedArray& other) noexcept
|
||||
SharedObjectArray (const SharedObjectArray& other) noexcept
|
||||
{
|
||||
const ScopedLockType lock (other.getLock());
|
||||
numUsed = other.size();
|
||||
@@ -73,9 +73,9 @@ public:
|
||||
|
||||
/** Creates a copy of another array */
|
||||
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();
|
||||
data.setAllocatedSize (numUsed);
|
||||
memcpy (data.elements, other.getRawDataPointer(), numUsed * sizeof (ObjectClass*));
|
||||
@@ -88,9 +88,9 @@ public:
|
||||
/** Copies another array into this one.
|
||||
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);
|
||||
return *this;
|
||||
}
|
||||
@@ -99,9 +99,9 @@ public:
|
||||
Any existing objects in this array will first be released.
|
||||
*/
|
||||
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);
|
||||
return *this;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
/** Destructor.
|
||||
Any objects in the array will be released, and may be deleted if not referenced from elsewhere.
|
||||
*/
|
||||
~ReferenceCountedArray()
|
||||
~SharedObjectArray()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
@@ -409,7 +409,7 @@ public:
|
||||
all available elements will be copied.
|
||||
@see add
|
||||
*/
|
||||
void addArray (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
|
||||
void addArray (const SharedObjectArray<ObjectClass, TypeOfCriticalSectionToUse>& arrayToAddFrom,
|
||||
int startIndex = 0,
|
||||
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
|
||||
because it just swaps their internal pointers.
|
||||
*/
|
||||
void swapWithArray (ReferenceCountedArray& otherArray) noexcept
|
||||
void swapWithArray (SharedObjectArray& otherArray) noexcept
|
||||
{
|
||||
const ScopedLockType lock1 (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
|
||||
*/
|
||||
bool operator== (const ReferenceCountedArray& other) const noexcept
|
||||
bool operator== (const SharedObjectArray& other) const noexcept
|
||||
{
|
||||
const ScopedLockType lock2 (other.getLock());
|
||||
const ScopedLockType lock1 (getLock());
|
||||
@@ -773,7 +773,7 @@ public:
|
||||
|
||||
@see operator==
|
||||
*/
|
||||
bool operator!= (const ReferenceCountedArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const noexcept
|
||||
bool operator!= (const SharedObjectArray<ObjectClass, TypeOfCriticalSectionToUse>& other) const noexcept
|
||||
{
|
||||
return ! operator== (other);
|
||||
}
|
||||
@@ -53,7 +53,7 @@
|
||||
To make all the set's methods thread-safe, pass in "CriticalSection" as the templated
|
||||
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>
|
||||
class SortedSet
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
the pointers can be passed between threads safely. For a faster but non-thread-safe
|
||||
version, use SingleThreadedSharedObject instead.
|
||||
|
||||
@see SharedObjectPtr, ReferenceCountedArray, SingleThreadedSharedObject
|
||||
@see SharedObjectPtr, SharedObjectArray, SingleThreadedSharedObject
|
||||
*/
|
||||
class BEAST_API SharedObject : Uncopyable
|
||||
{
|
||||
@@ -126,7 +126,7 @@ private:
|
||||
efficient).
|
||||
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
|
||||
{
|
||||
|
||||
@@ -122,7 +122,7 @@ private:
|
||||
This is currently used by some templated classes, and most compilers should
|
||||
manage to optimise it out of existence.
|
||||
|
||||
@see CriticalSection, Array, OwnedArray, ReferenceCountedArray
|
||||
@see CriticalSection, Array, OwnedArray, SharedObjectArray
|
||||
*/
|
||||
class BEAST_API DummyCriticalSection : Uncopyable
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user