os/ossrv/ossrv_pub/boost_apis/boost/signal.hpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Boost.Signals library
sl@0
     2
sl@0
     3
// Copyright Douglas Gregor 2001-2006. Use, modification and
sl@0
     4
// distribution is subject to the Boost Software License, Version
sl@0
     5
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
sl@0
     6
// http://www.boost.org/LICENSE_1_0.txt)
sl@0
     7
sl@0
     8
// For more information, see http://www.boost.org/libs/signals
sl@0
     9
sl@0
    10
#ifndef BOOST_SIGNAL_HPP
sl@0
    11
#define BOOST_SIGNAL_HPP
sl@0
    12
sl@0
    13
#ifndef BOOST_SIGNALS_MAX_ARGS
sl@0
    14
#  define BOOST_SIGNALS_MAX_ARGS 10
sl@0
    15
#endif
sl@0
    16
sl@0
    17
#include <boost/config.hpp>
sl@0
    18
#include <boost/type_traits/function_traits.hpp>
sl@0
    19
#include <boost/signals/signal0.hpp>
sl@0
    20
#include <boost/signals/signal1.hpp>
sl@0
    21
#include <boost/signals/signal2.hpp>
sl@0
    22
#include <boost/signals/signal3.hpp>
sl@0
    23
#include <boost/signals/signal4.hpp>
sl@0
    24
#include <boost/signals/signal5.hpp>
sl@0
    25
#include <boost/signals/signal6.hpp>
sl@0
    26
#include <boost/signals/signal7.hpp>
sl@0
    27
#include <boost/signals/signal8.hpp>
sl@0
    28
#include <boost/signals/signal9.hpp>
sl@0
    29
#include <boost/signals/signal10.hpp>
sl@0
    30
#include <boost/function.hpp>
sl@0
    31
sl@0
    32
#ifdef BOOST_HAS_ABI_HEADERS
sl@0
    33
#  include BOOST_ABI_PREFIX
sl@0
    34
#endif
sl@0
    35
sl@0
    36
