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

#ifndef TANGO_SERVER_PIPE_TEMPL_H
#define TANGO_SERVER_PIPE_TEMPL_H

#include <tango/server/Pipe.h>

namespace Tango
{

//+------------------------------------------------------------------------------------------------------------------
//
// Function
//         operator overloading :     <<
//
// description :
//        Helper function to ease data insertion into Pipe root blob
//
//-------------------------------------------------------------------------------------------------------------------

template <typename T>
Pipe &operator<<(Pipe &_dp, T &datum)
{
    _dp.get_blob().operator<<(datum);
    _dp.set_value_flag(true);
    return _dp;
}

template <typename T>
Pipe &operator<<(Pipe &_dp, T *datum)
{
    _dp.get_blob().operator<<(datum);
    _dp.set_value_flag(true);
    return _dp;
}

template <typename T>
Pipe &operator<<(Pipe &_dp, DataElement<T> &datum)
{
    _dp.get_blob().set_current_delt_name(datum.name);
    _dp.get_blob().operator<<(datum.value);
    _dp.set_value_flag(true);
    return _dp;
}

} // namespace Tango
#endif // TANGO_SERVER_PIPE_TEMPL_H
