Migrate from LoadableTypeRegistry to TypeRegistry
authorMikko Rasa <tdb@tdb.fi>
Mon, 12 Apr 2021 12:01:48 +0000 (15:01 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 12 Apr 2021 12:01:48 +0000 (15:01 +0300)
source/builders/pipelinetemplate.cpp
source/builders/pipelinetemplate.h
source/materials/material.cpp
source/materials/material.h

index 81d88f3184f32b37488ab647d7e9596739f48f75..de91450e755931ca0e641065db78ee76d0e3dd31 100644 (file)
@@ -62,7 +62,7 @@ PipelineTemplate::PostProcessor::PostProcessor(GL::PostProcessor::Template *ppt)
 
 PipelineTemplate::PostProcLoader::PostProcLoader()
 {
-       get_postprocessor_registry().add_all(*this);
+       get_postprocessor_registry().invoke_all(*this);
 }
 
 
index 177c0b145356f05e613d4f256efcb5e62ff2c47f..515ebfaf4cc7fff9a44609c21fa2df106c4cd4bc 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <string>
 #include <vector>
-#include <msp/datafile/loadabletyperegistry.h>
+#include <msp/core/typeregistry.h>
 #include <msp/datafile/objectloader.h>
 #include "blend.h"
 #include "postprocessor.h"
@@ -24,7 +24,7 @@ private:
                template<typename T>
                struct AddPostProc
                {
-                       static void add(PostProcLoader &ldr, const std::string &kw) { ldr.add(kw, &PostProcLoader::postprocessor<T>); }
+                       void operator()(const std::string &kw, PostProcLoader &ldr) const { ldr.add(kw, &PostProcLoader::postprocessor<T>); }
                };
 
        protected:
@@ -100,7 +100,7 @@ public:
        typedef std::vector<PostProcessor> PostProcessorArray;
 
 private:
-       typedef DataFile::LoadableTypeRegistry<PostProcLoader, PostProcLoader::AddPostProc> PostProcessorRegistry;
+       typedef TypeRegistry<PostProcLoader::AddPostProc, PostProcLoader &> PostProcessorRegistry;
 
        Resources *resources;
        bool hdr;
index 3eaf83ab9b59728b1f21c1800acb2ecc2f1c4f33..d87f2f830afd7583df377b641a0a70873829e5e6 100644 (file)
@@ -110,7 +110,7 @@ Material::GenericLoader::GenericLoader(DataFile::Collection *c):
 
 void Material::GenericLoader::init_actions()
 {
-       get_material_registry().add_all(*this);
+       get_material_registry().invoke_all(*this);
 }
 
 } // namespace GL
index a04e74585e56c9fbfc9088b27bc9eb4f1ff96c81..2f8f38ab7ce183c40492b3d75f2b11c2904939a6 100644 (file)
@@ -1,8 +1,8 @@
 #ifndef MSP_GL_MATERIAL_H_
 #define MSP_GL_MATERIAL_H_
 
+#include <msp/core/typeregistry.h>
 #include <msp/datafile/collection.h>
-#include <msp/datafile/loadabletyperegistry.h>
 #include <msp/datafile/objectloader.h>
 #include "color.h"
 #include "programdata.h"
@@ -64,7 +64,7 @@ public:
                template<typename T>
                struct AddType
                {
-                       static void add(GenericLoader &ldr, const std::string &kw) { ldr.add(kw, &GenericLoader::typed_material<T>); }
+                       void operator()(const std::string &kw, GenericLoader &ldr) const { ldr.add(kw, &GenericLoader::typed_material<T>); }
                };
 
                DataFile::Collection *coll;
@@ -86,7 +86,7 @@ public:
        };
 
 private:
-       typedef DataFile::LoadableTypeRegistry<GenericLoader, GenericLoader::AddType> MaterialRegistry;
+       typedef TypeRegistry<GenericLoader::AddType, GenericLoader &> MaterialRegistry;
 
 protected:
        const Sampler *sampler;