Program Listing for File IBandwidthSelectable.h

Return to documentation for file (include/gwmodelpp/IBandwidthSelectable.h)

#ifndef IBANDWIDTHSELECTABLE_H
#define IBANDWIDTHSELECTABLE_H

#include "Status.h"
#include "spatialweight/BandwidthWeight.h"

namespace gwm
{

#define GWM_LOG_TAG_BANDWIDTH_CIRTERION "#bandwidth-criterion "

struct IBandwidthSelectable
{

    static std::string infoBandwidthCriterion(const BandwidthWeight* weight)
    {
        return std::string(GWM_LOG_TAG_BANDWIDTH_CIRTERION) + (weight->adaptive() ? "adaptive" : "fixed") + ",criterion";
    }

    static std::string infoBandwidthCriterion(const BandwidthWeight* weight, const double value)
    {
        if (weight->adaptive())
            return std::string(GWM_LOG_TAG_BANDWIDTH_CIRTERION) + std::to_string(int(weight->bandwidth())) + "," + std::to_string(value);
        else
            return std::string(GWM_LOG_TAG_BANDWIDTH_CIRTERION) + std::to_string(weight->bandwidth()) + "," + std::to_string(value);
    }

    virtual Status getCriterion(BandwidthWeight* weight, double& criterion) = 0;
};

typedef std::vector<std::pair<double, double> >  BandwidthCriterionList;


}

#endif  // IBANDWIDTHSELECTABLE_H