Skip to content

Commit

Permalink
Rename method_handler to control_protocol_method_handler with @jonath…
Browse files Browse the repository at this point in the history
…an-r-thorpe suggestion.
  • Loading branch information
lo-simon committed Jun 5, 2024
1 parent 73f85b0 commit baa5e27
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Development/nmos/control_protocol_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ namespace nmos
namespace experimental
{
// control method handler definition
typedef std::function<web::json::value(nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)> method_handler;
typedef std::function<web::json::value(nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)> control_protocol_method_handler;

// method definition (NcMethodDescriptor vs method handler)
typedef std::pair<web::json::value, method_handler> method;
typedef std::pair<web::json::value, control_protocol_method_handler> method;

inline method make_control_class_method(const web::json::value& nc_method_descriptor, method_handler method_handler)
inline method make_control_class_method(const web::json::value& nc_method_descriptor, control_protocol_method_handler method_handler)
{
return std::make_pair(nc_method_descriptor, method_handler);
}
Expand Down
30 changes: 15 additions & 15 deletions Development/nmos/control_protocol_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace nmos
}
}
// create control class method descriptor
method make_control_class_method_descriptor(const utility::string_t& description, const nc_method_id& id, const nc_name& name, const utility::string_t& result_datatype, const std::vector<web::json::value>& parameters, bool is_deprecated, method_handler method_handler)
method make_control_class_method_descriptor(const utility::string_t& description, const nc_method_id& id, const nc_name& name, const utility::string_t& result_datatype, const std::vector<web::json::value>& parameters, bool is_deprecated, control_protocol_method_handler method_handler)
{
return make_control_class_method(details::make_control_class_method_descriptor(description, id, name, result_datatype, parameters, is_deprecated), method_handler);
}
Expand All @@ -87,91 +87,91 @@ namespace nmos

