Boost logo

Boost Users :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-08-11 13:31:30


For those interested in the entire file (Somewhat large), here you go:

#ifndef BOOST_PP_IS_ITERATING
# ifndef vfx_input_InputSource_hpp__
# define vfx_input_InputSource_hpp__

# include <boost/preprocessor/iterate.hpp>
# include <boost/preprocessor/repetition.hpp>
# include <boost/preprocessor/logical.hpp>
# include <boost/preprocessor/punctuation.hpp>
# include <boost/function.hpp>
# include <boost/signals.hpp>

# include <vfx/input/include/detail/no_param.hpp>

# ifndef MAX_PARAMETERS
# define MAX_PARAMETERS 5
# endif

namespace vfx
{
namespace input
{
    template<typename t_return, BOOST_PP_ENUM_PARAMS(MAX_PARAMETERS,
typename t_param)>
    class InputSource;

}} // end namespace vfx::input

# define BOOST_PP_ITERATION_LIMITS (1, MAX_PARAMETERS)
# define BOOST_PP_FILENAME_1 "InputSource.hpp"
# include BOOST_PP_ITERATE()
# endif // vfx_input_InputSource_hpp__
#else
# define i BOOST_PP_ITERATION()
# define INPUT_repeat(z, n, user) user

namespace vfx
{
namespace input
{
    template<typename t_return, BOOST_PP_ENUM_PARAMS(i, typename t_param)>
    class InputSource<
        t_return,
        BOOST_PP_ENUM_PARAMS( i, t_param )
        BOOST_PP_COMMA_IF( BOOST_PP_AND(BOOST_PP_NOT_EQUAL(i, 0),
BOOST_PP_NOT_EQUAL(i, MAX_PARAMETERS)) )
        BOOST_PP_ENUM( BOOST_PP_SUB(MAX_PARAMETERS, i), INPUT_repeat,
detail::no_param )
>
    {
    private:
        typedef typename boost::function<t_return (BOOST_PP_ENUM_PARAMS(i,
t_param))> FunctionType;
        typedef typename boost::signal<t_return (BOOST_PP_ENUM_PARAMS(i,
t_param))> SignalType;

        SignalType m_observers;

    public:
        void Publish( BOOST_PP_ENUM_BINARY_PARAMS(i, const t_param, &param)
)
        {
            m_observers(BOOST_PP_ENUM_PARAMS(i, param));
        }

        void Subscribe( FunctionType slot )
        {
            m_observers.connect( slot );
        }
    };

}} // end namespace vfx::input

# undef i
#endif // BOOST_PP_IS_ITERATING



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net