libpressio 0.93.0
Loading...
Searching...
No Matches
external_launch.h
Go to the documentation of this file.
1#ifndef LIBPRESSIO_EXTERNAL_LAUNCH_H
2#define LIBPRESSIO_EXTERNAL_LAUNCH_H
3
4
15#include <memory>
16#include <string>
17
32};
33
39 std::string proc_stdout;
41 std::string proc_stderr;
43 int return_code = 0;
46};
47
52 virtual ~libpressio_launch_plugin()=default;
59 virtual extern_proc_results launch(std::vector<std::string> const& args) const =0;
60
62 pressio_options opts;
64 set(opts, "pressio:thread_safe", "level of thread safety provided by the compressor");
65 set(opts, "pressio:stability", "level of stablity provided by the compressor; see the README for libpressio");
66 return opts;
67 }
68
73
79 virtual std::unique_ptr<libpressio_launch_plugin> clone() const = 0;
80};
81
86
91
97 pressio_launcher(std::unique_ptr<libpressio_launch_plugin>&& ptr): plugin(std::move(ptr)) {}
98
104 pressio_launcher(pressio_launcher const& launcher): plugin(launcher.plugin->clone()) {}
105
111 pressio_launcher(pressio_launcher&& compressor)=default;
112
118 pressio_launcher& operator=(pressio_launcher&& launcher) noexcept=default;
119
123 operator bool() const {
124 return bool(plugin);
125 }
126
131 return *plugin;
132 }
133
138 return plugin.get();
139 }
140
144 std::unique_ptr<libpressio_launch_plugin> plugin;
145};
146
151
152#endif /* end of include guard: LIBPRESSIO_EXTERNAL_LAUNCH_H */
Definition: configurable.h:17
void set(pressio_options &options, StringType const &key, pressio_option const &value) const
Definition: configurable.h:97
an extension header for adding compressor plugins to libpressio
interface for configurable types
interface for types which can report and have errors
extern_proc_error_codes
Definition: external_launch.h:21
@ fork_error
Definition: external_launch.h:27
@ pipe_error
Definition: external_launch.h:25
@ format_error
Definition: external_launch.h:31
@ exec_error
Definition: external_launch.h:29
@ success
Definition: external_launch.h:23
pressio_registry< std::unique_ptr< libpressio_launch_plugin > > & launch_plugins()
C++ interface to the compressor loader.
Definition: external_launch.h:37
std::string proc_stdout
Definition: external_launch.h:39
int error_code
Definition: external_launch.h:45
int return_code
Definition: external_launch.h:43
std::string proc_stderr
Definition: external_launch.h:41
Definition: external_launch.h:51
pressio_options get_documentation() const final
Definition: external_launch.h:61
virtual extern_proc_results launch(std::vector< std::string > const &args) const =0
virtual pressio_options get_documentation_impl() const =0
virtual std::unique_ptr< libpressio_launch_plugin > clone() const =0
Definition: external_launch.h:85
libpressio_launch_plugin * operator->() const noexcept
Definition: external_launch.h:137
pressio_launcher(pressio_launcher const &launcher)
Definition: external_launch.h:104
pressio_launcher(pressio_launcher &&compressor)=default
libpressio_launch_plugin & operator*() const noexcept
Definition: external_launch.h:130
pressio_launcher(std::unique_ptr< libpressio_launch_plugin > &&ptr)
Definition: external_launch.h:97
std::unique_ptr< libpressio_launch_plugin > plugin
Definition: external_launch.h:144
pressio_launcher & operator=(pressio_launcher &&launcher) noexcept=default
pressio_launcher()=default
Definition: options.h:352
void copy_from(pressio_options const &o, bool ignore_empty=false)
Definition: options.h:664
Definition: pressio.h:19