}
Context::Context() :
+ UserOwned(structure),
session(NULL)
{
check(sr_init(&structure));
+
struct sr_dev_driver **driver_list = sr_driver_list();
if (driver_list)
for (int i = 0; driver_list[i]; i++)
}
Driver::Driver(struct sr_dev_driver *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
+ Configurable(structure, NULL, NULL),
initialized(false)
{
}
return Glib::VariantContainerBase(data);
}
+vector<const ConfigKey *> Configurable::config_keys(const ConfigKey *key)
+{
+ GVariant *gvar_opts;
+ gsize num_opts;
+ const int32_t *opts;
+ vector<const ConfigKey *> result;
+
+ check(sr_config_list(
+ config_driver, config_sdi, config_channel_group,
+ key->get_id(), &gvar_opts));
+
+ opts = (const int32_t *) g_variant_get_fixed_array(
+ gvar_opts, &num_opts, sizeof(int32_t));
+
+ for (gsize i = 0; i < num_opts; i++)
+ result.push_back(ConfigKey::get(opts[i]));
+
+ g_variant_unref(gvar_opts);
+
+ return result;
+}
+
Device::Device(struct sr_dev_inst *structure) :
Configurable(structure->driver, structure, NULL),
structure(structure)
}
HardwareDevice::HardwareDevice(Driver *driver, struct sr_dev_inst *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
Device(structure),
driver(driver)
{
}
Channel::Channel(struct sr_channel *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
type(ChannelType::get(structure->type))
{
}
ChannelGroup::ChannelGroup(Device *device,
struct sr_channel_group *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
Configurable(device->structure->driver, device->structure, structure)
{
for (GSList *entry = structure->channels; entry; entry = entry->next)
}
Trigger::Trigger(shared_ptr<Context> context, string name) :
- structure(sr_trigger_new(name.c_str())), context(context)
+ UserOwned(sr_trigger_new(name.c_str())),
+ context(context)
{
for (auto stage = structure->stages; stage; stage = stage->next)
stages.push_back(new TriggerStage((struct sr_trigger_stage *) stage->data));
}
TriggerStage::TriggerStage(struct sr_trigger_stage *structure) :
- StructureWrapper(structure)
+ ParentOwned(structure)
{
}
}
TriggerMatch::TriggerMatch(struct sr_trigger_match *structure, shared_ptr<Channel> channel) :
- StructureWrapper(structure), channel(channel)
+ ParentOwned(structure), channel(channel)
{
}
}
Session::Session(shared_ptr<Context> context) :
+ UserOwned(structure),
context(context), saving(false)
{
check(sr_session_new(&structure));
}
Session::Session(shared_ptr<Context> context, string filename) :
+ UserOwned(structure),
context(context), saving(false)
{
check(sr_session_load(filename.c_str(), &structure));
Packet::Packet(shared_ptr<Device> device,
const struct sr_datafeed_packet *structure) :
- structure(structure),
+ UserOwned(structure),
device(device)
{
switch (structure->type)
}
Header::Header(const struct sr_datafeed_header *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
PacketPayload()
{
}
shared_ptr<PacketPayload> Header::get_shared_pointer(Packet *parent)
{
- return static_pointer_cast<PacketPayload>(get_shared_pointer(parent));
+ return static_pointer_cast<PacketPayload>(
+ ParentOwned::get_shared_pointer(parent));
}
int Header::get_feed_version()
}
Meta::Meta(const struct sr_datafeed_meta *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
PacketPayload()
{
}
shared_ptr<PacketPayload> Meta::get_shared_pointer(Packet *parent)
{
- return static_pointer_cast<PacketPayload>(get_shared_pointer(parent));
+ return static_pointer_cast<PacketPayload>(
+ ParentOwned::get_shared_pointer(parent));
}
map<const ConfigKey *, Glib::VariantBase> Meta::get_config()
}
Logic::Logic(const struct sr_datafeed_logic *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
PacketPayload()
{
}
shared_ptr<PacketPayload> Logic::get_shared_pointer(Packet *parent)
{
- return static_pointer_cast<PacketPayload>(get_shared_pointer(parent));
+ return static_pointer_cast<PacketPayload>(
+ ParentOwned::get_shared_pointer(parent));
}
void *Logic::get_data_pointer()
}
Analog::Analog(const struct sr_datafeed_analog *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
PacketPayload()
{
}
shared_ptr<PacketPayload> Analog::get_shared_pointer(Packet *parent)
{
- return static_pointer_cast<PacketPayload>(get_shared_pointer(parent));
+ return static_pointer_cast<PacketPayload>(
+ ParentOwned::get_shared_pointer(parent));
}
float *Analog::get_data_pointer()
}
InputFormat::InputFormat(const struct sr_input_module *structure) :
- StructureWrapper(structure)
+ ParentOwned(structure)
{
}
}
Input::Input(shared_ptr<Context> context, const struct sr_input *structure) :
- structure(structure),
+ UserOwned(structure),
context(context),
device(nullptr)
{
InputDevice::InputDevice(shared_ptr<Input> input,
struct sr_dev_inst *structure) :
- StructureWrapper(structure),
+ ParentOwned(structure),
Device(structure),
input(input)
{
Option::Option(const struct sr_option *structure,
shared_ptr<const struct sr_option *> structure_array) :
- structure(structure),
+ UserOwned(structure),
structure_array(structure_array)
{
}
}
OutputFormat::OutputFormat(const struct sr_output_module *structure) :
- StructureWrapper(structure)
+ ParentOwned(structure)
{
}
Output::Output(shared_ptr<OutputFormat> format,
shared_ptr<Device> device, map<string, Glib::VariantBase> options) :
- structure(sr_output_new(format->structure,
+ UserOwned(sr_output_new(format->structure,
map_to_hash_variant(options), device->structure)),
format(format), device(device), options(options)
{