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#ifndef 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
32class MHEngine;
33
34// Abstract base class for programs.
35class 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
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
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".
91class 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
100 MHObjectRef m_succeeded; // Boolean variable set to call result
102};
103
104#endif
MHObjectRef m_succeeded
Definition: Programs.h:100
MHOwnPtrSequence< MHParameter > m_parameters
Definition: Programs.h:101
void PrintArgs(FILE *fd, int nTabs) const override
Definition: Programs.cpp:1043
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: Programs.cpp:1028
MHCall(const char *name, bool fIsFork)
Definition: Programs.h:94
void Perform(MHEngine *engine) override
Definition: Programs.cpp:1056
bool m_fIsFork
Definition: Programs.h:99
MHInterChgProgram()=default
~MHInterChgProgram() override=default
const char * ClassName() override
Definition: Programs.h:83
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: Programs.cpp:1011
void PrintMe(FILE *fd, int nTabs) const override
Definition: Programs.cpp:1017
bool m_fInitiallyAvailable
Definition: Programs.h:51
bool InitiallyAvailable() override
Definition: Programs.h:41
void Activation(MHEngine *engine) override
Definition: Programs.cpp:88
MHOctetString m_name
Definition: Programs.h:50
MHProgram()=default
void Stop(MHEngine *engine) override
Definition: Programs.h:47
void Deactivation(MHEngine *engine) override
Definition: Programs.cpp:101
void PrintMe(FILE *fd, int nTabs) const override
Definition: Programs.cpp:71
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: Programs.cpp:49
const char * ClassName() override
Definition: Programs.h:71
~MHRemoteProgram() override=default
MHRemoteProgram()=default
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: Programs.cpp:995
void PrintMe(FILE *fd, int nTabs) const override
Definition: Programs.cpp:1001
void PrintMe(FILE *fd, int nTabs) const override
Definition: Programs.cpp:112
MHResidentProgram()=default
const char * ClassName() override
Definition: Programs.h:59
void CallProgram(bool fIsFork, const MHObjectRef &success, const MHSequence< MHParameter * > &args, MHEngine *engine) override
Definition: Programs.cpp:186
int FILE
Definition: mythburn.py:138