aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/e_mask.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/repositories/e/e_mask.cc')
-rw-r--r--paludis/repositories/e/e_mask.cc67
1 files changed, 12 insertions, 55 deletions
diff --git a/paludis/repositories/e/e_mask.cc b/paludis/repositories/e/e_mask.cc
index 93662169c..96d411280 100644
--- a/paludis/repositories/e/e_mask.cc
+++ b/paludis/repositories/e/e_mask.cc
@@ -20,7 +20,7 @@
#include <paludis/repositories/e/e_mask.hh>
#include <paludis/util/pimp-impl.hh>
#include <paludis/util/singleton-impl.hh>
-#include <paludis/util/hashes.hh>
+#include <paludis/util/pool-impl.hh>
#include <unordered_map>
using namespace paludis;
@@ -32,7 +32,9 @@ namespace
public UnacceptedMask
{
private:
- Pimp<EUnacceptedMask> _imp;
+ const char _key;
+ const std::string _description;
+ const std::string _unaccepted_key_name;
public:
EUnacceptedMask(const char, const std::string &, const std::string &);
@@ -44,26 +46,10 @@ namespace
};
}
-namespace paludis
-{
- template <>
- struct Imp<EUnacceptedMask>
- {
- const char key;
- const std::string description;
- const std::string unaccepted_key_name;
-
- Imp(const char k, const std::string & d, const std::string & u) :
- key(k),
- description(d),
- unaccepted_key_name(u)
- {
- }
- };
-}
-
EUnacceptedMask::EUnacceptedMask(const char k, const std::string & d, const std::string & u) :
- _imp(k, d, u)
+ _key(k),
+ _description(d),
+ _unaccepted_key_name(u)
{
}
@@ -74,19 +60,19 @@ EUnacceptedMask::~EUnacceptedMask()
char
EUnacceptedMask::key() const
{
- return _imp->key;
+ return _key;
}
const std::string
EUnacceptedMask::description() const
{
- return _imp->description;
+ return _description;
}
const std::string
EUnacceptedMask::unaccepted_key_name() const
{
- return _imp->unaccepted_key_name;
+ return _unaccepted_key_name;
}
namespace paludis
@@ -203,38 +189,9 @@ namespace
typedef std::tuple<char, std::string, std::string> EUnacceptedMaskIndex;
}
-namespace paludis
-{
- template <>
- struct Imp<EUnacceptedMaskStore>
- {
- mutable Mutex mutex;
- mutable std::unordered_map<EUnacceptedMaskIndex, std::shared_ptr<const UnacceptedMask>, Hash<EUnacceptedMaskIndex> > store;
- };
-}
-
-EUnacceptedMaskStore::EUnacceptedMaskStore() :
- _imp()
-{
-}
-
-EUnacceptedMaskStore::~EUnacceptedMaskStore()
-{
-}
-
const std::shared_ptr<const UnacceptedMask>
-EUnacceptedMaskStore::fetch(const char c, const std::string & s, const std::string & k)
+paludis::erepository::create_e_unaccepted_mask(const char c, const std::string & s, const std::string & k)
{
- EUnacceptedMaskIndex index(c, s, k);
-
- Lock lock(_imp->mutex);
- auto i(_imp->store.find(index));
- if (i == _imp->store.end())
- i = _imp->store.insert(std::make_pair(index, std::make_shared<EUnacceptedMask>(c, s, k))).first;
-
- return i->second;
+ return Pool<EUnacceptedMask>::get_instance()->create(c, s, k);
}
-template class Singleton<EUnacceptedMaskStore>;
-template class Pimp<EUnacceptedMaskStore>;
-