OpenASIP 2.2
Loading...
Searching...
No Matches
ResumeCommand.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file ResumeCommand.cc
26 *
27 * Implementation of ResumeCommand class
28 *
29 * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include "ResumeCommand.hh"
34#include "Application.hh"
35#include "SimulatorFrontend.hh"
37#include "Exception.hh"
38#include "SimulatorToolbox.hh"
40
41/**
42 * Constructor.
43 *
44 * Sets the name of the command to the base class.
45 */
49
50/**
51 * Destructor.
52 *
53 * Does nothing.
54 */
57
58/**
59 * Executes the "resume" command.
60 *
61 * Resume simulation of the program until the simulation is finished or
62 * a breakpoint is reached. The optional argument gives the number of times
63 * the continue command is repeated, that is, the number of times breakpoints
64 * should be ignored.
65 *
66 * @param arguments (optional) count of times to repeat in case breakpoints are
67 * reached.
68 * @return Always true.
69 * @exception NumberFormatException Is never thrown by this command.
70 *
71 */
72bool
73ResumeCommand::execute(const std::vector<DataObject>& arguments) {
74 // how many times breakpoints should be ignored?
75 int repeatCount = 0;
76 if (!checkArgumentCount(arguments.size() - 1, 0, 1)) {
77 return false;
78 } else {
79 if (arguments.size() > 1) {
80 if (!checkPositiveIntegerArgument(arguments[1])) {
81 return false;
82 } else {
83 repeatCount = arguments[1].integerValue();
84 }
85 }
86 }
87
89 return false;
90 }
91
92 int repeats = 0;
93 do {
95 ++repeats;
96 } while(simulatorFrontend().isSimulationStopped() &&
97 repeats < repeatCount);
98
100
101 return true;
102}
103
104/**
105 * Returns the help text for this command.
106 *
107 * Help text is searched from SimulatorTextGenerator.
108 *
109 * @return The help text.
110 * @todo Use SimulatorTextGenerator to get the help text.
111 */
112std::string
117
bool checkArgumentCount(int argumentCount, int minimum, int maximum)
bool checkPositiveIntegerArgument(const DataObject &argument)
virtual ~ResumeCommand()
virtual bool execute(const std::vector< DataObject > &arguments)
virtual std::string helpText() const
static SimulatorTextGenerator & textGenerator()
virtual boost::format text(int textId)
@ TXT_INTERP_HELP_RESUME
Help text for command "resume" of the CLI.