+ return valid_string(sr_input_description_get(structure));
+}
+
+map<string, shared_ptr<Option>> InputFormat::get_options()
+{
+ const struct sr_option **options = sr_input_options_get(structure);
+ auto option_array = shared_ptr<const struct sr_option *>(
+ options, sr_input_options_free);
+ map<string, shared_ptr<Option>> result;
+ for (int i = 0; options[i]; i++)
+ result[options[i]->id] = shared_ptr<Option>(
+ new Option(options[i], option_array), Option::Deleter());
+ return result;
+}
+
+shared_ptr<Input> InputFormat::create_input(
+ map<string, Glib::VariantBase> options)
+{
+ auto input = sr_input_new(structure, map_to_hash_variant(options));
+ if (!input)
+ throw Error(SR_ERR_ARG);
+ return shared_ptr<Input>(
+ new Input(parent->shared_from_this(), input), Input::Deleter());
+}
+
+Input::Input(shared_ptr<Context> context, const struct sr_input *structure) :
+ UserOwned(structure),
+ context(context),
+ device(nullptr)
+{
+}
+
+shared_ptr<InputDevice> Input::get_device()
+{
+ if (!device)
+ {
+ auto sdi = sr_input_dev_inst_get(structure);
+ if (!sdi)
+ throw Error(SR_ERR_NA);
+ device = new InputDevice(shared_from_this(), sdi);
+ }
+
+ return device->get_shared_pointer(shared_from_this());