1 /* 2 * actorcompiler.h 3 * 4 * This source file is part of the FoundationDB open source project 5 * 6 * Copyright 2013-2018 Apple Inc. and the FoundationDB project authors 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 21 #ifndef POST_ACTOR_COMPILER 22 23 template<typename T> struct Future; 24 struct Never; 25 template<typename T> struct FutureStream; 26 27 // These are for intellisense to do proper type inferring, etc. They are no included at build time. 28 #ifndef NO_INTELLISENSE 29 #define ACTOR 30 #define DESCR 31 #define state 32 #define UNCANCELLABLE 33 #define choose if(1) 34 #define when(...) for(__VA_ARGS__;;) 35 template <class T> T wait( const Future<T>& ); 36 void wait(const Never&); 37 template <class T> T waitNext( const FutureStream<T>& ); 38 #endif 39 40 #endif 41 42 #define loop while(true) 43 44 #ifdef NO_INTELLISENSE 45 #define THIS this 46 #define THIS_ADDR uintptr_t(this) 47 #else 48 #define THIS nullptr 49 #define THIS_ADDR uintptr_t(nullptr) 50 #endif 51 52 #pragma warning( disable: 4355 ) // 'this' : used in base member initializer list 53