diff --git a/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj b/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj
index b0e5c99092..cfe90104b5 100644
--- a/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj
+++ b/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj
@@ -144,7 +144,7 @@
-
+
diff --git a/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj.filters b/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj.filters
index 6578ba6b12..20c4448428 100644
--- a/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj.filters
+++ b/Subtrees/beast/Builds/VisualStudio2012/beast.vcxproj.filters
@@ -229,9 +229,6 @@
beast_core\memory
-
- beast_core\memory
- beast_core\memory
@@ -608,6 +605,9 @@
beast_basics\events
+
+ beast_core\memory
+
diff --git a/Subtrees/beast/modules/beast_basics/events/beast_DeadlineTimer.h b/Subtrees/beast/modules/beast_basics/events/beast_DeadlineTimer.h
index 2e96c5319f..7b7e1dcdfc 100644
--- a/Subtrees/beast/modules/beast_basics/events/beast_DeadlineTimer.h
+++ b/Subtrees/beast/modules/beast_basics/events/beast_DeadlineTimer.h
@@ -112,7 +112,7 @@ private:
class Manager;
Listener* const m_listener;
- ReferenceCountedObjectPtr m_manager;
+ SharedObjectPtr m_manager;
bool m_isActive;
Time m_notificationTime;
double m_secondsRecurring; // non zero if recurring
diff --git a/Subtrees/beast/modules/beast_basics/events/beast_OncePerSecond.h b/Subtrees/beast/modules/beast_basics/events/beast_OncePerSecond.h
index 24b47913db..8240c2e99a 100644
--- a/Subtrees/beast/modules/beast_basics/events/beast_OncePerSecond.h
+++ b/Subtrees/beast/modules/beast_basics/events/beast_OncePerSecond.h
@@ -48,7 +48,7 @@ protected:
private:
class TimerSingleton;
- typedef ReferenceCountedObjectPtr TimerPtr;
+ typedef SharedObjectPtr TimerPtr;
struct Elem : List ::Node
{
diff --git a/Subtrees/beast/modules/beast_basics/threads/beast_Listeners.cpp b/Subtrees/beast/modules/beast_basics/threads/beast_Listeners.cpp
index 3c1d11eec6..e2f60bcf21 100644
--- a/Subtrees/beast/modules/beast_basics/threads/beast_Listeners.cpp
+++ b/Subtrees/beast/modules/beast_basics/threads/beast_Listeners.cpp
@@ -103,10 +103,10 @@ private:
// Each Entry holds a group and the current Call (which can be updated).
//
struct ListenersBase::Proxy::Entry : Entries::Node,
- ReferenceCountedObject,
+ SharedObject,
AllocatedBy
{
- typedef ReferenceCountedObjectPtr Ptr;
+ typedef SharedObjectPtr Ptr;
explicit Entry (Group* g)
: group (g)
diff --git a/Subtrees/beast/modules/beast_basics/threads/beast_Listeners.h b/Subtrees/beast/modules/beast_basics/threads/beast_Listeners.h
index 70d798b40a..b22220775b 100644
--- a/Subtrees/beast/modules/beast_basics/threads/beast_Listeners.h
+++ b/Subtrees/beast/modules/beast_basics/threads/beast_Listeners.h
@@ -214,11 +214,11 @@ public:
typedef GlobalFifoFreeStore CallAllocatorType;
- class Call : public ReferenceCountedObject,
+ class Call : public SharedObject,
public AllocatedBy
{
public:
- typedef ReferenceCountedObjectPtr Ptr;
+ typedef SharedObjectPtr Ptr;
virtual void operator () (void* const listener) = 0;
};
@@ -238,11 +238,11 @@ private:
// Maintains a list of listeners registered on the same CallQueue
//
class Group : public Groups::Node,
- public ReferenceCountedObject,
+ public SharedObject,
public AllocatedBy
{
public:
- typedef ReferenceCountedObjectPtr Ptr;
+ typedef SharedObjectPtr Ptr;
explicit Group (CallQueue& callQueue);
~Group ();
diff --git a/Subtrees/beast/modules/beast_basics/threads/beast_SharedData.h b/Subtrees/beast/modules/beast_basics/threads/beast_SharedData.h
index 1acf172826..f02649e4c2 100644
--- a/Subtrees/beast/modules/beast_basics/threads/beast_SharedData.h
+++ b/Subtrees/beast/modules/beast_basics/threads/beast_SharedData.h
@@ -20,98 +20,97 @@
#ifndef BEAST_SHAREDDATA_H_INCLUDED
#define BEAST_SHAREDDATA_H_INCLUDED
-/*============================================================================*/
-/**
- Structured access to a shared state.
+/** Structured access to a shared state.
- This template wraps an object containing members representing state
- information shared between multiple threads of execution, where any thread
- may need to read or write as needed. Synchronized access to the concurrent
- state is enforced at compile time through strongly typed accessor classes.
- This interface design facilitates source code pattern matching to find all
- areas where a concurrent state is accessed.
+ This template wraps an object containing members representing state
+ information shared between multiple threads of execution, where any thread
+ may need to read or write as needed. Synchronized access to the concurrent
+ state is enforced at compile time through strongly typed accessor classes.
+ This interface design facilitates source code pattern matching to find all
+ areas where a concurrent state is accessed.
- There are three types of access:
+ There are three types of access:
- - ReadAccess
+ - ReadAccess
- Allows read access to the underlying object as `const`. ReadAccess may be
- granted to one or more threads simultaneously. If one or more threads have
- ReadAccess, requests to obtain WriteAccess are blocked.
+ Allows read access to the underlying object as `const`. ReadAccess may
+ be granted to one or more threads simultaneously. If one or more
+ threads have ReadAccess, requests to obtain WriteAccess are blocked.
- - WriteAccess
+ - WriteAccess
- Allows exclusive read/write access the underlying object. A WriteAccess
- request blocks until all existing ReadAccess and WriteAccess requests are
- released. While a WriteAccess exists, requests for ReadAccess will block.
+ Allows exclusive read/write access the underlying object. A WriteAccess
+ request blocks until all existing ReadAccess and WriteAccess requests
+ are released. While a WriteAccess exists, requests for ReadAccess
+ will block.
- - UnlockedAccess
+ - UnlockedAccess
- Allows read access to the underlying object without using the lock. This
- can be helpful when designing concurrent structures through composition.
- It also makes it easier to search for places in code which use unlocked
- access.
+ Allows read access to the underlying object without using the lock.
+ This can be helpful when designing concurrent structures through
+ composition. It also makes it easier to search for places in code
+ which use unlocked access.
- This code example demonstrates various forms of access to a SharedData:
+ This code example demonstrates various forms of access to a SharedData:
- @code
+ @code
- struct SharedData
- {
- int value1;
- String value2;
- };
-
- typedef SharedData SharedState;
-
- SharedState sharedState;
-
- void readExample ()
- {
- SharedState::ReadAccess state (sharedState);
-
- print (state->value1); // read access
- print (state->value2); // read access
-
- state->value1 = 42; // write disallowed: compile error
- }
-
- void writeExample ()
- {
- SharedState::WriteAccess state (sharedState);
-
- state->value2 = "Label"; // write access
- }
-
- @endcode
-
- Forwarding constructors with up to eight parameters are provided. This lets
- you write constructors into the underlying data object. For example:
-
- @code
-
- struct SharedData
- {
- explicit SharedData (int numSlots)
+ struct SharedData
{
- m_array.reserve (numSlots);
+ int value1;
+ String value2;
+ };
+
+ typedef SharedData SharedState;
+
+ SharedState sharedState;
+
+ void readExample ()
+ {
+ SharedState::ReadAccess state (sharedState);
+
+ print (state->value1); // read access
+ print (state->value2); // read access
+
+ state->value1 = 42; // write disallowed: compile error
}
- std::vector m_array;
- };
+ void writeExample ()
+ {
+ SharedState::WriteAccess state (sharedState);
- // Construct SharedData with one parameter
- SharedData sharedState (16);
+ state->value2 = "Label"; // write access
+ }
- @endcode
+ @endcode
- @param Object The type of object to encapsulate.
+ Forwarding constructors with up to eight parameters are provided. This lets
+ you write constructors into the underlying data object. For example:
- @warning Recursive calls are not supported. It is generally not possible for
- a thread of execution to acquire write access while it already has
- read access. Such an attempt will result in undefined behavior. Calling into
- unknown code while holding a lock can cause deadlock. See
- @ref CallQueue::queue().
+ @code
+
+ struct SharedData
+ {
+ explicit SharedData (int numSlots)
+ {
+ m_array.reserve (numSlots);
+ }
+
+ std::vector m_array;
+ };
+
+ // Construct SharedData with one parameter
+ SharedData sharedState (16);
+
+ @endcode
+
+ @param Object The type of object to encapsulate.
+
+ @warning Recursive calls are not supported. It is generally not possible for
+ a thread of execution to acquire write access while it already has
+ read access. Such an attempt will result in undefined behavior.
+ Calling into unknown code while holding a lock can cause deadlock.
+ See @ref CallQueue::queue().
*/
template
class SharedData : Uncopyable
diff --git a/Subtrees/beast/modules/beast_core/beast_core.h b/Subtrees/beast/modules/beast_core/beast_core.h
index 8ce82f6c26..2977bb636a 100644
--- a/Subtrees/beast/modules/beast_core/beast_core.h
+++ b/Subtrees/beast/modules/beast_core/beast_core.h
@@ -255,7 +255,7 @@ namespace beast
#include "memory/beast_Memory.h"
#include "memory/beast_MemoryBlock.h"
#include "memory/beast_OptionalScopedPointer.h"
-#include "memory/beast_ReferenceCountedObject.h"
+#include "memory/beast_SharedObject.h"
#include "memory/beast_ScopedPointer.h"
#include "threads/beast_SpinLock.h"
#include "memory/beast_SharedSingleton.h"
diff --git a/Subtrees/beast/modules/beast_core/containers/beast_DynamicObject.h b/Subtrees/beast/modules/beast_core/containers/beast_DynamicObject.h
index 66901d99bd..2b411c3cd8 100644
--- a/Subtrees/beast/modules/beast_core/containers/beast_DynamicObject.h
+++ b/Subtrees/beast/modules/beast_core/containers/beast_DynamicObject.h
@@ -25,7 +25,7 @@
#define BEAST_DYNAMICOBJECT_BEASTHEADER
#include "beast_NamedValueSet.h"
-#include "../memory/beast_ReferenceCountedObject.h"
+#include "../memory/beast_SharedObject.h"
//==============================================================================
@@ -40,7 +40,7 @@
methods.
*/
class BEAST_API DynamicObject
- : public ReferenceCountedObject
+ : public SharedObject
, LeakChecked
{
public:
@@ -50,7 +50,7 @@ public:
/** Destructor. */
virtual ~DynamicObject();
- typedef ReferenceCountedObjectPtr Ptr;
+ typedef SharedObjectPtr Ptr;
//==============================================================================
/** Returns true if the object has a property with this name.
diff --git a/Subtrees/beast/modules/beast_core/containers/beast_ReferenceCountedArray.h b/Subtrees/beast/modules/beast_core/containers/beast_ReferenceCountedArray.h
index 6df23a2c14..fa57ac029b 100644
--- a/Subtrees/beast/modules/beast_core/containers/beast_ReferenceCountedArray.h
+++ b/Subtrees/beast/modules/beast_core/containers/beast_ReferenceCountedArray.h
@@ -24,7 +24,7 @@
#ifndef BEAST_REFERENCECOUNTEDARRAY_BEASTHEADER
#define BEAST_REFERENCECOUNTEDARRAY_BEASTHEADER
-#include "../memory/beast_ReferenceCountedObject.h"
+#include "../memory/beast_SharedObject.h"
#include "beast_ArrayAllocationBase.h"
#include "beast_ElementComparator.h"
#include "../threads/beast_CriticalSection.h"
@@ -32,9 +32,9 @@
//==============================================================================
/**
- Holds a list of objects derived from ReferenceCountedObject.
+ Holds a list of objects derived from SharedObject.
- A ReferenceCountedArray holds objects derived from ReferenceCountedObject,
+ A ReferenceCountedArray holds objects derived from SharedObject,
and takes care of incrementing and decrementing their ref counts when they
are added and removed from the array.
@@ -47,11 +47,11 @@ template ObjectClassPtr;
+ typedef SharedObjectPtr ObjectClassPtr;
//==============================================================================
/** Creates an empty array.
- @see ReferenceCountedObject, Array, OwnedArray
+ @see SharedObject, Array, OwnedArray
*/
ReferenceCountedArray() noexcept
: numUsed (0)
diff --git a/Subtrees/beast/modules/beast_core/containers/beast_SharedTable.h b/Subtrees/beast/modules/beast_core/containers/beast_SharedTable.h
index 931569599a..2d375a7f45 100644
--- a/Subtrees/beast/modules/beast_core/containers/beast_SharedTable.h
+++ b/Subtrees/beast/modules/beast_core/containers/beast_SharedTable.h
@@ -156,10 +156,10 @@ public:
}
private:
- class Data : public ReferenceCountedObject
+ class Data : public SharedObject
{
public:
- typedef ReferenceCountedObjectPtr Ptr;
+ typedef SharedObjectPtr Ptr;
explicit Data (int numEntries)
: m_numEntries (numEntries)
@@ -200,7 +200,7 @@ private:
{
}
- ReferenceCountedObjectPtr m_data;
+ SharedObjectPtr m_data;
};
template
diff --git a/Subtrees/beast/modules/beast_core/containers/beast_Variant.cpp b/Subtrees/beast/modules/beast_core/containers/beast_Variant.cpp
index 4b18140fa6..bd27a10bb5 100644
--- a/Subtrees/beast/modules/beast_core/containers/beast_Variant.cpp
+++ b/Subtrees/beast/modules/beast_core/containers/beast_Variant.cpp
@@ -45,7 +45,7 @@ public:
virtual double toDouble (const ValueUnion&) const noexcept { return 0; }
virtual String toString (const ValueUnion&) const { return String::empty; }
virtual bool toBool (const ValueUnion&) const noexcept { return false; }
- virtual ReferenceCountedObject* toObject (const ValueUnion&) const noexcept { return nullptr; }
+ virtual SharedObject* toObject (const ValueUnion&) const noexcept { return nullptr; }
virtual Array* toArray (const ValueUnion&) const noexcept { return nullptr; }
virtual MemoryBlock* toBinary (const ValueUnion&) const noexcept { return nullptr; }
@@ -243,7 +243,7 @@ public:
String toString (const ValueUnion& data) const { return "Object 0x" + String::toHexString ((int) (pointer_sized_int) data.objectValue); }
bool toBool (const ValueUnion& data) const noexcept { return data.objectValue != 0; }
- ReferenceCountedObject* toObject (const ValueUnion& data) const noexcept { return data.objectValue; }
+ SharedObject* toObject (const ValueUnion& data) const noexcept { return data.objectValue; }
bool isObject() const noexcept { return true; }
bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept
@@ -388,7 +388,7 @@ var::var (const wchar_t* const v) : type (&VariantType_String::instance) { n
var::var (const void* v, size_t sz) : type (&VariantType_Binary::instance) { value.binaryValue = new MemoryBlock (v, sz); }
var::var (const MemoryBlock& v) : type (&VariantType_Binary::instance) { value.binaryValue = new MemoryBlock (v); }
-var::var (ReferenceCountedObject* const object) : type (&VariantType_Object::instance)
+var::var (SharedObject* const object) : type (&VariantType_Object::instance)
{
value.objectValue = object;
@@ -416,7 +416,7 @@ var::operator float() const noexcept { return (float) type->t
var::operator double() const noexcept { return type->toDouble (value); }
String var::toString() const { return type->toString (value); }
var::operator String() const { return type->toString (value); }
-ReferenceCountedObject* var::getObject() const noexcept { return type->toObject (value); }
+SharedObject* var::getObject() const noexcept { return type->toObject (value); }
Array* var::getArray() const noexcept { return type->toArray (value); }
MemoryBlock* var::getBinaryData() const noexcept { return type->toBinary (value); }
DynamicObject* var::getDynamicObject() const noexcept { return dynamic_cast (getObject()); }
@@ -437,7 +437,7 @@ var& var::operator= (const char* const v) { type->cleanUp (value); type =
var& var::operator= (const wchar_t* const v) { type->cleanUp (value); type = &VariantType_String::instance; new (value.stringValue) String (v); return *this; }
var& var::operator= (const String& v) { type->cleanUp (value); type = &VariantType_String::instance; new (value.stringValue) String (v); return *this; }
var& var::operator= (const Array& v) { var v2 (v); swapWith (v2); return *this; }
-var& var::operator= (ReferenceCountedObject* v) { var v2 (v); swapWith (v2); return *this; }
+var& var::operator= (SharedObject* v) { var v2 (v); swapWith (v2); return *this; }
var& var::operator= (MethodFunction v) { var v2 (v); swapWith (v2); return *this; }
#if BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS
diff --git a/Subtrees/beast/modules/beast_core/containers/beast_Variant.h b/Subtrees/beast/modules/beast_core/containers/beast_Variant.h
index 460d526da5..b362b60989 100644
--- a/Subtrees/beast/modules/beast_core/containers/beast_Variant.h
+++ b/Subtrees/beast/modules/beast_core/containers/beast_Variant.h
@@ -30,7 +30,7 @@
#include "../containers/beast_Array.h"
#ifndef DOXYGEN
- class ReferenceCountedObject;
+ class SharedObject;
class DynamicObject;
#endif
@@ -39,7 +39,7 @@
A variant class, that can be used to hold a range of primitive values.
A var object can hold a range of simple primitive values, strings, or
- any kind of ReferenceCountedObject. The var class is intended to act like
+ any kind of SharedObject. The var class is intended to act like
the kind of values used in dynamic scripting languages.
You can save/load var objects either in a small, proprietary binary format
@@ -73,7 +73,7 @@ public:
var (const wchar_t* value);
var (const String& value);
var (const Array& value);
- var (ReferenceCountedObject* object);
+ var (SharedObject* object);
var (MethodFunction method) noexcept;
var (const void* binaryData, size_t dataSize);
var (const MemoryBlock& binaryData);
@@ -87,7 +87,7 @@ public:
var& operator= (const wchar_t* value);
var& operator= (const String& value);
var& operator= (const Array& value);
- var& operator= (ReferenceCountedObject* object);
+ var& operator= (SharedObject* object);
var& operator= (MethodFunction method);
#if BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS
@@ -125,7 +125,7 @@ public:
*/
MemoryBlock* getBinaryData() const noexcept;
- ReferenceCountedObject* getObject() const noexcept;
+ SharedObject* getObject() const noexcept;
DynamicObject* getDynamicObject() const noexcept;
//==============================================================================
@@ -275,7 +275,7 @@ private:
bool boolValue;
double doubleValue;
char stringValue [sizeof (String)];
- ReferenceCountedObject* objectValue;
+ SharedObject* objectValue;
Array* arrayValue;
MemoryBlock* binaryValue;
MethodFunction methodValue;
diff --git a/Subtrees/beast/modules/beast_core/diagnostic/beast_LeakChecked.cpp b/Subtrees/beast/modules/beast_core/diagnostic/beast_LeakChecked.cpp
index a0694dd647..5173b047dc 100644
--- a/Subtrees/beast/modules/beast_core/diagnostic/beast_LeakChecked.cpp
+++ b/Subtrees/beast/modules/beast_core/diagnostic/beast_LeakChecked.cpp
@@ -78,7 +78,7 @@ void LeakCheckedBase::CounterBase::checkForLeaks ()
If you're leaking, it's probably because you're using old-fashioned,
non-RAII techniques for your object management. Tut, tut. Always,
- always use ScopedPointers, OwnedArrays, ReferenceCountedObjects,
+ always use ScopedPointers, OwnedArrays, SharedObjects,
etc, and avoid the 'delete' operator at all costs!
*/
DBG ("Leaked objects: " << count << " of " << getClassName ());
@@ -104,7 +104,7 @@ void LeakCheckedBase::reportDanglingPointer (char const* objectName)
Most errors like this are caused by using old-fashioned,
non-RAII techniques for your object management. Tut, tut.
Always, always use ScopedPointers, OwnedArrays,
- ReferenceCountedObjects, etc, and avoid the 'delete' operator
+ SharedObjects, etc, and avoid the 'delete' operator
at all costs!
*/
DBG ("Dangling pointer deletion: " << objectName);
diff --git a/Subtrees/beast/modules/beast_core/maths/beast_Expression.cpp b/Subtrees/beast/modules/beast_core/maths/beast_Expression.cpp
index 5c3dd36915..4558333631 100644
--- a/Subtrees/beast/modules/beast_core/maths/beast_Expression.cpp
+++ b/Subtrees/beast/modules/beast_core/maths/beast_Expression.cpp
@@ -22,7 +22,7 @@
//==============================================================================
class Expression::Term
- : public SingleThreadedReferenceCountedObject
+ : public SingleThreadedSharedObject
{
public:
Term() {}
@@ -30,20 +30,20 @@ public:
virtual Type getType() const noexcept = 0;
virtual Term* clone() const = 0;
- virtual ReferenceCountedObjectPtr resolve (const Scope&, int recursionDepth) = 0;
+ virtual SharedObjectPtr resolve (const Scope&, int recursionDepth) = 0;
virtual String toString() const = 0;
virtual double toDouble() const { return 0; }
virtual int getInputIndexFor (const Term*) const { return -1; }
virtual int getOperatorPrecedence() const { return 0; }
virtual int getNumInputs() const { return 0; }
virtual Term* getInput (int) const { return nullptr; }
- virtual ReferenceCountedObjectPtr negated();
+ virtual SharedObjectPtr negated();
- virtual ReferenceCountedObjectPtr createTermToEvaluateInput (const Scope&, const Term* /*inputTerm*/,
+ virtual SharedObjectPtr createTermToEvaluateInput (const Scope&, const Term* /*inputTerm*/,
double /*overallTarget*/, Term* /*topLevelTerm*/) const
{
bassertfalse;
- return ReferenceCountedObjectPtr();
+ return SharedObjectPtr();
}
virtual String getName() const
@@ -76,7 +76,7 @@ public:
//==============================================================================
struct Expression::Helpers
{
- typedef ReferenceCountedObjectPtr TermPtr;
+ typedef SharedObjectPtr TermPtr;
static void checkRecursionDepth (const int depth)
{
@@ -929,13 +929,13 @@ Expression& Expression::operator= (const Expression& other)
#if BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS
Expression::Expression (Expression&& other) noexcept
- : term (static_cast &&> (other.term))
+ : term (static_cast &&> (other.term))
{
}
Expression& Expression::operator= (Expression&& other) noexcept
{
- term = static_cast &&> (other.term);
+ term = static_cast &&> (other.term);
return *this;
}
#endif
@@ -1077,7 +1077,7 @@ int Expression::getNumInputs() const { return term->getNumInp
Expression Expression::getInput (int index) const { return Expression (term->getInput (index)); }
//==============================================================================
-ReferenceCountedObjectPtr Expression::Term::negated()
+SharedObjectPtr Expression::Term::negated()
{
return new Helpers::Negate (this);
}
diff --git a/Subtrees/beast/modules/beast_core/maths/beast_Expression.h b/Subtrees/beast/modules/beast_core/maths/beast_Expression.h
index 4147e02605..0d1456b301 100644
--- a/Subtrees/beast/modules/beast_core/maths/beast_Expression.h
+++ b/Subtrees/beast/modules/beast_core/maths/beast_Expression.h
@@ -24,7 +24,7 @@
#ifndef BEAST_EXPRESSION_BEASTHEADER
#define BEAST_EXPRESSION_BEASTHEADER
-#include "../memory/beast_ReferenceCountedObject.h"
+#include "../memory/beast_SharedObject.h"
#include "../containers/beast_Array.h"
#include "../memory/beast_ScopedPointer.h"
@@ -260,8 +260,8 @@ private:
friend class Term;
friend struct Helpers;
friend class ScopedPointer;
- friend class ReferenceCountedObjectPtr;
- ReferenceCountedObjectPtr term;
+ friend class SharedObjectPtr;
+ SharedObjectPtr term;
explicit Expression (Term*);
};
diff --git a/Subtrees/beast/modules/beast_core/memory/beast_ReferenceCountedObject.h b/Subtrees/beast/modules/beast_core/memory/beast_SharedObject.h
similarity index 69%
rename from Subtrees/beast/modules/beast_core/memory/beast_ReferenceCountedObject.h
rename to Subtrees/beast/modules/beast_core/memory/beast_SharedObject.h
index f0458ea8c8..53a4f2a8f0 100644
--- a/Subtrees/beast/modules/beast_core/memory/beast_ReferenceCountedObject.h
+++ b/Subtrees/beast/modules/beast_core/memory/beast_SharedObject.h
@@ -32,16 +32,16 @@
Adds reference-counting to an object.
To add reference-counting to a class, derive it from this class, and
- use the ReferenceCountedObjectPtr class to point to it.
+ use the SharedObjectPtr class to point to it.
e.g. @code
- class MyClass : public ReferenceCountedObject
+ class MyClass : public SharedObject
{
void foo();
// This is a neat way of declaring a typedef for a pointer class,
// rather than typing out the full templated name each time..
- typedef ReferenceCountedObjectPtr Ptr;
+ typedef SharedObjectPtr Ptr;
};
MyClass::Ptr p = new MyClass();
@@ -50,16 +50,16 @@
p2->foo();
@endcode
- Once a new ReferenceCountedObject has been assigned to a pointer, be
+ Once a new SharedObject has been assigned to a pointer, be
careful not to delete the object manually.
This class uses an Atomic value to hold the reference count, so that it
the pointers can be passed between threads safely. For a faster but non-thread-safe
- version, use SingleThreadedReferenceCountedObject instead.
+ version, use SingleThreadedSharedObject instead.
- @see ReferenceCountedObjectPtr, ReferenceCountedArray, SingleThreadedReferenceCountedObject
+ @see SharedObjectPtr, ReferenceCountedArray, SingleThreadedSharedObject
*/
-class BEAST_API ReferenceCountedObject : Uncopyable
+class BEAST_API SharedObject : Uncopyable
{
public:
//==============================================================================
@@ -92,12 +92,12 @@ public:
protected:
//==============================================================================
/** Creates the reference-counted object (with an initial ref count of zero). */
- ReferenceCountedObject()
+ SharedObject()
{
}
/** Destructor. */
- virtual ~ReferenceCountedObject()
+ virtual ~SharedObject()
{
// it's dangerous to delete an object that's still referenced by something else!
bassert (getReferenceCount() == 0);
@@ -121,14 +121,14 @@ private:
/**
Adds reference-counting to an object.
- This is effectively a version of the ReferenceCountedObject class, but which
+ This is effectively a version of the SharedObject class, but which
uses a non-atomic counter, and so is not thread-safe (but which will be more
efficient).
- For more details on how to use it, see the ReferenceCountedObject class notes.
+ For more details on how to use it, see the SharedObject class notes.
- @see ReferenceCountedObject, ReferenceCountedObjectPtr, ReferenceCountedArray
+ @see SharedObject, SharedObjectPtr, ReferenceCountedArray
*/
-class BEAST_API SingleThreadedReferenceCountedObject : public Uncopyable
+class BEAST_API SingleThreadedSharedObject : public Uncopyable
{
public:
//==============================================================================
@@ -161,10 +161,10 @@ public:
protected:
//==============================================================================
/** Creates the reference-counted object (with an initial ref count of zero). */
- SingleThreadedReferenceCountedObject() : refCount (0) {}
+ SingleThreadedSharedObject() : refCount (0) {}
/** Destructor. */
- virtual ~SingleThreadedReferenceCountedObject()
+ virtual ~SingleThreadedSharedObject()
{
// it's dangerous to delete an object that's still referenced by something else!
bassert (getReferenceCount() == 0);
@@ -181,26 +181,26 @@ private:
A smart-pointer class which points to a reference-counted object.
The template parameter specifies the class of the object you want to point to - the easiest
- way to make a class reference-countable is to simply make it inherit from ReferenceCountedObject,
+ way to make a class reference-countable is to simply make it inherit from SharedObject,
but if you need to, you could roll your own reference-countable class by implementing a pair of
mathods called incReferenceCount() and decReferenceCount().
When using this class, you'll probably want to create a typedef to abbreviate the full
templated name - e.g.
- @code typedef ReferenceCountedObjectPtr MyClassPtr;@endcode
+ @code typedef SharedObjectPtr MyClassPtr;@endcode
- @see ReferenceCountedObject, ReferenceCountedObjectArray
+ @see SharedObject, SharedObjectArray
*/
-template
-class ReferenceCountedObjectPtr
+template
+class SharedObjectPtr
{
public:
/** The class being referenced by this pointer. */
- typedef ReferenceCountedObjectClass ReferencedType;
+ typedef SharedObjectClass ReferencedType;
//==============================================================================
/** Creates a pointer to a null object. */
- inline ReferenceCountedObjectPtr() noexcept
+ inline SharedObjectPtr() noexcept
: referencedObject (nullptr)
{
}
@@ -209,7 +209,7 @@ public:
This will increment the object's reference-count if it is non-null.
*/
- inline ReferenceCountedObjectPtr (ReferenceCountedObjectClass* const refCountedObject) noexcept
+ inline SharedObjectPtr (SharedObjectClass* const refCountedObject) noexcept
: referencedObject (refCountedObject)
{
if (refCountedObject != nullptr)
@@ -219,7 +219,7 @@ public:
/** Copies another pointer.
This will increment the object's reference-count (if it is non-null).
*/
- inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr& other) noexcept
+ inline SharedObjectPtr (const SharedObjectPtr& other) noexcept
: referencedObject (other.referencedObject)
{
if (referencedObject != nullptr)
@@ -228,7 +228,7 @@ public:
#if BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS
/** Takes-over the object from another pointer. */
- inline ReferenceCountedObjectPtr (ReferenceCountedObjectPtr&& other) noexcept
+ inline SharedObjectPtr (SharedObjectPtr&& other) noexcept
: referencedObject (other.referencedObject)
{
other.referencedObject = nullptr;
@@ -239,8 +239,8 @@ public:
This will increment the object's reference-count (if it is non-null).
*/
template
- inline ReferenceCountedObjectPtr (const ReferenceCountedObjectPtr& other) noexcept
- : referencedObject (static_cast (other.get()))
+ inline SharedObjectPtr (const SharedObjectPtr& other) noexcept
+ : referencedObject (static_cast (other.get()))
{
if (referencedObject != nullptr)
referencedObject->incReferenceCount();
@@ -251,7 +251,7 @@ public:
The reference count of the old object is decremented, and it might be
deleted if it hits zero. The new object's count is incremented.
*/
- ReferenceCountedObjectPtr& operator= (const ReferenceCountedObjectPtr& other)
+ SharedObjectPtr& operator= (const SharedObjectPtr& other)
{
return operator= (other.referencedObject);
}
@@ -262,14 +262,14 @@ public:
deleted if it hits zero. The new object's count is incremented.
*/
template
- ReferenceCountedObjectPtr& operator= (const ReferenceCountedObjectPtr& other)
+ SharedObjectPtr& operator= (const SharedObjectPtr& other)
{
- return operator= (static_cast (other.get()));
+ return operator= (static_cast (other.get()));
}
#if BEAST_COMPILER_SUPPORTS_MOVE_SEMANTICS
/** Takes-over the object from another pointer. */
- ReferenceCountedObjectPtr& operator= (ReferenceCountedObjectPtr&& other)
+ SharedObjectPtr& operator= (SharedObjectPtr&& other)
{
std::swap (referencedObject, other.referencedObject);
return *this;
@@ -281,14 +281,14 @@ public:
The reference count of the old object is decremented, and it might be
deleted if it hits zero. The new object's count is incremented.
*/
- ReferenceCountedObjectPtr& operator= (ReferenceCountedObjectClass* const newObject)
+ SharedObjectPtr& operator= (SharedObjectClass* const newObject)
{
if (referencedObject != newObject)
{
if (newObject != nullptr)
newObject->incReferenceCount();
- ReferenceCountedObjectClass* const oldObject = referencedObject;
+ SharedObjectClass* const oldObject = referencedObject;
referencedObject = newObject;
if (oldObject != nullptr)
@@ -303,7 +303,7 @@ public:
This will decrement the object's reference-count, and may delete it if it
gets to zero.
*/
- inline ~ReferenceCountedObjectPtr()
+ inline ~SharedObjectPtr()
{
if (referencedObject != nullptr)
referencedObject->decReferenceCount();
@@ -312,13 +312,13 @@ public:
/** Returns the object that this pointer references.
The pointer returned may be zero, of course.
*/
- inline operator ReferenceCountedObjectClass*() const noexcept
+ inline operator SharedObjectClass*() const noexcept
{
return referencedObject;
}
// the -> operator is called on the referenced object
- inline ReferenceCountedObjectClass* operator->() const noexcept
+ inline SharedObjectClass* operator->() const noexcept
{
return referencedObject;
}
@@ -326,7 +326,7 @@ public:
/** Returns the object that this pointer references.
The pointer returned may be zero, of course.
*/
- inline ReferenceCountedObjectClass* get() const noexcept
+ inline SharedObjectClass* get() const noexcept
{
return referencedObject;
}
@@ -334,55 +334,55 @@ public:
/** Returns the object that this pointer references.
The pointer returned may be zero, of course.
*/
- inline ReferenceCountedObjectClass* getObject() const noexcept
+ inline SharedObjectClass* getObject() const noexcept
{
return referencedObject;
}
private:
//==============================================================================
- ReferenceCountedObjectClass* referencedObject;
+ SharedObjectClass* referencedObject;
};
-/** Compares two ReferenceCountedObjectPointers. */
-template
-bool operator== (const ReferenceCountedObjectPtr& object1, ReferenceCountedObjectClass* const object2) noexcept
+/** Compares two SharedObjectPointers. */
+template
+bool operator== (const SharedObjectPtr& object1, SharedObjectClass* const object2) noexcept
{
return object1.get() == object2;
}
-/** Compares two ReferenceCountedObjectPointers. */
-template
-bool operator== (const ReferenceCountedObjectPtr& object1, const ReferenceCountedObjectPtr& object2) noexcept
+/** Compares two SharedObjectPointers. */
+template
+bool operator== (const SharedObjectPtr& object1, const SharedObjectPtr& object2) noexcept
{
return object1.get() == object2.get();
}
-/** Compares two ReferenceCountedObjectPointers. */
-template
-bool operator== (ReferenceCountedObjectClass* object1, ReferenceCountedObjectPtr& object2) noexcept
+/** Compares two SharedObjectPointers. */
+template
+bool operator== (SharedObjectClass* object1, SharedObjectPtr& object2) noexcept
{
return object1 == object2.get();
}
-/** Compares two ReferenceCountedObjectPointers. */
-template
-bool operator!= (const ReferenceCountedObjectPtr& object1, const ReferenceCountedObjectClass* object2) noexcept
+/** Compares two SharedObjectPointers. */
+template
+bool operator!= (const SharedObjectPtr& object1, const SharedObjectClass* object2) noexcept
{
return object1.get() != object2;
}
-/** Compares two ReferenceCountedObjectPointers. */
-template
-bool operator!= (const ReferenceCountedObjectPtr& object1, ReferenceCountedObjectPtr& object2) noexcept
+/** Compares two SharedObjectPointers. */
+template
+bool operator!= (const SharedObjectPtr& object1, SharedObjectPtr& object2) noexcept
{
return object1.get() != object2.get();
}
-/** Compares two ReferenceCountedObjectPointers. */
-template
-bool operator!= (ReferenceCountedObjectClass* object1, ReferenceCountedObjectPtr& object2) noexcept
+/** Compares two SharedObjectPointers. */
+template
+bool operator!= (SharedObjectClass* object1, SharedObjectPtr& object2) noexcept
{
return object1 != object2.get();
}
diff --git a/Subtrees/beast/modules/beast_core/memory/beast_SharedSingleton.h b/Subtrees/beast/modules/beast_core/memory/beast_SharedSingleton.h
index fbf1fe7f2e..87096cf836 100644
--- a/Subtrees/beast/modules/beast_core/memory/beast_SharedSingleton.h
+++ b/Subtrees/beast/modules/beast_core/memory/beast_SharedSingleton.h
@@ -107,7 +107,7 @@ protected:
}
public:
- typedef ReferenceCountedObjectPtr