MatchOption.cpp 1.52 KB
Newer Older
gsell's avatar
gsell committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
// ------------------------------------------------------------------------
// $RCSfile: MatchOption.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: MatchOption
//   The class for the OPAL OPTION command.
//
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:33:44 $
// $Author: Andreas Adelmann $
//
// ------------------------------------------------------------------------

#include "Match/MatchOption.h"
#include "Attributes/Attributes.h"
#include "Match/Match.h"
22
#include <cmath>
gsell's avatar
gsell committed
23 24 25 26 27 28 29 30 31

// Class MatchOption
// ------------------------------------------------------------------------

MatchOption::MatchOption():
    Action(1, "OPTION",
           "The \"OPTION\" sub-command sets matching options.") {
    itsAttr[0] = Attributes::makeReal
                 ("LEVEL", "The desired verbosity for output", 0.0);
32 33

    registerOwnership(AttributeHandler::SUB_COMMAND);
gsell's avatar
gsell committed
34 35 36
}


37
MatchOption::MatchOption(const std::string &name, MatchOption *parent):
gsell's avatar
gsell committed
38 39 40 41 42 43 44 45
    Action(name, parent)
{}


MatchOption::~MatchOption()
{}


46
MatchOption *MatchOption::clone(const std::string &name) {
gsell's avatar
gsell committed
47 48 49 50 51
    return new MatchOption(name, this);
}


void MatchOption::execute() {
52
    int level = int(std::round(Attributes::getReal(itsAttr[0])));
gsell's avatar
gsell committed
53
    Match::block->setPrintLevel(level);
54
}