namespace details
{
nmos::experimental::method_handler make_nc_get_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor)
nmos::experimental::control_protocol_method_handler make_nc_get_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor)
{
return [get_control_protocol_class_descriptor](nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)
{
return get(resources, resource, arguments, is_deprecated, get_control_protocol_class_descriptor, gate);
};
}
nmos::experimental::method_handler make_nc_set_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor, get_control_protocol_datatype_descriptor_handler get_control_protocol_datatype_descriptor, control_protocol_property_changed_handler property_changed)
nmos::experimental::control_protocol_method_handler make_nc_set_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor, get_control_protocol_datatype_descriptor_handler get_control_protocol_datatype_descriptor, control_protocol_property_changed_handler property_changed)
{
return [get_control_protocol_class_descriptor, get_control_protocol_datatype_descriptor, property_changed](nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)
{
return set(resources, resource, arguments, is_deprecated, get_control_protocol_class_descriptor, get_control_protocol_datatype_descriptor, property_changed, gate);
};
}
nmos::experimental::method_handler make_nc_get_sequence_item_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor)
nmos::experimental::control_protocol_method_handler make_nc_get_sequence_item_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor)
{
return [get_control_protocol_class_descriptor](nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)
{
return get_sequence_item(resources, resource, arguments, is_deprecated, get_control_protocol_class_descriptor, gate);
};
}
nmos::experimental::method_handler make_nc_set_sequence_item_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor, get_control_protocol_datatype_descriptor_handler get_control_protocol_datatype_descriptor, control_protocol_property_changed_handler property_changed)
nmos::experimental::control_protocol_method_handler make_nc_set_sequence_item_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor, get_control_protocol_datatype_descriptor_handler get_control_protocol_datatype_descriptor, control_protocol_property_changed_handler property_changed)
{
return [get_control_protocol_class_descriptor, get_control_protocol_datatype_descriptor, property_changed](nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)
{
return set_sequence_item(resources, resource, arguments, is_deprecated, get_control_protocol_class_descriptor, get_control_protocol_datatype_descriptor, property_changed, gate);
};
}
nmos::experimental::method_handler make_nc_add_sequence_item_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor, get_control_protocol_datatype_descriptor_handler get_control_protocol_datatype_descriptor, control_protocol_property_changed_handler property_changed)
nmos::experimental::control_protocol_method_handler make_nc_add_sequence_item_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor, get_control_protocol_datatype_descriptor_handler get_control_protocol_datatype_descriptor, control_protocol_property_changed_handler property_changed)
{
return [get_control_protocol_class_descriptor, get_control_protocol_datatype_descriptor, property_changed](nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)
{
return add_sequence_item(resources, resource, arguments, is_deprecated, get_control_protocol_class_descriptor, get_control_protocol_datatype_descriptor, property_changed, gate);
};
}
nmos::experimental::method_handler make_nc_remove_sequence_item_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor)
nmos::experimental::control_protocol_method_handler make_nc_remove_sequence_item_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor)
{
return [get_control_protocol_class_descriptor](nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)
{
return remove_sequence_item(resources, resource, arguments, is_deprecated, get_control_protocol_class_descriptor, gate);
};
}
nmos::experimental::method_handler make_nc_get_sequence_length_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor)
nmos::experimental::control_protocol_method_handler make_nc_get_sequence_length_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor)
{
return [get_control_protocol_class_descriptor](nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)
{
return get_sequence_length(resources, resource, arguments, is_deprecated, get_control_protocol_class_descriptor, gate);
};
}
nmos::experimental::method_handler make_nc_get_member_descriptors_handler()
nmos::experimental::control_protocol_method_handler make_nc_get_member_descriptors_handler()
{
return [](nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)
{
return get_member_descriptors(resources, resource, arguments, is_deprecated, gate);
};
}
nmos::experimental::method_handler make_nc_find_members_by_path_handler()
nmos::experimental::control_protocol_method_handler make_nc_find_members_by_path_handler()
{
return [](nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)
{
return find_members_by_path(resources, resource, arguments, is_deprecated, gate);
};
}
nmos::experimental::method_handler make_nc_find_members_by_role_handler()
nmos::experimental::control_protocol_method_handler make_nc_find_members_by_role_handler()
{
return [](nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)
{
return find_members_by_role(resources, resource, arguments, is_deprecated, gate);
};
}
nmos::experimental::method_handler make_nc_find_members_by_class_id_handler()
nmos::experimental::control_protocol_method_handler make_nc_find_members_by_class_id_handler()
{
return [](nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)
{
return find_members_by_class_id(resources, resource, arguments, is_deprecated, gate);
};
}
nmos::experimental::method_handler make_nc_get_control_class_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor)
nmos::experimental::control_protocol_method_handler make_nc_get_control_class_handler(get_control_protocol_class_descriptor_handler get_control_protocol_class_descriptor)
{
return [get_control_protocol_class_descriptor](nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)
{
return get_control_class(resources, resource, arguments, is_deprecated, get_control_protocol_class_descriptor, gate);
};
}
nmos::experimental::method_handler make_nc_get_datatype_handler(get_control_protocol_datatype_descriptor_handler get_control_protocol_datatype_descriptor)
nmos::experimental::control_protocol_method_handler make_nc_get_datatype_handler(get_control_protocol_datatype_descriptor_handler get_control_protocol_datatype_descriptor)
{
return [get_control_protocol_datatype_descriptor](nmos::resources& resources, const nmos::resource& resource, const web::json::value& arguments, bool is_deprecated, slog::base_gate& gate)
{
Expand All @@ -193,7 +193,7 @@ namespace nmos
return std::vector<web::json::value>{};
};

auto to_methods_vector = [](const web::json::value& nc_method_descriptors, const std::map<nmos::nc_method_id, const method_handler>& method_handlers)
auto to_methods_vector = [](const web::json::value& nc_method_descriptors, const std::map<nmos::nc_method_id, const control_protocol_method_handler>& method_handlers)
{
// NcMethodDescriptor method handler array
std::vector<method> methods;
Expand Down
2 changes: 1 addition & 1 deletion Development/nmos/control_protocol_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace nmos
bool is_nullable = false, bool is_sequence = false, const web::json::value& constraints = web::json::value::null());
// create control class method descriptor
method make_control_class_method_descriptor(const utility::string_t& description, const nc_method_id& id, const nc_name& name, const utility::string_t& result_datatype,
const std::vector<web::json::value>& parameters, bool is_deprecated, method_handler method_handler);
const std::vector<web::json::value>& parameters, bool is_deprecated, control_protocol_method_handler method_handler);

// create control class event descriptor
web::json::value make_control_class_event_descriptor(const utility::string_t& description, const nc_event_id& id, const nc_name& name, const utility::string_t& event_datatype,
Expand Down

0 comments on commit baa5e27

Please sign in to comment.