summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-02-28 01:24:18 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-02-28 01:24:18 +0000
commit7a70e75656d31428c9bbbd51fbf1ca920e577ed1 (patch)
treefcaed03c9b094e8b37d8d787f6695e8306031a3c
parentSupport for named colours in assets (diff)
downloadilt-7a70e75656d31428c9bbbd51fbf1ca920e577ed1.tar.bz2
ilt-7a70e75656d31428c9bbbd51fbf1ca920e577ed1.tar.xz
ilt-7a70e75656d31428c9bbbd51fbf1ca920e577ed1.zip
Remove to specify if the Selection pointer type is shared or not
Inferred based on whether the pointer is copyable or not.
-rw-r--r--assetFactory/assetFactory.h4
-rw-r--r--assetFactory/faceController.h2
-rw-r--r--assetFactory/factoryMesh.h2
-rw-r--r--assetFactory/object.h2
-rw-r--r--assetFactory/use.h2
-rw-r--r--lib/persistence.h13
6 files changed, 13 insertions, 12 deletions
diff --git a/assetFactory/assetFactory.h b/assetFactory/assetFactory.h
index a68b460..42082eb 100644
--- a/assetFactory/assetFactory.h
+++ b/assetFactory/assetFactory.h
@@ -14,7 +14,7 @@ public:
FactoryMesh::Collection meshes;
private:
- friend Persistence::SelectionPtrBase<std::shared_ptr<Asset>, true>;
+ friend Persistence::SelectionPtrBase<std::shared_ptr<Asset>>;
bool persist(Persistence::PersistenceStore & store) override;
};
@@ -36,6 +36,6 @@ public:
static void normalizeColourName(std::string &);
private:
- friend Persistence::SelectionPtrBase<std::shared_ptr<AssetFactory>, true>;
+ friend Persistence::SelectionPtrBase<std::shared_ptr<AssetFactory>>;
bool persist(Persistence::PersistenceStore & store) override;
};
diff --git a/assetFactory/faceController.h b/assetFactory/faceController.h
index 0618388..10a226a 100644
--- a/assetFactory/faceController.h
+++ b/assetFactory/faceController.h
@@ -21,7 +21,7 @@ public:
FaceControllers faceControllers;
private:
- friend Persistence::SelectionPtrBase<std::unique_ptr<FaceController>, false>;
+ friend Persistence::SelectionPtrBase<std::unique_ptr<FaceController>>;
bool persist(Persistence::PersistenceStore & store) override;
std::string
getId() const override
diff --git a/assetFactory/factoryMesh.h b/assetFactory/factoryMesh.h
index 4b6d3e5..bbeb870 100644
--- a/assetFactory/factoryMesh.h
+++ b/assetFactory/factoryMesh.h
@@ -13,6 +13,6 @@ public:
Use::Collection uses;
private:
- friend Persistence::SelectionPtrBase<std::shared_ptr<FactoryMesh>, true>;
+ friend Persistence::SelectionPtrBase<std::shared_ptr<FactoryMesh>>;
bool persist(Persistence::PersistenceStore & store) override;
};
diff --git a/assetFactory/object.h b/assetFactory/object.h
index 1069f66..f3726c7 100644
--- a/assetFactory/object.h
+++ b/assetFactory/object.h
@@ -16,7 +16,7 @@ public:
std::string id;
private:
- friend Persistence::SelectionPtrBase<std::shared_ptr<Object>, true>;
+ friend Persistence::SelectionPtrBase<std::shared_ptr<Object>>;
bool persist(Persistence::PersistenceStore & store) override;
std::string
getId() const override
diff --git a/assetFactory/use.h b/assetFactory/use.h
index 5b61eca..5e4c35f 100644
--- a/assetFactory/use.h
+++ b/assetFactory/use.h
@@ -17,7 +17,7 @@ public:
FaceControllers faceControllers;
private:
- friend Persistence::SelectionPtrBase<std::shared_ptr<Use>, true>;
+ friend Persistence::SelectionPtrBase<std::shared_ptr<Use>>;
bool persist(Persistence::PersistenceStore & store) override;
std::string
getId() const override
diff --git a/lib/persistence.h b/lib/persistence.h
index bfd27f0..458ba4d 100644
--- a/lib/persistence.h
+++ b/lib/persistence.h
@@ -381,7 +381,8 @@ namespace Persistence {
using SeenSharedObjects = std::map<void *, std::string>;
inline SeenSharedObjects seenSharedObjects;
- template<typename Ptr, bool shared> struct SelectionPtrBase : public SelectionV<Ptr> {
+ template<typename Ptr> struct SelectionPtrBase : public SelectionV<Ptr> {
+ static constexpr auto shared = std::is_copy_assignable_v<Ptr>;
using T = typename Ptr::element_type;
struct SelectionObj : public SelectionV<Ptr> {
struct MakeObjectByTypeName : public SelectionV<Ptr> {
@@ -526,13 +527,13 @@ namespace Persistence {
}
};
- template<typename T> struct SelectionT<std::unique_ptr<T>> : public SelectionPtrBase<std::unique_ptr<T>, false> {
- using SelectionPtrBase<std::unique_ptr<T>, false>::SelectionPtrBase;
+ template<typename T> struct SelectionT<std::unique_ptr<T>> : public SelectionPtrBase<std::unique_ptr<T>> {
+ using SelectionPtrBase<std::unique_ptr<T>>::SelectionPtrBase;
};
- template<typename T> struct SelectionT<std::shared_ptr<T>> : public SelectionPtrBase<std::shared_ptr<T>, true> {
- using SelectionPtrBase<std::shared_ptr<T>, true>::SelectionPtrBase;
- using SelectionPtrBase<std::shared_ptr<T>, true>::setValue;
+ template<typename T> struct SelectionT<std::shared_ptr<T>> : public SelectionPtrBase<std::shared_ptr<T>> {
+ using SelectionPtrBase<std::shared_ptr<T>>::SelectionPtrBase;
+ using SelectionPtrBase<std::shared_ptr<T>>::setValue;
void
setValue(std::string && id) override