19#ifndef ESPRESSO_SCRIPT_INTERFACE_CONTEXT_HPP
20#define ESPRESSO_SCRIPT_INTERFACE_CONTEXT_HPP
33#include <boost/utility/string_ref.hpp>
54class Context :
public std::enable_shared_from_this<Context> {
64 std::string
const &
name,
75 std::string
const &
name,
87 virtual std::shared_ptr<ObjectHandle>
93 virtual std::shared_ptr<ObjectHandle>
114 virtual boost::mpi::communicator
const &
get_comm()
const = 0;
Context of an object handle.
virtual void notify_set_parameter(const ObjectHandle *self, std::string const &name, Variant const &value)=0
Set a parameter on remote instances.
virtual void parallel_try_catch(std::function< void()> const &cb) const =0
virtual std::shared_ptr< ObjectHandle > make_shared_local(std::string const &name, VariantMap const ¶meters)=0
Get a new reference counted instance of a script interface by name.
virtual boost::string_ref name(const ObjectHandle *o) const =0
Get the class name for an ObjectHandle instance.
virtual std::shared_ptr< ObjectHandle > make_shared(std::string const &name, const VariantMap ¶meters)=0
Get a new reference counted instance of a script interface by name.
virtual void notify_call_method(const ObjectHandle *self, std::string const &name, VariantMap const &arguments)=0
Call method on remote instances.
virtual bool is_head_node() const =0
void set_context(ObjectHandle *o)
Set the context of an object to this.
virtual ~Context()=default
virtual boost::mpi::communicator const & get_comm() const =0
Base class for interface handles.
Communicator communicator
T get_value(Variant const &v)
Extract value of specific type T from a Variant.
std::unordered_map< std::string, Variant > VariantMap
boost::make_recursive_variant< None, bool, int, std::size_t, double, std::string, ObjectRef, Utils::Vector3b, Utils::Vector3i, Utils::Vector2d, Utils::Vector3d, Utils::Vector4d, std::vector< int >, std::vector< double >, std::vector< boost::recursive_variant_ >, std::unordered_map< int, boost::recursive_variant_ >, std::unordered_map< std::string, boost::recursive_variant_ > >::type Variant
Possible types for parameters.