namespace boost {
sl@0
    37
#ifndef BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
sl@0
    38
  namespace BOOST_SIGNALS_NAMESPACE {
sl@0
    39
    namespace detail {
sl@0
    40
      template<int Arity,
sl@0
    41
               typename Signature,
sl@0
    42
               typename Combiner,
sl@0
    43
               typename Group,
sl@0
    44
               typename GroupCompare,
sl@0
    45
               typename SlotFunction>
sl@0
    46
      class real_get_signal_impl;
sl@0
    47
sl@0
    48
      template<typename Signature,
sl@0
    49
               typename Combiner,
sl@0
    50
               typename Group,
sl@0
    51
               typename GroupCompare,
sl@0
    52
               typename SlotFunction>
sl@0
    53
      class real_get_signal_impl<0, Signature, Combiner, Group, GroupCompare,
sl@0
    54
                                 SlotFunction>
sl@0
    55
      {
sl@0
    56
        typedef function_traits<Signature> traits;
sl@0
    57
sl@0
    58
      public:
sl@0
    59
        typedef signal0<typename traits::result_type,
sl@0
    60
                        Combiner,
sl@0
    61
                        Group,
sl@0
    62
                        GroupCompare,
sl@0
    63
                        SlotFunction> type;
sl@0
    64
      };
sl@0
    65
sl@0
    66
      template<typename Signature,
sl@0
    67
               typename Combiner,
sl@0
    68
               typename Group,
sl@0
    69
               typename GroupCompare,
sl@0
    70
               typename SlotFunction>
sl@0
    71
      class real_get_signal_impl<1, Signature, Combiner, Group, GroupCompare,
sl@0
    72
                                 SlotFunction>
sl@0
    73
      {
sl@0
    74
        typedef function_traits<Signature> traits;
sl@0
    75
sl@0
    76
      public:
sl@0
    77
        typedef signal1<typename traits::result_type,
sl@0
    78
                        typename traits::arg1_type,
sl@0
    79
                        Combiner,
sl@0
    80
                        Group,
sl@0
    81
                        GroupCompare,
sl@0
    82
                        SlotFunction> type;
sl@0
    83
      };
sl@0
    84
sl@0
    85
      template<typename Signature,
sl@0
    86
               typename Combiner,
sl@0
    87
               typename Group,
sl@0
    88
               typename GroupCompare,
sl@0
    89
               typename SlotFunction>
sl@0
    90
      class real_get_signal_impl<2, Signature, Combiner, Group, GroupCompare,
sl@0
    91
                                 SlotFunction>
sl@0
    92
      {
sl@0
    93
        typedef function_traits<Signature> traits;
sl@0
    94
sl@0
    95
      public:
sl@0
    96
        typedef signal2<typename traits::result_type,
sl@0
    97
                        typename traits::arg1_type,
sl@0
    98
                        typename traits::arg2_type,
sl@0
    99
                        Combiner,
sl@0
   100
                        Group,
sl@0
   101
                        GroupCompare,
sl@0
   102
                        SlotFunction> type;
sl@0
   103
      };
sl@0
   104
sl@0
   105
      template<typename Signature,
sl@0
   106
               typename Combiner,
sl@0
   107
               typename Group,
sl@0
   108
               typename GroupCompare,
sl@0
   109
               typename SlotFunction>
sl@0
   110
      class real_get_signal_impl<3, Signature, Combiner, Group, GroupCompare,
sl@0
   111
                                 SlotFunction>
sl@0
   112
      {
sl@0
   113
        typedef function_traits<Signature> traits;
sl@0
   114
sl@0
   115
      public:
sl@0
   116
        typedef signal3<typename traits::result_type,
sl@0
   117
                        typename traits::arg1_type,
sl@0
   118
                        typename traits::arg2_type,
sl@0
   119
                        typename traits::arg3_type,
sl@0
   120
                        Combiner,
sl@0
   121
                        Group,
sl@0
   122
                        GroupCompare,
sl@0
   123
                        SlotFunction> type;
sl@0
   124
      };
sl@0
   125
sl@0
   126
      template<typename Signature,
sl@0
   127
               typename Combiner,
sl@0
   128
               typename Group,
sl@0
   129
               typename GroupCompare,
sl@0
   130
               typename SlotFunction>
sl@0
   131
      class real_get_signal_impl<4, Signature, Combiner, Group, GroupCompare,
sl@0
   132
                                 SlotFunction>
sl@0
   133
      {
sl@0
   134
        typedef function_traits<Signature> traits;
sl@0
   135
sl@0
   136
      public:
sl@0
   137
        typedef signal4<typename traits::result_type,
sl@0
   138
                        typename traits::arg1_type,
sl@0
   139
                        typename traits::arg2_type,
sl@0
   140
                        typename traits::arg3_type,
sl@0
   141
                        typename traits::arg4_type,
sl@0
   142
                        Combiner,
sl@0
   143
                        Group,
sl@0
   144
                        GroupCompare,
sl@0
   145
                        SlotFunction> type;
sl@0
   146
      };
sl@0
   147
sl@0
   148
      template<typename Signature,
sl@0
   149
               typename Combiner,
sl@0
   150
               typename Group,
sl@0
   151
               typename GroupCompare,
sl@0
   152
               typename SlotFunction>
sl@0
   153
      class real_get_signal_impl<5, Signature, Combiner, Group, GroupCompare,
sl@0
   154
                                 SlotFunction>
sl@0
   155
      {
sl@0
   156
        typedef function_traits<Signature> traits;
sl@0
   157
sl@0
   158
      public:
sl@0
   159
        typedef signal5<typename traits::result_type,
sl@0
   160
                        typename traits::arg1_type,
sl@0
   161
                        typename traits::arg2_type,
sl@0
   162
                        typename traits::arg3_type,
sl@0
   163
                        typename traits::arg4_type,
sl@0
   164
                        typename traits::arg5_type,
sl@0
   165
                        Combiner,
sl@0
   166
                        Group,
sl@0
   167
                        GroupCompare,
sl@0
   168
                        SlotFunction> type;
sl@0
   169
      };
sl@0
   170
sl@0
   171
      template<typename Signature,
sl@0
   172
               typename Combiner,
sl@0
   173
               typename Group,
sl@0
   174
               typename GroupCompare,
sl@0
   175
               typename SlotFunction>
sl@0
   176
      class real_get_signal_impl<6, Signature, Combiner, Group, GroupCompare,
sl@0
   177
                                 SlotFunction>
sl@0
   178
      {
sl@0
   179
        typedef function_traits<Signature> traits;
sl@0
   180
sl@0
   181
      public:
sl@0
   182
        typedef signal6<typename traits::result_type,
sl@0
   183
                        typename traits::arg1_type,
sl@0
   184
                        typename traits::arg2_type,
sl@0
   185
                        typename traits::arg3_type,
sl@0
   186
                        typename traits::arg4_type,
sl@0
   187
                        typename traits::arg5_type,
sl@0
   188
                        typename traits::arg6_type,
sl@0
   189
                        Combiner,
sl@0
   190
                        Group,
sl@0
   191
                        GroupCompare,
sl@0
   192
                        SlotFunction> type;
sl@0
   193
      };
sl@0
   194
sl@0
   195
      template<typename Signature,
sl@0
   196
               typename Combiner,
sl@0
   197
               typename Group,
sl@0
   198
               typename GroupCompare,
sl@0
   199
               typename SlotFunction>
sl@0
   200
      class real_get_signal_impl<7, Signature, Combiner, Group, GroupCompare,
sl@0
   201
                                 SlotFunction>
sl@0
   202
      {
sl@0
   203
        typedef function_traits<Signature> traits;
sl@0
   204
sl@0
   205
      public:
sl@0
   206
        typedef signal7<typename traits::result_type,
sl@0
   207
                        typename traits::arg1_type,
sl@0
   208
                        typename traits::arg2_type,
sl@0
   209
                        typename traits::arg3_type,
sl@0
   210
                        typename traits::arg4_type,
sl@0
   211
                        typename traits::arg5_type,
sl@0
   212
                        typename traits::arg6_type,
sl@0
   213
                        typename traits::arg7_type,
sl@0
   214
                        Combiner,
sl@0
   215
                        Group,
sl@0
   216
                        GroupCompare,
sl@0
   217
                        SlotFunction> type;
sl@0
   218
      };
sl@0
   219
sl@0
   220
      template<typename Signature,
sl@0
   221
               typename Combiner,
sl@0
   222
               typename Group,
sl@0
   223
               typename GroupCompare,
sl@0
   224
               typename SlotFunction>
sl@0
   225
      class real_get_signal_impl<8, Signature, Combiner, Group, GroupCompare,
sl@0
   226
                                 SlotFunction>
sl@0
   227
      {
sl@0
   228
        typedef function_traits<Signature> traits;
sl@0
   229
sl@0
   230
      public:
sl@0
   231
        typedef signal8<typename traits::result_type,
sl@0
   232
                        typename traits::arg1_type,
sl@0
   233
                        typename traits::arg2_type,
sl@0
   234
                        typename traits::arg3_type,
sl@0
   235
                        typename traits::arg4_type,
sl@0
   236
                        typename traits::arg5_type,
sl@0
   237
                        typename traits::arg6_type,
sl@0
   238
                        typename traits::arg7_type,
sl@0
   239
                        typename traits::arg8_type,
sl@0
   240
                        Combiner,
sl@0
   241
                        Group,
sl@0
   242
                        GroupCompare,
sl@0
   243
                        SlotFunction> type;
sl@0
   244
      };
sl@0
   245
sl@0
   246
      template<typename Signature,
sl@0
   247
               typename Combiner,
sl@0
   248
               typename Group,
sl@0
   249
               typename GroupCompare,
sl@0
   250
               typename SlotFunction>
sl@0
   251
      class real_get_signal_impl<9, Signature, Combiner, Group, GroupCompare,
sl@0
   252
                                 SlotFunction>
sl@0
   253
      {
sl@0
   254
        typedef function_traits<Signature> traits;
sl@0
   255
sl@0
   256
      public:
sl@0
   257
        typedef signal9<typename traits::result_type,
sl@0
   258
                        typename traits::arg1_type,
sl@0
   259
                        typename traits::arg2_type,
sl@0
   260
                        typename traits::arg3_type,
sl@0
   261
                        typename traits::arg4_type,
sl@0
   262
                        typename traits::arg5_type,
sl@0
   263
                        typename traits::arg6_type,
sl@0
   264
                        typename traits::arg7_type,
sl@0
   265
                        typename traits::arg8_type,
sl@0
   266
                        typename traits::arg9_type,
sl@0
   267
                        Combiner,
sl@0
   268
                        Group,
sl@0
   269
                        GroupCompare,
sl@0
   270
                        SlotFunction> type;
sl@0
   271
      };
sl@0
   272
sl@0
   273
      template<typename Signature,
sl@0
   274
               typename Combiner,
sl@0
   275
               typename Group,
sl@0
   276
               typename GroupCompare,
sl@0
   277
               typename SlotFunction>
sl@0
   278
      class real_get_signal_impl<10, Signature, Combiner, Group, GroupCompare,
sl@0
   279
                                 SlotFunction>
sl@0
   280
      {
sl@0
   281
        typedef function_traits<Signature> traits;
sl@0
   282
sl@0
   283
      public:
sl@0
   284
        typedef signal10<typename traits::result_type,
sl@0
   285
                         typename traits::arg1_type,
sl@0
   286
                         typename traits::arg2_type,
sl@0
   287
                         typename traits::arg3_type,
sl@0
   288
                         typename traits::arg4_type,
sl@0
   289
                         typename traits::arg5_type,
sl@0
   290
                         typename traits::arg6_type,
sl@0
   291
                         typename traits::arg7_type,
sl@0
   292
                         typename traits::arg8_type,
sl@0
   293
                         typename traits::arg9_type,
sl@0
   294
                         typename traits::arg10_type,
sl@0
   295
                         Combiner,
sl@0
   296
                         Group,
sl@0
   297
                         GroupCompare,
sl@0
   298
                         SlotFunction> type;
sl@0
   299
      };
sl@0
   300
sl@0
   301
      template<typename Signature,
sl@0
   302
               typename Combiner,
sl@0
   303
               typename Group,
sl@0
   304
               typename GroupCompare,
sl@0
   305
               typename SlotFunction>
sl@0
   306
      struct get_signal_impl :
sl@0
   307
        public real_get_signal_impl<(function_traits<Signature>::arity),
sl@0
   308
                                    Signature,
sl@0
   309
                                    Combiner,
sl@0
   310
                                    Group,
sl@0
   311
                                    GroupCompare,
sl@0
   312
                                    SlotFunction>
sl@0
   313
      {
sl@0
   314
      };
sl@0
   315
sl@0
   316
    } // end namespace detail
sl@0
   317
  } // end namespace BOOST_SIGNALS_NAMESPACE
sl@0
   318
sl@0
   319
  // Very lightweight wrapper around the signalN classes that allows signals to
sl@0
   320
  // be created where the number of arguments does not need to be part of the
sl@0
   321
  // class name.
sl@0
   322
  template<
sl@0
   323
    typename Signature, // function type R (T1, T2, ..., TN)
sl@0
   324
    typename Combiner = last_value<typename function_traits<Signature>::result_type>,
sl@0
   325
    typename Group = int,
sl@0
   326
    typename GroupCompare = std::less<Group>,
sl@0
   327
    typename SlotFunction = function<Signature>
sl@0
   328
  >
sl@0
   329
  class signal :
sl@0
   330
    public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<Signature,
sl@0
   331
                                                            Combiner,
sl@0
   332
                                                            Group,
sl@0
   333
                                                            GroupCompare,
sl@0
   334
                                                            SlotFunction>::type
sl@0
   335
  {
sl@0
   336
    typedef typename BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<
sl@0
   337
                       Signature,
sl@0
   338
                       Combiner,
sl@0
   339
                       Group,
sl@0
   340
                       GroupCompare,
sl@0
   341
                       SlotFunction>::type base_type;
sl@0
   342
sl@0
   343
  public:
sl@0
   344
    explicit signal(const Combiner& combiner = Combiner(),
sl@0
   345
                    const GroupCompare& group_compare = GroupCompare()) :
sl@0
   346
      base_type(combiner, group_compare)
sl@0
   347
    {
sl@0
   348
    }
sl@0
   349
  };
sl@0
   350
#endif // ndef BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
sl@0
   351
sl@0
   352
} // end namespace boost
sl@0
   353
sl@0
   354
#ifdef BOOST_HAS_ABI_HEADERS
sl@0
   355
#  include BOOST_ABI_SUFFIX
sl@0
   356
#endif
sl@0
   357
sl@0
   358
#endif // BOOST_SIGNAL_HPP