MythTV  master
Programs.h
Go to the documentation of this file.
1 /* Programs.h
2 
3  Copyright (C) David C. J. Matthews 2004 dm at prolingua.co.uk
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  as published by the Free Software Foundation; either version 2
8  of the License, or (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  Or, point your browser to http://www.gnu.org/copyleft/gpl.html
19 
20 */
21 
22 
23 #if !defined(PROGRAMS_H)
24 #define PROGRAMS_H
25 
26 #include "Ingredients.h"
27 #include "BaseActions.h"
28 // Dependencies
29 #include "Root.h"
30 #include "BaseClasses.h"
31 
32 class MHEngine;
33 
34 // Abstract base class for programs.
35 class MHProgram : public MHIngredient
36 {
37  public:
38  MHProgram() = default;
39  void Initialise(MHParseNode *p, MHEngine *engine) override; // MHIngredient
40  void PrintMe(FILE *fd, int nTabs) const override; // MHIngredient
41  bool InitiallyAvailable() override // MHIngredient
42  { return m_fInitiallyAvailable; }
43  void Activation(MHEngine *engine) override; // MHRoot
44  void Deactivation(MHEngine *engine) override; // MHRoot
45 
46  // Action - Stop can be used to stop the code.
47  void Stop(MHEngine *engine) override // MHRoot
48  { Deactivation(engine); }
49  protected:
50  MHOctetString m_name; // Name of the program
51  bool m_fInitiallyAvailable {true};
52 };
53 
54 // Resident program
56 {
57  public:
58  MHResidentProgram() = default;
59  const char *ClassName() override // MHRoot
60  { return "ResidentProgram"; }
61  void PrintMe(FILE *fd, int nTabs) const override; // MHProgram
62  void CallProgram(bool fIsFork, const MHObjectRef &success,
63  const MHSequence<MHParameter *> &args, MHEngine *engine) override; // MHRoot
64 };
65 
66 // Remote program - not needed for UK MHEG
67 class MHRemoteProgram : public MHProgram
68 {
69  public:
70  MHRemoteProgram() = default;
71  const char *ClassName() override // MHRoot
72  { return "RemoteProgram"; }
73  ~MHRemoteProgram() override = default;
74  void Initialise(MHParseNode *p, MHEngine *engine) override; // MHProgram
75  void PrintMe(FILE *fd, int nTabs) const override; // MHProgram
76 };
77 
78 // Interchange program - not needed for UK MHEG
80 {
81  public:
82  MHInterChgProgram() = default;
83  const char *ClassName() override // MHRoot
84  { return "InterChgProgram"; }
85  ~MHInterChgProgram() override = default;
86  void Initialise(MHParseNode *p, MHEngine *engine) override; // MHProgram
87  void PrintMe(FILE *fd, int nTabs) const override; // MHProgram
88 };
89 
90 // Call and Fork - call a "program".
91 class MHCall: public MHElemAction
92 {
93  public:
94  MHCall(const char *name, bool fIsFork): MHElemAction(name), m_fIsFork(fIsFork) {}
95  void Initialise(MHParseNode *p, MHEngine *engine) override; // MHElemAction
96  void Perform(MHEngine *engine) override; // MHElemAction
97  protected:
98  void PrintArgs(FILE *fd, int nTabs) const override; // MHElemAction
99  bool m_fIsFork;
100  MHObjectRef m_succeeded; // Boolean variable set to call result
102 };
103 
104 #endif
MHRemoteProgram
Definition: Programs.h:67
MHObjectRef
Definition: BaseClasses.h:156
build_compdb.args
args
Definition: build_compdb.py:11
MHInterChgProgram
Definition: Programs.h:79
MHInterChgProgram::PrintMe
void PrintMe(FILE *fd, int nTabs) const override
Definition: Programs.cpp:976
MHProgram::m_name
MHOctetString m_name
Definition: Programs.h:50
MHProgram::Stop
void Stop(MHEngine *engine) override
Definition: Programs.h:47
MHCall::m_parameters
MHOwnPtrSequence< MHParameter > m_parameters
Definition: Programs.h:101
MHProgram::Initialise
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: Programs.cpp:59
MHEngine
Definition: Engine.h:72
MHResidentProgram::MHResidentProgram
MHResidentProgram()=default
MHResidentProgram::CallProgram
void CallProgram(bool fIsFork, const MHObjectRef &success, const MHSequence< MHParameter * > &args, MHEngine *engine) override
Definition: Programs.cpp:163
MHCall::Perform
void Perform(MHEngine *engine) override
Definition: Programs.cpp:1015
MHProgram
Definition: Programs.h:35
MHProgram::InitiallyAvailable
bool InitiallyAvailable() override
Definition: Programs.h:41
MHSequence< MHParameter * >
MHOctetString
Definition: BaseClasses.h:110
mythburn.FILE
int FILE
Definition: mythburn.py:139
MHCall::PrintArgs
void PrintArgs(FILE *fd, int nTabs) const override
Definition: Programs.cpp:1002
MHRemoteProgram::~MHRemoteProgram
~MHRemoteProgram() override=default
MHCall::m_fIsFork
bool m_fIsFork
Definition: Programs.h:99
MHProgram::m_fInitiallyAvailable
bool m_fInitiallyAvailable
Definition: Programs.h:51
MHInterChgProgram::ClassName
const char * ClassName() override
Definition: Programs.h:83
MHInterChgProgram::MHInterChgProgram
MHInterChgProgram()=default
hardwareprofile.config.p
p
Definition: config.py:33
MHRemoteProgram::MHRemoteProgram
MHRemoteProgram()=default
MHResidentProgram::PrintMe
void PrintMe(FILE *fd, int nTabs) const override
Definition: Programs.cpp:122
MHProgram::MHProgram
MHProgram()=default
MHRemoteProgram::Initialise
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: Programs.cpp:954
MHCall
Definition: Programs.h:91
Ingredients.h
MHRemoteProgram::PrintMe
void PrintMe(FILE *fd, int nTabs) const override
Definition: Programs.cpp:960
MHIngredient
Definition: Ingredients.h:33
MHCall::m_succeeded
MHObjectRef m_succeeded
Definition: Programs.h:100
Root.h
MHCall::Initialise
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: Programs.cpp:987
MHProgram::Deactivation
void Deactivation(MHEngine *engine) override
Definition: Programs.cpp:111
MHInterChgProgram::~MHInterChgProgram
~MHInterChgProgram() override=default
BaseClasses.h
MHResidentProgram::ClassName
const char * ClassName() override
Definition: Programs.h:59
MHInterChgProgram::Initialise
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: Programs.cpp:970
MHParseNode
Definition: ParseNode.h:38
MHProgram::PrintMe
void PrintMe(FILE *fd, int nTabs) const override
Definition: Programs.cpp:81
MHRemoteProgram::ClassName
const char * ClassName() override
Definition: Programs.h:71
MHCall::MHCall
MHCall(const char *name, bool fIsFork)
Definition: Programs.h:94
MHProgram::Activation
void Activation(MHEngine *engine) override
Definition: Programs.cpp:98
MHElemAction
Definition: BaseActions.h:34
MHResidentProgram
Definition: Programs.h:55
BaseActions.h
MHOwnPtrSequence< MHParameter >