Skyscraper 2.0
action.h
Go to the documentation of this file.
1/*
2 Scalable Building Simulator - Action Interface Class
3 The Skyscraper Project - Version 2.0
4 Copyright (C)2004-2024 Ryan Thoryk
5 https://www.skyscrapersim.net
6 https://sourceforge.net/projects/skyscraper/
7 Contact - ryan@skyscrapersim.net
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22*/
23
24#ifndef _SBS_ACTION_H
25#define _SBS_ACTION_H
26
27namespace SBS {
28
30{
31public:
32 //functions
33 Action(Object *parent, const std::string &name, std::vector<Object*> &action_parents, const std::string &command, const std::vector<std::string> &parameters);
34 Action(Object *parent, const std::string &name, std::vector<Object*> &action_parents, const std::string &command);
35 ~Action();
36 bool DoAction(Object *caller, bool &hold);
37 std::string GetCommandName();
38 const Object *GetParent(int number);
39 std::string GetParentName(int number);
40 std::string GetParentType(int number);
41 int GetParentCount();
42 int GetParameterCount();
43 std::string GetParameter(int index);
44 bool AddParent(Object *parent);
45 bool RemoveParent(Object *parent);
46
47private:
48
49 bool Run(Object *caller, Object *parent, bool &hold);
50
51 std::string command_name;
52 std::vector<std::string> command_parameters;
53 std::vector<Object*> parent_objects;
54};
55
56}
57
58#endif
std::vector< Object * > parent_objects
Definition action.h:53
std::vector< std::string > command_parameters
Definition action.h:52
std::string command_name
Definition action.h:51
#define SBSIMPEXP
Definition globals.h:53