Boost Synapse

Synopsis

#include <boost/synapse/signal_traits.hpp>

namespace
boost
    {
    namespace
    synapse
        {
        template <class Signal>
        struct
        signal_traits
            {
            static int const arity=<N>;
            typedef <A1> arg1_type;
            typedef <A2> arg2_type;
            ....
            typedef <A<N>> argN_type;
            typedef void (*signature)(arg1_type,arg2_type,....,argN_type);
            };
        }
    }

#include <boost/synapse/emit.hpp>

namespace
boost
    {
    namespace
    synapse
        {
        template <class Signal>
        int emit( void const * e, [signal_traits<Signal>::arg1_type a1 [,signal_traits<Signal>::arg2_type a2...]] );
        }
    }

#include <boost/synapse/connect.hpp>

namespace
boost
    {
    namespace
    synapse
        {
        class connection;        
        
        template <class Signal,class Emitter>
        shared_ptr<connection> connect( weak_ptr<Emitter> const & e, function<typename signal_traits<Signal>::signature> const & f,
            weak_ptr<void const> const & connection_lifetime=weak_ptr<void const>() );
        
        template <class Signal,class Emitter>
        shared_ptr<connection> connect( shared_ptr<Emitter> const & e, function<typename signal_traits<Signal>::signature> const & f,
            weak_ptr<void const> const & connection_lifetime=weak_ptr<void const>() );
        
        template <class Signal,class Emitter>
        shared_ptr<connection> connect( Emitter * e, function<typename signal_traits<Signal>::signature> const & f,
            weak_ptr<void const> const & connection_lifetime=weak_ptr<void const>() );        
        
        namespace
        meta
            {
            shared_ptr<void const> emitter();        
        
            namespace
            connect_flags
                {
                unsigned const connecting=1;
                unsigned const first_for_this_emitter=2;
                unsigned const last_for_this_emitter=4;
                }
            
            template <class Signal>
            struct
            connected
                {
                typedef connected<Signal>(*type)( connection & c, unsigned flags );
                };        
            }
        }
    }

#include <boost/synapse/translate.hpp>

namespace
boost
    {
    namespace
    synapse
        {
        template <class OriginalSignal,class TranslatedSignal,class OriginalEmitter>
        shared_ptr<connection> translate( weak_ptr<OriginalEmitter> const & original_emitter, void const * translated_emitter,
            weak_ptr<void const> const & connection_lifetime=weak_ptr<void const>() );
        
        template <class OriginalSignal,class TranslatedSignal,class OriginalEmitter>
        shared_ptr<connection> translate( shared_ptr<OriginalEmitter> const & original_emitter, void const * translated_emitter,
            weak_ptr<void const> const & connection_lifetime=weak_ptr<void const>() );
        
        template <class OriginalSignal,class TranslatedSignal,class OriginalEmitter>
        shared_ptr<connection> translate( OriginalEmitter * original_emitter, void const * translated_emitter,
            weak_ptr<void const> const & connection_lifetime=weak_ptr<void const>() );
        }
    }

#include <boost/synapse/connection.hpp>

namespace
boost
    {
    class any;

    namespace
    synapse
        {
        class
        connection
            {
            protected:
        
            connection();
            ~connection();
        
            public:
        
            template <class T>
            shared_ptr<T> emitter() const;        
        
            template <class T>
            void set_user_data( shared_ptr<T> const & data );        
        
            template <class T>
            T * get_user_data() const;        
            };
        }
    }

#include <boost/synapse/block.hpp>

namespace
boost
    {
    namespace
    synapse
        {
        class blocker;        
        
        template <class Signal, class Emitter>
        shared_ptr<blocker> block( weak_ptr<Emitter> const & e );
        
        template <class Signal, class Emitter>
        shared_ptr<blocker> block( shared_ptr<Emitter> const & e );
        
        template <class Signal, class Emitter>
        shared_ptr<blocker> block( Emitter * e );        
        
        template <class Signal>
        struct
        blocked
            {
            typedef blocked<Signal>(*type)( blocker & eb, bool is_blocked );
            };
        }
    }

#include <boost/synapse/blocker.hpp>

namespace
boost
    {
    namespace
    synapse
        {
        class
        blocker
            {
            protected:
        
            blocker();
            ~blocker();
        
            public:
        
            template <class T>
            shared_ptr<T> emitter() const;        
            };
        }
    }

#include <boost/synapse/thread_local_queue.hpp>

namespace
boost
    {
    namespace
    synapse
        {
        shared_ptr<thread_local_queue>
        create_thread_local_queue();        
        
        int poll( thread_local_queue & q );        
        int wait( thread_local_queue & q );        
        void post( thread_local_queue & q, function<void()> const & f );
        }
    }

See also: Boost Synapse