Colobot
programmable_object.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
20 #pragma once
21 
23 
24 #include <memory>
25 #include <string>
26 #include <vector>
27 
28 struct Program;
29 
37 {
38 public:
39  explicit CProgrammableObject(ObjectInterfaceTypes& types)
40  {
41  types[static_cast<int>(ObjectInterfaceType::Programmable)] = true;
42  }
43  virtual ~CProgrammableObject()
44  {}
45 
47  virtual void RunProgram(Program* program) = 0;
49  virtual void StopProgram() = 0;
51  virtual Program* GetCurrentProgram() = 0;
53  virtual bool IsProgram() = 0;
54 
56  virtual bool WriteStack(FILE *file) = 0;
58  virtual bool ReadStack(FILE *file) = 0;
59 
61  virtual void TraceRecordStart() = 0;
63  virtual void TraceRecordStop() = 0;
65  virtual bool IsTraceRecord() = 0;
66 
68 
69  virtual void SetActivity(bool bMode) = 0;
70  virtual bool GetActivity() = 0;
72 
74  virtual float GetCmdLine(unsigned int rank) = 0;
75 };
virtual void SetActivity(bool bMode)=0
Management of object "activity" (temporairly stops program execution, right now used only by Aliens i...
virtual bool IsProgram()=0
Check if a program is running.
virtual void StopProgram()=0
Stop currently running program.
virtual bool WriteStack(FILE *file)=0
Save current execution status to file.
Interface for programmable objects.
Definition: programmable_object.h:36
virtual bool IsTraceRecord()=0
Returns true if trace recording is in progress.
objects that can be programmed in CBOT
ObjectInterfaceType enum.
virtual Program * GetCurrentProgram()=0
Returns the currently running program, or nullptr if no program is running.
virtual void TraceRecordStop()=0
Stop recording trace and generate CBot program.
virtual void TraceRecordStart()=0
Start recording trace.
virtual float GetCmdLine(unsigned int rank)=0
Returns program cmdline values for an object.
virtual void RunProgram(Program *program)=0
Start a program.
virtual bool ReadStack(FILE *file)=0
Read current execution status from file.
Definition: program_storage_object.h:31