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

#if !defined(_HARKLIB_NODE_PUBLISH_DATA_H_INCLUDED_)
#define _HARKLIB_NODE_PUBLISH_DATA_H_INCLUDED_ 1

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

#include <deque>
//#include <mutex>
//#include <condition_variable>

namespace hark
{
namespace node
{
    class PublishData: public NodeDef
    {
    public:
        PublishData();
        virtual void reset();
        virtual bool operator () (size_t count, InputDataBundle &input, OutputDataBundle &output);

        void close();
        void push(data input);
        
    private:
        bool _closed;
        std::deque<data> _buffer;

        std::unique_ptr<Mutex> _mutex;
        std::unique_ptr<ConditionVariable> _condvar;
    };
}
}

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

/* end of file */
