/*
 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
 * SPDX-License-Identifier: BSD-3-Clause
 */

// Autogenerated by Thrift Compiler (0.14.1-yarped)
//
// This is an automatically generated file.
// It could get re-generated if the ALLOW_IDL_GENERATION flag is on.

#ifndef YARP_THRIFT_GENERATOR_STRUCT_LASERSCAN2D_H
#define YARP_THRIFT_GENERATOR_STRUCT_LASERSCAN2D_H

#include <yarp/dev/api.h>

#include <yarp/os/Wire.h>
#include <yarp/os/idl/WireTypes.h>
#include <yarp/sig/Vector.h>

namespace yarp::dev {

class YARP_dev_API LaserScan2D :
        public yarp::os::idl::WirePortable
{
public:
    // Fields
    /**
     * first angle of the scan [deg]
     */
    double angle_min{0.0};
    /**
     * last angle of the scan [deg]
     */
    double angle_max{0.0};
    /**
     * the minimum distance of the scan [m]
     */
    double range_min{0.0};
    /**
     * the maximum distance of the scan [m]
     */
    double range_max{0.0};
    /**
     * the scan data, measured in [m]. The angular increment of each ray is obtained by (angle_max-angle_min)/num_of_elements. Invalid data are represented as std::inf.
     */
    yarp::sig::Vector scans{};
    std::int32_t status{0};

    // Default constructor
    LaserScan2D() = default;

    // Constructor with field values
    LaserScan2D(const double angle_min,
                const double angle_max,
                const double range_min,
                const double range_max,
                const yarp::sig::Vector& scans,
                const std::int32_t status);

    // Read structure on a Wire
    bool read(yarp::os::idl::WireReader& reader) override;

    // Read structure on a Connection
    bool read(yarp::os::ConnectionReader& connection) override;

    // Write structure on a Wire
    bool write(const yarp::os::idl::WireWriter& writer) const override;

    // Write structure on a Connection
    bool write(yarp::os::ConnectionWriter& connection) const override;

    // Convert to a printable string
    std::string toString() const;

    // If you want to serialize this class without nesting, use this helper
    typedef yarp::os::idl::Unwrapped<LaserScan2D> unwrapped;

private:
    // read/write angle_min field
    bool read_angle_min(yarp::os::idl::WireReader& reader);
    bool write_angle_min(const yarp::os::idl::WireWriter& writer) const;
    bool nested_read_angle_min(yarp::os::idl::WireReader& reader);
    bool nested_write_angle_min(const yarp::os::idl::WireWriter& writer) const;

    // read/write angle_max field
    bool read_angle_max(yarp::os::idl::WireReader& reader);
    bool write_angle_max(const yarp::os::idl::WireWriter& writer) const;
    bool nested_read_angle_max(yarp::os::idl::WireReader& reader);
    bool nested_write_angle_max(const yarp::os::idl::WireWriter& writer) const;

    // read/write range_min field
    bool read_range_min(yarp::os::idl::WireReader& reader);
    bool write_range_min(const yarp::os::idl::WireWriter& writer) const;
    bool nested_read_range_min(yarp::os::idl::WireReader& reader);
    bool nested_write_range_min(const yarp::os::idl::WireWriter& writer) const;

    // read/write range_max field
    bool read_range_max(yarp::os::idl::WireReader& reader);
    bool write_range_max(const yarp::os::idl::WireWriter& writer) const;
    bool nested_read_range_max(yarp::os::idl::WireReader& reader);
    bool nested_write_range_max(const yarp::os::idl::WireWriter& writer) const;

    // read/write scans field
    bool read_scans(yarp::os::idl::WireReader& reader);
    bool write_scans(const yarp::os::idl::WireWriter& writer) const;
    bool nested_read_scans(yarp::os::idl::WireReader& reader);
    bool nested_write_scans(const yarp::os::idl::WireWriter& writer) const;

    // read/write status field
    bool read_status(yarp::os::idl::WireReader& reader);
    bool write_status(const yarp::os::idl::WireWriter& writer) const;
    bool nested_read_status(yarp::os::idl::WireReader& reader);
    bool nested_write_status(const yarp::os::idl::WireWriter& writer) const;
};

} // namespace yarp::dev

#endif // YARP_THRIFT_GENERATOR_STRUCT_LASERSCAN2D_H
