folly: replace old-style header guards with "pragma once"
[folly.git] / folly / test / function_benchmark / test_functions.h
1 /*
2  * Copyright 2016 Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #pragma once
18
19 #include <exception>
20 #include <functional>
21 #include <string>
22
23 #include <folly/Function.h>
24
25 void doNothing();
26
27 void throwException();
28 std::exception_ptr returnExceptionPtr();
29 void exceptionPtrReturnParam(std::exception_ptr* excReturn);
30 std::string returnString();
31 std::string returnStringNoExcept() noexcept;
32 int returnCode(int value);
33 int returnCodeNoExcept(int value) noexcept;
34 void invoke(std::function<void()>);
35 void invoke(folly::Function<void()>);
36
37 class TestClass {
38  public:
39   void doNothing();
40 };
41
42 class VirtualClass {
43  public:
44   virtual ~VirtualClass();
45   virtual void doNothing();
46 };
47
48 class LargeClass {
49  public:
50   LargeClass();
51   void operator()() const; // do nothing
52  private:
53   // Avoid small object optimization.
54   char data[1024];
55 };