]> sigrok.org Git - libsigrokflow.git/blame - src/init.cpp
Avoid underscore suffix in member function names.
[libsigrokflow.git] / src / init.cpp
CommitLineData
fc5450cb
UH
1/*
2 * This file is part of the libsigrokflow project.
3 *
4 * Copyright (C) 2018 Martin Ling <martin-sigrok@earth.li>
5 * Copyright (C) 2018 Uwe Hermann <uwe@hermann-uwe.de>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <config.h>
22#include <libsigrokflow/libsigrokflow.hpp>
23
24namespace Srf
25{
26
27static bool srf_initialized_ = false;
28
29void init()
30{
31 if (srf_initialized_)
32 throw runtime_error("libsigrokflow is already initialized");
33
34 if (!Gst::is_initialized())
35 throw runtime_error("Gst::init() has not run yet");
36
37#ifdef HAVE_LIBSIGROKCXX
38 Gst::Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR,
39 "sigrok_legacy_capture_device",
40 "Wrapper for capture devices using legacy libsigrok APIs",
41 sigc::ptr_fun(&LegacyCaptureDevice::register_element),
42 "0.01", "GPL", "sigrok", "libsigrokflow", "http://sigrok.org");
43 Gst::Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR,
44 "sigrok_legacy_input",
45 "Wrapper for inputs using legacy libsigrok APIs",
46 sigc::ptr_fun(&LegacyInput::register_element),
47 "0.01", "GPL", "sigrok", "libsigrokflow", "http://sigrok.org");
48 Gst::Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR,
49 "sigrok_legacy_output",
50 "Wrapper for outputs using legacy libsigrok APIs",
51 sigc::ptr_fun(&LegacyOutput::register_element),
52 "0.01", "GPL", "sigrok", "libsigrokflow", "http://sigrok.org");
53#endif
54#ifdef HAVE_LIBSIGROKDECODE
55 Gst::Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR,
56 "sigrok_legacy_decoder",
57 "Wrapper for protocol decoders using legacy libsigrokdecode APIs",
58 sigc::ptr_fun(&LegacyDecoder::register_element),
59 "0.01", "GPL", "sigrok", "libsigrokflow", "http://sigrok.org");
60#endif
61
62 srf_initialized_ = true;
63}
64
65void deinit()
66{
67 if (!srf_initialized_)
68 throw runtime_error("libsigrokflow is not initialized");
69
70 srf_initialized_ = false;
71}
72
73}