OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
Echo.cpp
Go to the documentation of this file.
1//
2// Class Echo
3// The class for OPAL ECHO command.
4//
5// Copyright (c) 2000 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
6// All rights reserved
7//
8// This file is part of OPAL.
9//
10// OPAL is free software: you can redistribute it and/or modify
11// it under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// You should have received a copy of the GNU General Public License
16// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
17//
18#include "BasicActions/Echo.h"
19#include "Ippl.h"
20
22#include "Utility/IpplInfo.h"
23
24#include <iostream>
25
26Echo::Echo() : Action(1, "ECHO", "The \"ECHO\" statement sends a message to the ECHO file.") {
27 itsAttr[0] = Attributes::makeString("MESSAGE", "The message to be sent.");
28
30}
31
32Echo::Echo(const std::string& name, Echo* parent) : Action(name, parent) {
33}
34
37
38Echo* Echo::clone(const std::string& name) {
39 return new Echo(name, this);
40}
41
43 if (ippl::Comm->rank() == 0)
44 std::cerr << Attributes::getString(itsAttr[0]) << std::endl;
45}
46
47void Echo::parse(Statement& statement) {
48 parseShortcut(statement);
49}
std::string getString(const Attribute &attr)
Get string value.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Action(int size, const char *name, const char *help)
Constructor for exemplars.
Definition Action.cpp:54
virtual void parseShortcut(Statement &, bool eval=true)
Parser for single-attribute commands.
Definition Object.cpp:127
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
Definition Object.cpp:189
std::vector< Attribute > itsAttr
The object attributes.
Definition Object.h:216
virtual ~Echo()
Definition Echo.cpp:35
virtual void execute()
Execute the command.
Definition Echo.cpp:42
virtual Echo * clone(const std::string &name)
Make clone.
Definition Echo.cpp:38
Echo()
Exemplar constructor.
Definition Echo.cpp:26
virtual void parse(Statement &)
Parse command (special for one-attribute command).
Definition Echo.cpp:47
Interface for statements.
Definition Statement.h:38