OpalWake.h 1.66 KB
Newer Older
gsell's avatar
gsell committed
1
//
2 3
// Class OpalWake
//   The class for the OPAL WAKE command.
gsell's avatar
gsell committed
4
//
5 6
// Copyright (c) 2008 - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
gsell's avatar
gsell committed
7
//
8
// This file is part of OPAL.
gsell's avatar
gsell committed
9
//
10 11 12 13 14 15 16 17 18 19
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_Wake_HH
#define OPAL_Wake_HH
gsell's avatar
gsell committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

#include "AbstractObjects/Definition.h"

class ElementBase;
class WakeFunction;

class OpalWake: public Definition {

public:

    /// Exemplar constructor.
    OpalWake();

    virtual ~OpalWake();

    /// Test if replacement is allowed.
    //  Can replace only by another WAKE.
    virtual bool canReplaceBy(Object *object);

    /// Make clone.
Steve Russell's avatar
Steve Russell committed
40
    virtual OpalWake *clone(const std::string &name);
gsell's avatar
gsell committed
41 42 43 44 45

    /// Check the WAKE data.
    virtual void execute();

    /// Find named WAKE.
Steve Russell's avatar
Steve Russell committed
46
    static OpalWake *find(const std::string &name);
gsell's avatar
gsell committed
47 48 49 50 51 52 53 54

    /// Update the WAKE data.
    virtual void update();

    void print(std::ostream &os) const;

    int getNumberOfBins();

55
    void initWakefunction(const ElementBase &element);
gsell's avatar
gsell committed
56 57 58 59 60 61 62 63 64 65

    WakeFunction *wf_m;

private:

    // Not implemented.
    OpalWake(const OpalWake &);
    void operator=(const OpalWake &);

    // Clone constructor.
Steve Russell's avatar
Steve Russell committed
66
    OpalWake(const std::string &name, OpalWake *parent);
gsell's avatar
gsell committed
67 68 69 70 71 72 73 74
};

inline std::ostream &operator<<(std::ostream &os, const OpalWake &b) {
    b.print(os);
    return os;
}

#endif // OPAL_Wake_HH