/*
 * SPDX-FileCopyrightText: 2014 Copyright contributors to the cppTango project
 *
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */

#ifndef TANGO_SERVER_DEVINTR_H
#define TANGO_SERVER_DEVINTR_H

#include <tango/common/tango_const.h>

#include <string>
#include <vector>

namespace Tango
{
class DeviceImpl;

class DevIntr
{
  public:
    DevIntr() { }

    void get_interface(DeviceImpl *);
    bool has_changed(DeviceImpl *);

  protected:
  private:
    struct CmdIntr
    {
        std::string name;
        CmdArgType in_type;
        CmdArgType out_type;

        bool operator<(const struct CmdIntr &rhs) const
        {
            return name < rhs.name;
        }

        bool operator==(const struct CmdIntr &) const;
    };

    struct AttrIntr
    {
        std::string name;
        AttrWriteType writable;
        long data_type;
        AttrDataFormat data_format;
        long max_x;
        long max_y;
        bool mem;
        bool mem_init;
        std::string writable_attr_name;
        std::vector<std::string> enum_labels;

        bool operator<(const struct AttrIntr &rhs) const
        {
            return name < rhs.name;
        }

        bool operator==(const struct AttrIntr &) const;
    };

    std::vector<CmdIntr> cmds;
    std::vector<AttrIntr> atts;

    void build_cmd_interfaces(DeviceImpl *, std::vector<CmdIntr> &);
    void build_att_interfaces(DeviceImpl *, std::vector<AttrIntr> &);
};

} // namespace Tango

#endif /* TANGO_SERVER_DEVINTR_H */
