AI: deployed typesafe_aspect_ptr consistently

No reason this couldn't have used aspect_type<t>typesafe_ptr before, so this just
makes uses of this specific type easier to find.
This commit is contained in:
Charles Dang 2018-04-29 05:58:44 +11:00
parent 1b8bfa6ab4
commit 1e846aced2
3 changed files with 5 additions and 6 deletions

View file

@ -212,14 +212,14 @@ class composite_aspect;
template<typename T>
class typesafe_known_aspect : public known_aspect {
public:
typesafe_known_aspect(const std::string &name, std::shared_ptr< typesafe_aspect<T>> &where, aspect_map &aspects)
typesafe_known_aspect(const std::string &name, typesafe_aspect_ptr<T>& where, aspect_map &aspects)
: known_aspect(name), where_(where), aspects_(aspects)
{
}
void set(aspect_ptr a)
{
std::shared_ptr< typesafe_aspect <T>> c = std::dynamic_pointer_cast< typesafe_aspect<T>>(a);
typesafe_aspect_ptr<T> c = std::dynamic_pointer_cast<typesafe_aspect<T>>(a);
if (c) {
assert (c->get_id()== this->get_name());
where_ = c;
@ -242,9 +242,8 @@ public:
}
protected:
std::shared_ptr<typesafe_aspect <T>> &where_;
typesafe_aspect_ptr<T>& where_;
aspect_map &aspects_;
};

View file

@ -174,7 +174,7 @@ synced_command_result_ptr readonly_context_impl::check_synced_command_action(con
template<typename T>
void readonly_context_impl::add_known_aspect(const std::string &name, std::shared_ptr< typesafe_aspect <T>> &where)
void readonly_context_impl::add_known_aspect(const std::string &name, typesafe_aspect_ptr<T>& where)
{
std::shared_ptr< typesafe_known_aspect <T>> ka_ptr(new typesafe_known_aspect<T>(name,where,aspects_));
known_aspects_.emplace(name,ka_ptr);

View file

@ -1489,7 +1489,7 @@ public:
private:
template<typename T>
void add_known_aspect(const std::string &name, std::shared_ptr< typesafe_aspect <T>>& where);
void add_known_aspect(const std::string &name, typesafe_aspect_ptr<T>& where);
const config cfg_;