Skip to content
Snippets Groups Projects
Commit c3839df0 authored by Damien Lacoste's avatar Damien Lacoste
Browse files

Fix missing std prefix in Magnet.cpp and Multipole.cpp

parent ebcb7e64
No related branches found
No related tags found
No related merge requests found
Pipeline #181345 failed
Pipeline: EbsMagnet

#181346

    ......@@ -5,7 +5,7 @@ namespace EbsMagnet_ns {
    // -----------------------------------------------------------------------------------------
    // Create a magnet object according to type
    Magnet *Magnet::Create(EbsMagnet *ds, bool focusing, double crossTalk, string &serial, string &type, string &model) {
    Magnet *Magnet::Create(EbsMagnet *ds, bool focusing, double crossTalk, string &serial, std::string &type, std::string &model) {
    if (Magnet::compare(type, "Q")) {
    return new Quadrupole(ds, focusing, crossTalk, serial, model, type);
    ......@@ -29,7 +29,7 @@ Magnet *Magnet::Create(EbsMagnet *ds, bool focusing, double crossTalk, string &s
    // -----------------------------------------------------------------------------------------
    // Default constructor
    Magnet::Magnet(EbsMagnet *ds, string& type, string& serial, string& modelName):
    Magnet::Magnet(EbsMagnet *ds, std::string& type, std::string& serial, std::string& modelName):
    ds(ds), modelName(modelName), serial(serial), type(type) {
    parseConfig();
    model = nullptr;
    ......@@ -46,7 +46,7 @@ Magnet::~Magnet() {
    void Magnet::parseConfig() {
    Tango::Database *db = Tango::Util::instance()->get_database();
    vector<Tango::DbDatum> dd;
    std::vector<Tango::DbDatum> dd;
    dd.emplace_back(Tango::DbDatum(modelName));
    db->get_property("EbsMagnet",dd);
    if(dd[0].is_empty()) {
    ......@@ -55,10 +55,10 @@ void Magnet::parseConfig() {
    "Magnet::parseConfig");
    }
    vector<string> values;
    std::vector<std::string> values;
    dd[0] >> values;
    for(auto & value : values) {
    vector<string> fields;
    std::vector<std::string> fields;
    split(fields,value,':');
    if(fields.size()!=2)
    Tango::Except::throw_exception("configError",
    ......@@ -82,7 +82,7 @@ void Magnet::parseConfig() {
    ConfigItem item;
    item.name = "_path";
    string pathStr;
    std::string pathStr;
    dd[0] >> pathStr;
    item.value = pathStr;
    config.emplace_back(item);
    ......@@ -91,7 +91,7 @@ void Magnet::parseConfig() {
    // -----------------------------------------------------------------------------------------
    // Return configuration item
    string Magnet::getConfigItem(const string& name) {
    std::string Magnet::getConfigItem(const std::string& name) {
    bool found = false;
    size_t i = 0;
    ......@@ -107,9 +107,9 @@ string Magnet::getConfigItem(const string& name) {
    }
    double Magnet::getConfigItemDouble(const string& name) {
    double Magnet::getConfigItemDouble(const std::string& name) {
    string s = getConfigItem(name);
    std::string s = getConfigItem(name);
    try {
    return std::stod(s);
    } catch (std::invalid_argument& e) {
    ......@@ -122,43 +122,43 @@ double Magnet::getConfigItemDouble(const string& name) {
    // -----------------------------------------------------------------------------------------
    bool Magnet::isStrengthH(const string& name) {
    bool Magnet::isStrengthH(const std::string& name) {
    return compare(name,"Strength_H");
    }
    bool Magnet::isStrengthV(const string& name) {
    bool Magnet::isStrengthV(const std::string& name) {
    return compare(name,"Strength_V");
    }
    bool Magnet::isStrengthSQ(const string& name) {
    bool Magnet::isStrengthSQ(const std::string& name) {
    return compare(name,"Strength_SQ");
    }
    bool Magnet::isStrength(const string& name) {
    bool Magnet::isStrength(const std::string& name) {
    return compare(name,"Strength");
    }
    bool Magnet::isResonanceStrength(const string& name) {
    bool Magnet::isResonanceStrength(const std::string& name) {
    return compare(name,"ResonanceStrength");
    }
    bool Magnet::isCorrectionStrength(const string& name) {
    bool Magnet::isCorrectionStrength(const std::string& name) {
    return compare(name,"CorrectionStrength");
    }
    bool Magnet::isStrengths(const string& name) {
    bool Magnet::isStrengths(const std::string& name) {
    // All strengths that require a current change
    return isStrengthH(name) || isStrengthV(name) || isStrengthSQ(name) || isStrength(name) ||
    isCorrectionStrength(name) || isResonanceStrength(name);
    }
    bool Magnet::isFrozen(const string& name) {
    bool Magnet::isFrozen(const std::string& name) {
    return compare(name,"Frozen") || compare(name,"Frozen_H") || compare(name,"Frozen_V") || compare(name,"Frozen_SQ");
    }
    bool Magnet::isMainCurrent(const string& name) {
    bool Magnet::isMainCurrent(const std::string& name) {
    return compare(name,"MainCurrent");
    }
    bool Magnet::isCurrent(const string& name) {
    bool Magnet::isCurrent(const std::string& name) {
    return compare(name,"MainCurrent") || compare(name,"Current");
    }
    // -----------------------------------------------------------------------------------------
    // Add an attribute to the list
    AttributeItem *Magnet::addAttribute(const string& name,long data_type,Tango::AttrWriteType rwType,const string& unit,
    const string& format,bool memorized,bool memorized_init) {
    AttributeItem *Magnet::addAttribute(const std::string& name,long data_type,Tango::AttrWriteType rwType,const std::string& unit,
    const std::string& format,bool memorized,bool memorized_init) {
    AttributeItem item;
    ......@@ -209,8 +209,8 @@ void Magnet::createAttributes() {
    // Attribute from model (Strength, Strength_H, Strength_V, Strength_SQ)
    // ! Model strength attributes must at the top of the list in the model ordwer !
    vector<string> attNames;
    vector<string> attUnits;
    std::vector<std::string> attNames;
    std::vector<std::string> attUnits;
    model->get_strength_names(attNames);
    model->get_strength_units(attUnits);
    nbStrengths = attNames.size();
    ......@@ -252,9 +252,9 @@ void Magnet::createAttributes() {
    // -----------------------------------------------------------------------------------------
    // Return attributes of this magnet
    // Use only at initialisation time, Tango may delete them
    vector<DynAttribute *> Magnet::getAttributes() {
    std::vector<DynAttribute *> Magnet::getAttributes() {
    vector<DynAttribute *> ret;
    std::vector<DynAttribute *> ret;
    for(auto& att:scalarAttributes)
    ret.emplace_back(att.handle);
    return ret;
    ......@@ -263,7 +263,7 @@ vector<DynAttribute *> Magnet::getAttributes() {
    // -----------------------------------------------------------------------------------------
    // Update strengths from currents
    void Magnet::setCurrentsAndUpdateStrength(vector<double>& currents, vector<double>& setCurrents) {
    void Magnet::setCurrentsAndUpdateStrength(std::vector<double>& currents, std::vector<double>& setCurrents) {
    // Current attribute
    if(model->has_main_current()) {
    ......@@ -272,8 +272,8 @@ void Magnet::setCurrentsAndUpdateStrength(vector<double>& currents, vector<doubl
    }
    // Compute strengths
    vector<double> strengths;
    vector<double> setStrengths;
    std::vector<double> strengths;
    std::vector<double> setStrengths;
    try {
    model->compute_strengths(MAGNET_RIGIDITY_INV,currents,strengths);
    ......@@ -298,7 +298,7 @@ void Magnet::setCurrentsAndUpdateStrength(vector<double>& currents, vector<doubl
    // -----------------------------------------------------------------------------------------
    // Pseudo current/current conversion (SH only)
    void Magnet::computePseudoCurrentsFromCurrents(vector<double>& currents, vector<double>& pseudoCurrents) {
    void Magnet::computePseudoCurrentsFromCurrents(std::vector<double>& currents, std::vector<double>& pseudoCurrents) {
    model->compute_pseudo_currents_from_currents(currents,pseudoCurrents);
    ......@@ -352,7 +352,7 @@ void Magnet::updateCorrectionStrength() {
    // -----------------------------------------------------------------------------------------
    // Return pointer to the attribute having the given name
    AttributeItem *Magnet::getAttribute(const string& name) {
    AttributeItem *Magnet::getAttribute(const std::string& name) {
    bool found = false;
    size_t i = 0;
    ......@@ -391,10 +391,10 @@ void Magnet::readAttribute(Tango::Attribute &attr,string& name,void *readValue)
    }
    // -----------------------------------------------------------------------------------------
    vector<string> Magnet::getSetpointCheckCommands() {
    std::vector<string> Magnet::getSetpointCheckCommands() {
    vector<string> cmds;
    vector<string> strengthNames;
    std::vector<string> cmds;
    std::vector<string> strengthNames;
    model->get_strength_names(strengthNames);
    for(auto & strengthName : strengthNames)
    cmds.emplace_back("SetpointCheck" + getStrengthPrefix(strengthName));
    ......@@ -409,7 +409,7 @@ bool Magnet::setpointCheck(double strength,string& name) {
    if(isnan(strength))
    return true;
    vector<double> strengths;
    std::vector<double> strengths;
    for(size_t i=0;i<nbStrengths;i++)
    strengths.emplace_back(scalarAttributes[i].set.dValue);
    ......@@ -434,14 +434,14 @@ bool Magnet::setpointCheck(double strength,string& name) {
    }
    bool Magnet::setpointCheck(vector<double>& strengths) {
    bool Magnet::setpointCheck(std::vector<double>& strengths) {
    if( strengths.size() != nbStrengths )
    Tango::Except::throw_exception("CommandError",
    "Unexpected strength number: " + std::to_string(nbStrengths) + " values expected",
    "Magnet::setpointCheck");
    vector<double> currents;
    std::vector<double> currents;
    model->compute_currents(MAGNET_RIGIDITY,strengths,currents);
    return check_minmax(currents);
    ......@@ -449,7 +449,7 @@ bool Magnet::setpointCheck(vector<double>& strengths) {
    // -----------------------------------------------------------------------------------------
    // Check is given currents are OK for underlying PS
    bool Magnet::check_minmax(vector<double>& currents,bool throwException) {
    bool Magnet::check_minmax(std::vector<double>& currents,bool throwException) {
    if(!ds->minmaxAssigned)
    Tango::Except::throw_exception(
    ......@@ -478,7 +478,7 @@ bool Magnet::check_minmax(vector<double>& currents,bool throwException) {
    // -----------------------------------------------------------------------------------------
    // Write attribute, return true if current(s) have to be sent to PS
    void Magnet::writeAttribute(bool setValue,const string& name,vector<string>& psNames,vector<Tango::DevState>& psStates) {
    void Magnet::writeAttribute(bool setValue,const string& name,std::vector<string>& psNames,std::vector<Tango::DevState>& psStates) {
    // Frozen attributes
    AttributeItem *item = getAttribute(name);
    ......@@ -487,9 +487,9 @@ void Magnet::writeAttribute(bool setValue,const string& name,vector<string>& psN
    }
    void Magnet::writeAttribute(double setValue,const string& name,vector<string>& psNames,vector<Tango::DevState>& psStates) {
    void Magnet::writeAttribute(double setValue,const string& name,std::vector<string>& psNames,std::vector<Tango::DevState>& psStates) {
    vector<double> newCurrents;
    std::vector<double> newCurrents;
    // Check if allowed
    bool isStrength = isStrengths(name);
    ......@@ -514,7 +514,7 @@ void Magnet::writeAttribute(double setValue,const string& name,vector<string>& p
    }
    // Make a backup
    vector<double> oldSetpoints;
    std::vector<double> oldSetpoints;
    oldSetpoints.resize(scalarAttributes.size());
    for(size_t i=0;i<scalarAttributes.size();i++)
    oldSetpoints[i] = scalarAttributes[i].set.dValue;
    ......@@ -539,7 +539,7 @@ void Magnet::writeAttribute(double setValue,const string& name,vector<string>& p
    item->read.dValue = item->set.dValue;
    }
    vector<double> strengths;
    std::vector<double> strengths;
    for(size_t i=0;i<nbStrengths;i++)
    strengths.emplace_back(scalarAttributes[i].set.dValue);
    ......@@ -573,10 +573,10 @@ void Magnet::writeAttribute(double setValue,const string& name,vector<string>& p
    }
    void Magnet::writeStrengths(vector<double>& strengths) {
    void Magnet::writeStrengths(std::vector<double>& strengths) {
    setpointCheck(strengths);
    vector<double> newCurrents;
    std::vector<double> newCurrents;
    model->compute_currents(MAGNET_RIGIDITY, strengths, newCurrents);
    for(size_t i=0;i<nbCurrents;i++)
    ds->setCurrents[i] = newCurrents[i];
    ......@@ -598,7 +598,7 @@ void Magnet::send_currents() {
    ds->attr_RequireCycling_read[0] = true;
    vector<Tango::DeviceAttribute> attributes;
    std::vector<Tango::DeviceAttribute> attributes;
    for(double setCurrent : ds->setCurrents) {
    Tango::DeviceAttribute attribute("Current", setCurrent);
    attributes.push_back(attribute);
    ......@@ -662,7 +662,7 @@ void Magnet::frozenCheck(const string& name) {
    // -----------------------------------------------------------------------------------------
    // Throw an exception if an underlying power supply is not ON
    void Magnet::psCheck(const string& name,vector<string>& names,vector<Tango::DevState>& states) {
    void Magnet::psCheck(const string& name,std::vector<string>& names,std::vector<Tango::DevState>& states) {
    size_t i = 0;
    bool ok = true;
    ......
    ......@@ -3,7 +3,7 @@
    namespace EbsMagnet_ns {
    // -----------------------------------------------------------------------------------------
    Quadrupole::Quadrupole(EbsMagnet *ds, bool focusing,double crossTalk,string &serial,string &magModel,string& type):
    Quadrupole::Quadrupole(EbsMagnet *ds, bool focusing,double crossTalk,std::string &serial,std::string &magModel,std::string& type):
    Magnet(ds,type,serial,magModel) {
    // Init model
    ......@@ -27,7 +27,7 @@ Quadrupole::Quadrupole(EbsMagnet *ds, bool focusing,double crossTalk,string &ser
    }
    // -----------------------------------------------------------------------------------------
    Sextupole::Sextupole(EbsMagnet *ds, bool focusing,double crossTalk,string &serial,string &magModel,string& type):
    Sextupole::Sextupole(EbsMagnet *ds, bool focusing,double crossTalk,std::string &serial,std::string &magModel,std::string& type):
    Magnet(ds,type,serial,magModel) {
    // Init model
    ......@@ -49,7 +49,7 @@ Sextupole::Sextupole(EbsMagnet *ds, bool focusing,double crossTalk,string &seria
    }
    // -----------------------------------------------------------------------------------------
    Octupole::Octupole(EbsMagnet *ds, bool focusing,double crossTalk,string &serial,string &magModel,string& type):
    Octupole::Octupole(EbsMagnet *ds, bool focusing,double crossTalk,std::string &serial,std::string &magModel,std::string& type):
    Magnet(ds,type,serial,magModel) {
    // Init model
    ......@@ -73,7 +73,7 @@ Octupole::Octupole(EbsMagnet *ds, bool focusing,double crossTalk,string &serial,
    }
    // -----------------------------------------------------------------------------------------
    DipoleQuadrupole::DipoleQuadrupole(EbsMagnet *ds, bool focusing,double crossTalk,string &serial,string &magModel,string& type):
    DipoleQuadrupole::DipoleQuadrupole(EbsMagnet *ds, bool focusing,double crossTalk,std::string &serial,std::string &magModel,std::string& type):
    Magnet(ds,type,serial,magModel) {
    // Init model
    ......@@ -99,7 +99,7 @@ DipoleQuadrupole::DipoleQuadrupole(EbsMagnet *ds, bool focusing,double crossTalk
    }
    // -----------------------------------------------------------------------------------------
    SH3Magnet::SH3Magnet(EbsMagnet *ds, bool focusing,double crossTalk,string &serial,string &magModel,string& type):
    SH3Magnet::SH3Magnet(EbsMagnet *ds, bool focusing,double crossTalk,std::string &serial,std::string &magModel,std::string& type):
    Magnet(ds,type,serial,magModel) {
    // Init model
    ......@@ -123,7 +123,7 @@ SH3Magnet::SH3Magnet(EbsMagnet *ds, bool focusing,double crossTalk,string &seria
    }
    // -----------------------------------------------------------------------------------------
    SH5Magnet::SH5Magnet(EbsMagnet *ds, bool focusing,double crossTalk,string &serial,string &magModel,string& type):
    SH5Magnet::SH5Magnet(EbsMagnet *ds, bool focusing,double crossTalk,std::string &serial,std::string &magModel,std::string& type):
    Magnet(ds,type,serial,magModel) {
    // Init model
    ......@@ -147,4 +147,4 @@ SH5Magnet::SH5Magnet(EbsMagnet *ds, bool focusing,double crossTalk,string &seria
    }
    }
    \ No newline at end of file
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment