Setup mini variant UI, move around more code to accomodate this
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
cf74324568
commit
a85679758c
12 changed files with 534 additions and 334 deletions
|
|
@ -107,6 +107,13 @@ public:
|
|||
initialise_variant<T>(variant);
|
||||
}
|
||||
|
||||
template<class T1, class T2>
|
||||
SharedResourcePointer(const T1* const v1, const T2* const v2)
|
||||
: sharedObject(nullptr)
|
||||
{
|
||||
initialise_variant2<T1, T2>(v1, v2);
|
||||
}
|
||||
|
||||
SharedResourcePointer (const SharedResourcePointer&)
|
||||
: sharedObject(nullptr)
|
||||
{
|
||||
|
|
@ -179,6 +186,18 @@ private:
|
|||
sharedObject = holder.sharedInstance;
|
||||
}
|
||||
|
||||
template<class T1, class T2>
|
||||
void initialise_variant2(const T1* const v1, const T2* const v2)
|
||||
{
|
||||
SharedObjectHolder& holder = getSharedObjectHolder();
|
||||
const SpinLock::ScopedLockType sl (holder.lock);
|
||||
|
||||
if (++(holder.refCount) == 1)
|
||||
holder.sharedInstance = new SharedObjectType(v1, v2);
|
||||
|
||||
sharedObject = holder.sharedInstance;
|
||||
}
|
||||
|
||||
// There's no need to assign to a SharedResourcePointer because every
|
||||
// instance of the class is exactly the same!
|
||||
SharedResourcePointer& operator= (const SharedResourcePointer&) = delete;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue