/*
 * 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_POINTDLISTS_H
#define YARP_THRIFT_GENERATOR_STRUCT_POINTDLISTS_H

#include <yarp/os/Wire.h>
#include <yarp/os/idl/WireTypes.h>
#include <yarp/test/PointD.h>

namespace yarp {
namespace test {

class PointDLists :
        public yarp::os::idl::WirePortable
{
public:
    // Fields
    std::string name;
    std::vector<PointD> firstList;
    std::vector<PointD> secondList;

    // Default constructor
    PointDLists();

    // Constructor with field values
    PointDLists(const std::string& name,
                const std::vector<PointD>& firstList,
                const std::vector<PointD>& secondList);

    // 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<PointDLists> unwrapped;

    class Editor :
            public yarp::os::Wire,
            public yarp::os::PortWriter
    {
    public:
        // Editor: default constructor
        Editor();

        // Editor: constructor with base class
        Editor(PointDLists& obj);

        // Editor: destructor
        ~Editor() override;

        // Editor: Deleted constructors and operator=
        Editor(const Editor& rhs) = delete;
        Editor(Editor&& rhs) = delete;
        Editor& operator=(const Editor& rhs) = delete;
        Editor& operator=(Editor&& rhs) = delete;

        // Editor: edit
        bool edit(PointDLists& obj, bool dirty = true);

        // Editor: validity check
        bool isValid() const;

        // Editor: state
        PointDLists& state();

        // Editor: start editing
        void start_editing();

#ifndef YARP_NO_DEPRECATED // Since YARP 3.2
        YARP_DEPRECATED_MSG("Use start_editing() instead")
        void begin()
        {
            start_editing();
        }
#endif // YARP_NO_DEPRECATED

        // Editor: stop editing
        void stop_editing();

#ifndef YARP_NO_DEPRECATED // Since YARP 3.2
        YARP_DEPRECATED_MSG("Use stop_editing() instead")
        void end()
        {
            stop_editing();
        }
#endif // YARP_NO_DEPRECATED

        // Editor: name field
        void set_name(const std::string& name);
        const std::string& get_name() const;
        virtual bool will_set_name();
        virtual bool did_set_name();

        // Editor: firstList field
        void set_firstList(const std::vector<PointD>& firstList);
        void set_firstList(size_t index, const PointD& elem);
        const std::vector<PointD>& get_firstList() const;
        virtual bool will_set_firstList();
        virtual bool did_set_firstList();

        // Editor: secondList field
        void set_secondList(const std::vector<PointD>& secondList);
        void set_secondList(size_t index, const PointD& elem);
        const std::vector<PointD>& get_secondList() const;
        virtual bool will_set_secondList();
        virtual bool did_set_secondList();

        // Editor: clean
        void clean();

        // Editor: read
        bool read(yarp::os::ConnectionReader& connection) override;

        // Editor: write
        bool write(yarp::os::ConnectionWriter& connection) const override;

    private:
        // Editor: state
        PointDLists* obj;
        bool obj_owned;
        int group;

        // Editor: dirty variables
        bool is_dirty;
        bool is_dirty_name;
        bool is_dirty_firstList;
        bool is_dirty_secondList;
        int dirty_count;

        // Editor: send if possible
        void communicate();

        // Editor: mark dirty overall
        void mark_dirty();

        // Editor: mark dirty single fields
        void mark_dirty_name();
        void mark_dirty_firstList();
        void mark_dirty_secondList();

        // Editor: dirty_flags
        void dirty_flags(bool flag);
    };

private:
    // read/write name field
    bool read_name(yarp::os::idl::WireReader& reader);
    bool write_name(const yarp::os::idl::WireWriter& writer) const;
    bool nested_read_name(yarp::os::idl::WireReader& reader);
    bool nested_write_name(const yarp::os::idl::WireWriter& writer) const;

    // read/write firstList field
    bool read_firstList(yarp::os::idl::WireReader& reader);
    bool write_firstList(const yarp::os::idl::WireWriter& writer) const;
    bool nested_read_firstList(yarp::os::idl::WireReader& reader);
    bool nested_write_firstList(const yarp::os::idl::WireWriter& writer) const;

    // read/write secondList field
    bool read_secondList(yarp::os::idl::WireReader& reader);
    bool write_secondList(const yarp::os::idl::WireWriter& writer) const;
    bool nested_read_secondList(yarp::os::idl::WireReader& reader);
    bool nested_write_secondList(const yarp::os::idl::WireWriter& writer) const;
};

} // namespace yarp
} // namespace test

#endif // YARP_THRIFT_GENERATOR_STRUCT_POINTDLISTS_H
