Roy Want / Mbed OS beaconCompileReadyFork
Committer:
roywant
Date:
Mon Sep 19 00:59:11 2016 +0000
Revision:
0:ed0152b5c495
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
roywant 0:ed0152b5c495 1 /*
roywant 0:ed0152b5c495 2 * Copyright (c) 2016, ARM Limited, All Rights Reserved
roywant 0:ed0152b5c495 3 * SPDX-License-Identifier: Apache-2.0
roywant 0:ed0152b5c495 4 *
roywant 0:ed0152b5c495 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
roywant 0:ed0152b5c495 6 * not use this file except in compliance with the License.
roywant 0:ed0152b5c495 7 * You may obtain a copy of the License at
roywant 0:ed0152b5c495 8 *
roywant 0:ed0152b5c495 9 * http://www.apache.org/licenses/LICENSE-2.0
roywant 0:ed0152b5c495 10 *
roywant 0:ed0152b5c495 11 * Unless required by applicable law or agreed to in writing, software
roywant 0:ed0152b5c495 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
roywant 0:ed0152b5c495 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
roywant 0:ed0152b5c495 14 * See the License for the specific language governing permissions and
roywant 0:ed0152b5c495 15 * limitations under the License.
roywant 0:ed0152b5c495 16 */
roywant 0:ed0152b5c495 17 #ifndef EVENTQUEUE_DETAIL_THUNKVTABLE_H_
roywant 0:ed0152b5c495 18 #define EVENTQUEUE_DETAIL_THUNKVTABLE_H_
roywant 0:ed0152b5c495 19
roywant 0:ed0152b5c495 20 namespace eq {
roywant 0:ed0152b5c495 21
roywant 0:ed0152b5c495 22 // forward declaration of the Thunk class
roywant 0:ed0152b5c495 23 class Thunk;
roywant 0:ed0152b5c495 24
roywant 0:ed0152b5c495 25 namespace detail {
roywant 0:ed0152b5c495 26
roywant 0:ed0152b5c495 27 /**
roywant 0:ed0152b5c495 28 * This POD is used as a vtable by Thunk implementation.
roywant 0:ed0152b5c495 29 * Thunk is a value type for all type nullary callable and therefore standard
roywant 0:ed0152b5c495 30 * polymorphism is not suitable for that use case.
roywant 0:ed0152b5c495 31 * Instead, the vtable is generated for each type contained in a thunk.
roywant 0:ed0152b5c495 32 * This structure is the prototype of such vtable.
roywant 0:ed0152b5c495 33 * \note see ThunkVTableGenerator for implementation and the generation of
roywant 0:ed0152b5c495 34 * Thunk vtables.
roywant 0:ed0152b5c495 35 */
roywant 0:ed0152b5c495 36 struct ThunkVTable {
roywant 0:ed0152b5c495 37 typedef Thunk thunk_t;
roywant 0:ed0152b5c495 38
roywant 0:ed0152b5c495 39 /**
roywant 0:ed0152b5c495 40 * destroy a thunk (act like a destructor).
roywant 0:ed0152b5c495 41 */
roywant 0:ed0152b5c495 42 void (* const destroy)(thunk_t& self);
roywant 0:ed0152b5c495 43
roywant 0:ed0152b5c495 44 /**
roywant 0:ed0152b5c495 45 * Copy self into dest.
roywant 0:ed0152b5c495 46 * It is expected that dest is empty.
roywant 0:ed0152b5c495 47 */
roywant 0:ed0152b5c495 48 void (* const copy)(thunk_t& dest, const thunk_t& self);
roywant 0:ed0152b5c495 49
roywant 0:ed0152b5c495 50 /**
roywant 0:ed0152b5c495 51 * Synthetized call for the inner object of the thunk_t.
roywant 0:ed0152b5c495 52 */
roywant 0:ed0152b5c495 53 void (* const call)(const thunk_t& self);
roywant 0:ed0152b5c495 54 };
roywant 0:ed0152b5c495 55
roywant 0:ed0152b5c495 56 } // namespace detail
roywant 0:ed0152b5c495 57 } // namespace eq
roywant 0:ed0152b5c495 58
roywant 0:ed0152b5c495 59 #endif /* EVENTQUEUE_DETAIL_THUNKVTABLE_H_ */