ape  0.5.0
Audio Programming Environment
ProtoCompiler.hpp
Go to the documentation of this file.
1 /*************************************************************************************
2 
3  Audio Programming Environment - Audio Plugin - v. 0.3.0.
4 
5  Copyright (C) 2017 Janus Lynggaard Thorborg [LightBridge Studios]
6 
7  This program is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 
20  See \licenses\ for additional details on licenses associated with this program.
21 
22  **************************************************************************************
23 
24  file:ProtoCompiler.h
25 
26  Defines a prototype (well, abstract class) of a compiler to be used
27  together with CompilerBindings.h and CppCompilerInterface.cpp,
28  providing automatic bindings with ape.
29 
30 *************************************************************************************/
31 
32 #ifndef APE_PROTOCOMPILER_H
33  #define APE_PROTOCOMPILER_H
34 
35  #include "APE.h"
36  #include "Project.h"
37  #include "Events.h"
38  #include <utility>
39  #include <string>
40 
41  namespace ape
42  {
43  class ProtoCompiler
44  {
45  public:
46 
47  // changes current project
48  void setProject(Project * p) { project = p; }
49  Project * getProject() noexcept { return project; }
50  // prints to error function
51  void print(APE_Diagnostic level, const char * s)
52  {
53  if(project && project->reportDiagnostic)
54  project->reportDiagnostic(project, level, s);
55  }
56 
57  void print(APE_Diagnostic level, const std::string& s)
58  {
59  print(level, s.c_str());
60  }
61 
62  // wrappers for the compiler api
63  virtual Status processReplacing(const float * const * in, float * const * out, std::size_t frames) = 0;
64  virtual Status compileProject() = 0;
65  virtual Status releaseProject() = 0;
66  virtual Status initProject() = 0;
67  virtual Status activateProject() = 0;
68  virtual Status disableProject(bool didMisbehave = false) = 0;
69 
70  virtual Status onEvent(Event * e)
71  {
73  }
74 
75  virtual ~ProtoCompiler() {}
76 
77  private:
78  // the project our instance is associated with
79  Project * project = nullptr;
80 
81  };
82  }
83 #endif
APE.h
ape::ProtoCompiler::disableProject
virtual Status disableProject(bool didMisbehave=false)=0
ape::ProtoCompiler::initProject
virtual Status initProject()=0
ape::ProtoCompiler::activateProject
virtual Status activateProject()=0
Project.h
Events.h
ape::ProtoCompiler::getProject
Project * getProject() noexcept
Definition: ProtoCompiler.hpp:104
ape::ProtoCompiler::compileProject
virtual Status compileProject()=0
ape::ProtoCompiler::setProject
void setProject(Project *p)
Definition: ProtoCompiler.hpp:103
APE_Diagnostic
APE_Diagnostic
Definition: APE.h:76
ape
Definition: audiofile.h:7
ape::ProtoCompiler::print
void print(APE_Diagnostic level, const char *s)
Definition: ProtoCompiler.hpp:106
ape::ProtoCompiler::~ProtoCompiler
virtual ~ProtoCompiler()
Definition: ProtoCompiler.hpp:130
ape::ProtoCompiler::releaseProject
virtual Status releaseProject()=0
ape::ProtoCompiler::onEvent
virtual Status onEvent(Event *e)
Definition: ProtoCompiler.hpp:125
STATUS_NOT_IMPLEMENTED
Definition: APE.h:73
ape::ProtoCompiler::processReplacing
virtual Status processReplacing(const float *const *in, float *const *out, std::size_t frames)=0