46void GlobalContext::make_handle(
ObjectId id,
const std::string &name,
52 m_local_objects[id] = std::move(
so);
53 }
catch (Exception
const &) {
57void GlobalContext::remote_make_handle(
ObjectId id,
const std::string &name,
62void GlobalContext::set_parameter(
ObjectId id, std::string
const &name,
65 m_local_objects.at(
id)->set_parameter(
name,
unpack(value, m_local_objects));
66 }
catch (Exception
const &) {
71 std::string
const &name,
76void GlobalContext::call_method(
ObjectId id, std::string
const &name,
79 m_local_objects.at(
id)->call_method(
name,
81 }
catch (Exception
const &) {
86 std::string
const &name,
91std::shared_ptr<ObjectHandle>
94 auto sp = m_node_local_context->factory().make(
name);
102std::shared_ptr<ObjectHandle>
106 auto sp = m_node_local_context->factory().make(
name);
114 return {
sp.release(),
132 return m_node_local_context->factory().type_name(*
o);
Infrastructure to synchronize objects created on the head node with their corresponding remote copies...
void set_context(ObjectHandle *o)
Set the context of an object to this.
std::shared_ptr< ObjectHandle > make_shared(std::string const &name, const VariantMap ¶meters) override
Get a new reference counted instance of a script interface object by name.
void notify_set_parameter(const ObjectHandle *o, std::string const &name, Variant const &value) override
boost::string_ref name(const ObjectHandle *o) const override
bool is_head_node() const override
std::shared_ptr< ObjectHandle > make_shared_local(std::string const &name, VariantMap const ¶meters) override
void notify_call_method(const ObjectHandle *o, std::string const &name, VariantMap const &arguments) override
Base class for interface handles.
PackedVariant pack(const Variant &v)
Transform a Variant to a PackedVariant.
std::shared_ptr< ObjectHandle > ObjectRef
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.
std::vector< std::pair< std::string, PackedVariant > > PackedMap
Variant unpack(const PackedVariant &v, std::unordered_map< ObjectId, ObjectRef > const &objects)
Unpack a PackedVariant.
boost::make_recursive_variant< None, bool, int, std::size_t, double, std::string, ObjectId, 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 PackedVariant
Packed version of Variant.
ObjectId object_id(const ObjectHandle *p)
Id for object.