common: Remove deprecated global IdStrings
Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
parent
46db500123
commit
f1bddc2852
@ -27,8 +27,6 @@ assertion_failure::assertion_failure(std::string msg, std::string expr_str, std:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unordered_set<BaseCtx *> IdString::global_ctx;
|
|
||||||
|
|
||||||
void IdString::set(const BaseCtx *ctx, const std::string &s)
|
void IdString::set(const BaseCtx *ctx, const std::string &s)
|
||||||
{
|
{
|
||||||
auto it = ctx->idstring_str_to_idx->find(s);
|
auto it = ctx->idstring_str_to_idx->find(s);
|
||||||
|
@ -118,16 +118,6 @@ struct IdString
|
|||||||
bool operator!=(const IdString &other) const { return index != other.index; }
|
bool operator!=(const IdString &other) const { return index != other.index; }
|
||||||
|
|
||||||
bool empty() const { return index == 0; }
|
bool empty() const { return index == 0; }
|
||||||
|
|
||||||
// --- deprecated old API ---
|
|
||||||
|
|
||||||
static std::unordered_set<BaseCtx *> global_ctx;
|
|
||||||
|
|
||||||
NPNR_DEPRECATED const std::string &global_str() const
|
|
||||||
{
|
|
||||||
assert(global_ctx.size() == 1);
|
|
||||||
return str(*global_ctx.begin());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
@ -252,8 +242,6 @@ struct BaseCtx
|
|||||||
|
|
||||||
BaseCtx()
|
BaseCtx()
|
||||||
{
|
{
|
||||||
IdString::global_ctx.insert(this);
|
|
||||||
|
|
||||||
idstring_str_to_idx = new std::unordered_map<std::string, int>;
|
idstring_str_to_idx = new std::unordered_map<std::string, int>;
|
||||||
idstring_idx_to_str = new std::vector<const std::string *>;
|
idstring_idx_to_str = new std::vector<const std::string *>;
|
||||||
IdString::initialize_add(this, "", 0);
|
IdString::initialize_add(this, "", 0);
|
||||||
@ -262,7 +250,6 @@ struct BaseCtx
|
|||||||
|
|
||||||
~BaseCtx()
|
~BaseCtx()
|
||||||
{
|
{
|
||||||
IdString::global_ctx.erase(this);
|
|
||||||
delete idstring_str_to_idx;
|
delete idstring_str_to_idx;
|
||||||
delete idstring_idx_to_str;
|
delete idstring_idx_to_str;
|
||||||
}
|
}
|
||||||
|
@ -276,10 +276,7 @@ template <typename T, typename value_conv> struct map_wrapper
|
|||||||
x.base[PythonConversion::string_converter<K>().from_str(x.ctx, i)] = v;
|
x.base[PythonConversion::string_converter<K>().from_str(x.ctx, i)] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t len(wrapped_map &x)
|
static size_t len(wrapped_map &x) { return x.base.size(); }
|
||||||
{
|
|
||||||
return x.base.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void del(T const &x, std::string const &i)
|
static void del(T const &x, std::string const &i)
|
||||||
{
|
{
|
||||||
@ -399,10 +396,7 @@ template <typename T> struct map_wrapper_uptr
|
|||||||
x.base[PythonConversion::string_converter<K>().from_str(x.ctx, i)] = typename T::mapped_type(v);
|
x.base[PythonConversion::string_converter<K>().from_str(x.ctx, i)] = typename T::mapped_type(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t len(wrapped_map &x)
|
static size_t len(wrapped_map &x) { return x.base.size(); }
|
||||||
{
|
|
||||||
return x.base.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void del(T const &x, std::string const &i)
|
static void del(T const &x, std::string const &i)
|
||||||
{
|
{
|
||||||
|
@ -129,15 +129,15 @@ template <typename T> struct conv_to_str
|
|||||||
|
|
||||||
template <typename T> struct deref_and_wrap
|
template <typename T> struct deref_and_wrap
|
||||||
{
|
{
|
||||||
inline ContextualWrapper<T&> operator()(Context *ctx, T *x)
|
inline ContextualWrapper<T &> operator()(Context *ctx, T *x)
|
||||||
{
|
{
|
||||||
if (x == nullptr)
|
if (x == nullptr)
|
||||||
throw bad_wrap();
|
throw bad_wrap();
|
||||||
return ContextualWrapper<T&>(ctx, *x);
|
return ContextualWrapper<T &>(ctx, *x);
|
||||||
}
|
}
|
||||||
|
|
||||||
using arg_type = T *;
|
using arg_type = T *;
|
||||||
using ret_type = ContextualWrapper<T&>;
|
using ret_type = ContextualWrapper<T &>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Function wrapper
|
// Function wrapper
|
||||||
|
Loading…
Reference in New Issue
Block a user