/*
   HARK Library
   Copyright (C) 2021 Honda Research Institute Japan Inc.
 */

#if !defined(_HARKLIB_INPUT_H_INCLUDED_)
#define _HARKLIB_INPUT_H_INCLUDED_ 1

#include "hark-lib/hark-lib.h"
#include "hark-lib/data.h"

namespace hark
{
    class BaseInput: public object
    {

    };

    class Input: public BaseInput
    {
    public:
        template<typename T> Input(const std::string &name, T &&value);

        Input(const std::string &name, const char *value);
        Input(const std::string &name, DataSource &stream);

        inline const std::string&name() const {
            return this->_name;
        }

        inline DataSource*source(){
            return this->_source;
        }
        inline const DataSource*source() const {
            return this->_source;
        }

        inline bool is_static() const {
            return this->_is_static;
        }
        inline data value() const {
            return this->_value;
        }

    private:
        bool _is_static;
        data _value;
        std::string _name;
        DataSource *_source;
    };

    template<typename T>
    Input::Input(const std::string &name, T &&value):
        _name(name), _source(nullptr), _value(std::forward<T>(value)), _is_static(true)
    {
    }

    class AsyncInput: public Input
    {

    };

    class LoopCondition: public BaseInput
    {
    public:
        LoopCondition(DataSource &source);

    public:
        DataSource &source;
    };
}

#endif /* #if !defined(_HARKLIB_INPUT_H_INCLUDED_) */

/* end of file */
