Loading...
Searching...
No Matches
gx_child_process.h
Go to the documentation of this file.
/*
* Copyright (C) 2009, 2010 Hermann Meyer, James Warden, Andreas Degert
* Copyright (C) 2011 Pete Shorthose
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* --------------------------------------------------------------------------
*/
/* ------- This is the Child Processes namespace ------- */
#pragma once
#ifndef SRC_HEADERS_GX_CHILD_PROCESS_H_
#define SRC_HEADERS_GX_CHILD_PROCESS_H_
#include <sigc++/sigc++.h>
#include <string>
#include <list>
namespace gx_child_process {
class GxChild {
public:
sigc::signal<void, bool> terminated;
bool kill();
bool hasPid(pid_t pid) { return pid == m_pid; }
bool hasName(string name) { return name == m_name; }
private:
string m_name;
int m_killsignal;
int m_pid;
GxChild(string name, int killsignal, int pid):
m_name(name), m_killsignal(killsignal), m_pid(pid) {}
friend class GxChildProcs;
};
class GxChildProcs {
private:
list<GxChild*> children;
public:
~GxChildProcs();
bool killall();
bool kill(string name);
GxChild *find(string name);
GxChild *launch(string name, const char* const args[], int killsignal);
GxChild *launch(string name, list<string> args, int killsignal);
friend void gx_sigchld_handler();
};
extern GxChildProcs childprocs;
void gx_sigchld_handler();
/****************************************************************
** classes for UI callbacks
*/
#if false // unused
class JackCaptureGui: public sigc::trackable {
private:
GtkCheckMenuItem *item;
void terminated(bool pgm_found);
JackCaptureGui(GxChild *p, GtkCheckMenuItem *i);
public:
static void start_stop(GtkCheckMenuItem *menuitem, gpointer);
};
class JackCapture: public sigc::trackable {
private:
GtkToggleButton *button;
void terminated(bool pgm_found);
static string make_fname(string buf, size_t j, size_t i, int n);
static list<string> capture_command(int& seq);
JackCapture(GxChild *p, GtkToggleButton *b);
public:
static void start_stop(GtkWidget *widget, gpointer data);
static void stop();
};
#endif
class Meterbridge: public sigc::trackable {
private:
Glib::RefPtr<ToggleAction> action;
void terminated(bool pgm_found);
Meterbridge(GxChild *p, Glib::RefPtr<ToggleAction>& a);
public:
static void start_stop(Glib::RefPtr<ToggleAction>& action, gx_jack::GxJack& jack);
static void stop();
};
/* -------------------------------------------------------------------------- */
} /* end of gx_child_process namespace */
#endif // SRC_HEADERS_GX_CHILD_PROCESS_H_
gx_child_process::GxChild
Definition gx_child_process.h:35
gx_child_process::GxChild::GxChildProcs
friend class GxChildProcs
Definition gx_child_process.h:48
gx_child_process::GxChild::kill
bool kill()
gx_child_process::GxChild::hasPid
bool hasPid(pid_t pid)
Definition gx_child_process.h:39
gx_child_process::GxChild::m_name
string m_name
Definition gx_child_process.h:43
gx_child_process::GxChild::m_killsignal
int m_killsignal
Definition gx_child_process.h:44
gx_child_process::GxChild::terminated
sigc::signal< void, bool > terminated
Definition gx_child_process.h:37
gx_child_process::GxChild::hasName
bool hasName(string name)
Definition gx_child_process.h:40
gx_child_process::GxChild::GxChild
GxChild(string name, int killsignal, int pid)
Definition gx_child_process.h:46
gx_child_process::GxChild::m_pid
int m_pid
Definition gx_child_process.h:45
gx_child_process::GxChildProcs
Definition gx_child_process.h:51
gx_child_process::GxChildProcs::launch
GxChild * launch(string name, const char *const args[], int killsignal)
gx_child_process::GxChildProcs::kill
bool kill(string name)
gx_child_process::GxChildProcs::~GxChildProcs
~GxChildProcs()
gx_child_process::GxChildProcs::launch
GxChild * launch(string name, list< string > args, int killsignal)
gx_child_process::GxChildProcs::killall
bool killall()
gx_child_process::GxChildProcs::find
GxChild * find(string name)
gx_child_process::GxChildProcs::children
list< GxChild * > children
Definition gx_child_process.h:53
gx_child_process::GxChildProcs::gx_sigchld_handler
friend void gx_sigchld_handler()
gx_child_process::Meterbridge::start_stop
static void start_stop(Glib::RefPtr< ToggleAction > &action, gx_jack::GxJack &jack)
gx_child_process::Meterbridge::Meterbridge
Meterbridge(GxChild *p, Glib::RefPtr< ToggleAction > &a)
gx_child_process::Meterbridge::action
Glib::RefPtr< ToggleAction > action
Definition gx_child_process.h:98
gx_child_process::Meterbridge::terminated
void terminated(bool pgm_found)
gx_child_process::Meterbridge::stop
static void stop()
gx_jack::GxJack
Definition gx_jack.h:168
gx_child_process
Definition gx_child_process.h:33
gx_child_process::childprocs
GxChildProcs childprocs
gx_child_process::gx_sigchld_handler
void gx_sigchld_handler()