Guitarix
gx_child_process.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009, 2010 Hermann Meyer, James Warden, Andreas Degert
3 * Copyright (C) 2011 Pete Shorthose
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 * --------------------------------------------------------------------------
19 */
20
21/* ------- This is the Child Processes namespace ------- */
22
23#pragma once
24
25#ifndef SRC_HEADERS_GX_CHILD_PROCESS_H_
26#define SRC_HEADERS_GX_CHILD_PROCESS_H_
27
28#include <sigc++/sigc++.h>
29
30#include <string>
31#include <list>
32
34
35class GxChild {
36 public:
37 sigc::signal<void, bool> terminated;
38 bool kill();
39 bool hasPid(pid_t pid) { return pid == m_pid; }
40 bool hasName(string name) { return name == m_name; }
41
42 private:
43 string m_name;
45 int m_pid;
46 GxChild(string name, int killsignal, int pid):
47 m_name(name), m_killsignal(killsignal), m_pid(pid) {}
48 friend class GxChildProcs;
49};
50
52 private:
53 list<GxChild*> children;
54
55 public:
57 bool killall();
58 bool kill(string name);
59 GxChild *find(string name);
60 GxChild *launch(string name, const char* const args[], int killsignal);
61 GxChild *launch(string name, list<string> args, int killsignal);
62 friend void gx_sigchld_handler();
63};
64
67
68
69/****************************************************************
70 ** classes for UI callbacks
71 */
72
73#if false // unused
74class JackCaptureGui: public sigc::trackable {
75 private:
76 GtkCheckMenuItem *item;
77 void terminated(bool pgm_found);
78 JackCaptureGui(GxChild *p, GtkCheckMenuItem *i);
79 public:
80 static void start_stop(GtkCheckMenuItem *menuitem, gpointer);
81};
82
83class JackCapture: public sigc::trackable {
84 private:
85 GtkToggleButton *button;
86 void terminated(bool pgm_found);
87 static string make_fname(string buf, size_t j, size_t i, int n);
88 static list<string> capture_command(int& seq);
89 JackCapture(GxChild *p, GtkToggleButton *b);
90 public:
91 static void start_stop(GtkWidget *widget, gpointer data);
92 static void stop();
93};
94#endif
95
96class Meterbridge: public sigc::trackable {
97 private:
98 Glib::RefPtr<ToggleAction> action;
99 void terminated(bool pgm_found);
100 Meterbridge(GxChild *p, Glib::RefPtr<ToggleAction>& a);
101 public:
102 static void start_stop(Glib::RefPtr<ToggleAction>& action, gx_jack::GxJack& jack);
103 static void stop();
104};
105
106/* -------------------------------------------------------------------------- */
107} /* end of gx_child_process namespace */
108#endif // SRC_HEADERS_GX_CHILD_PROCESS_H_
sigc::signal< void, bool > terminated
bool hasName(string name)
GxChild(string name, int killsignal, int pid)
GxChild * launch(string name, const char *const args[], int killsignal)
GxChild * launch(string name, list< string > args, int killsignal)
GxChild * find(string name)
static void start_stop(Glib::RefPtr< ToggleAction > &action, gx_jack::GxJack &jack)
Meterbridge(GxChild *p, Glib::RefPtr< ToggleAction > &a)
Glib::RefPtr< ToggleAction > action
void terminated(bool pgm_found)
GxChildProcs childprocs
void gx_sigchld_handler()