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

#ifndef TANGO_INTERNAL_SERVER_WPIPE_TEMPL_H
#define TANGO_INTERNAL_SERVER_WPIPE_TEMPL_H

#include <tango/server/WPipe.h>

namespace Tango
{

//+------------------------------------------------------------------------------------------------------------------
//
// Function
//         operator overloading :     >>
//
// description :
//        Helper function to ease data extraction from WPipe root blob
//
//-------------------------------------------------------------------------------------------------------------------

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

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

template <typename T>
WPipe &operator>>(WPipe &_dp, DataElement<T> &datum)
{
    datum.name = _dp.get_blob().get_current_delt_name();
    _dp.get_blob().operator>>(datum.value);
    return _dp;
}

} // namespace Tango
#endif // TANGO_INTERNAL_SERVER_WPIPE_TEMPL_H
