blob: 4da1e6dfab7e3da099ef6cdd048773b1836099c2 [file] [log] [blame]
ehmaldonado370dd472017-07-10 05:58:42 -07001// This file was GENERATED by command:
2// pump.py callback.h.pump
3// DO NOT EDIT BY HAND!!!
4
5/*
6 * Copyright 2012 The WebRTC Project Authors. All rights reserved.
7 *
8 * Use of this source code is governed by a BSD-style license
9 * that can be found in the LICENSE file in the root of the source
10 * tree. An additional intellectual property rights grant can be found
11 * in the file PATENTS. All contributing project authors may
12 * be found in the AUTHORS file in the root of the source tree.
13 */
14
15// To generate callback.h from callback.h.pump, execute:
16// /home/build/google3/third_party/gtest/scripts/pump.py callback.h.pump
17
18// Callbacks are callable object containers. They can hold a function pointer
19// or a function object and behave like a value type. Internally, data is
20// reference-counted, making copies and pass-by-value inexpensive.
21//
22// Callbacks are typed using template arguments. The format is:
23// CallbackN<ReturnType, ParamType1, ..., ParamTypeN>
24// where N is the number of arguments supplied to the callable object.
25// Callbacks are invoked using operator(), just like a function or a function
26// object. Default-constructed callbacks are "empty," and executing an empty
27// callback does nothing. A callback can be made empty by assigning it from
28// a default-constructed callback.
29//
30// Callbacks are similar in purpose to std::function (which isn't available on
31// all platforms we support) and a lightweight alternative to sigslots. Since
32// they effectively hide the type of the object they call, they're useful in
33// breaking dependencies between objects that need to interact with one another.
34// Notably, they can hold the results of Bind(), std::bind*, etc, without
35// needing
36// to know the resulting object type of those calls.
37//
38// Sigslots, on the other hand, provide a fuller feature set, such as multiple
39// subscriptions to a signal, optional thread-safety, and lifetime tracking of
40// slots. When these features are needed, choose sigslots.
41//
42// Example:
43// int sqr(int x) { return x * x; }
44// struct AddK {
45// int k;
46// int operator()(int x) const { return x + k; }
47// } add_k = {5};
48//
49// Callback1<int, int> my_callback;
50// cout << my_callback.empty() << endl; // true
51//
52// my_callback = Callback1<int, int>(&sqr);
53// cout << my_callback.empty() << endl; // false
54// cout << my_callback(3) << endl; // 9
55//
56// my_callback = Callback1<int, int>(add_k);
57// cout << my_callback(10) << endl; // 15
58//
59// my_callback = Callback1<int, int>();
60// cout << my_callback.empty() << endl; // true
61
62#ifndef WEBRTC_BASE_CALLBACK_H_
63#define WEBRTC_BASE_CALLBACK_H_
64
65
66// This header is deprecated and is just left here temporarily during
67// refactoring. See https://bugs.webrtc.org/7634 for more details.
68#include "webrtc/rtc_base/callback.h"
69
70#endif // WEBRTC_BASE_CALLBACK_H_