collection_resolver progress
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
#ifndef MATADOR_COLLECTION_PROXY_HPP
|
||||
#define MATADOR_COLLECTION_PROXY_HPP
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include "matador/object/collection_resolver.hpp"
|
||||
|
||||
#include "matador/utils/identifier.hpp"
|
||||
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
namespace matador::object {
|
||||
@@ -33,13 +34,15 @@ public:
|
||||
return owner_id_;
|
||||
}
|
||||
const std::vector<Type>& items() const {
|
||||
resolve();
|
||||
return items_;
|
||||
}
|
||||
std::vector<Type>& items() {
|
||||
resolve();
|
||||
return items_;
|
||||
}
|
||||
private:
|
||||
void resolve() const {
|
||||
void resolve() {
|
||||
if (loaded_) {
|
||||
return;
|
||||
}
|
||||
@@ -53,6 +56,7 @@ private:
|
||||
}
|
||||
|
||||
items_ = resolver->resolve(owner_id_);
|
||||
loaded_ = true;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -16,7 +16,7 @@ class collection_resolver_factory : public abstract_collection_resolver_factory
|
||||
public:
|
||||
template<class Type>
|
||||
[[nodiscard]] std::shared_ptr<collection_resolver<Type>> resolver(const std::type_index &root_type, const std::string &collection_name) const {
|
||||
const auto res = acquire_collection_resolver(typeid(Type), root_type, collection_name);
|
||||
const auto res = acquire_collection_resolver(root_type, typeid(Type), collection_name);
|
||||
if (!res) {
|
||||
return std::dynamic_pointer_cast<collection_resolver<Type>>(res);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user