1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef MACRO_UTILS_H 17 #define MACRO_UTILS_H 18 19 namespace DistributedDB { 20 #define DISABLE_COPY_ASSIGN_MOVE(ClassName) \ 21 ClassName(const ClassName &) = delete; \ 22 ClassName(ClassName &&) = delete; \ 23 ClassName& operator=(const ClassName &) = delete; \ 24 ClassName& operator=(ClassName &&) = delete 25 26 #define DECLARE_OBJECT_TAG(ClassName) \ 27 std::string GetObjectTag() const override; \ 28 constexpr static const char * const classTag = "Class-"#ClassName 29 30 #define DEFINE_OBJECT_TAG_FACILITIES(ClassName) \ 31 std::string ClassName::GetObjectTag() const \ 32 { \ 33 return ClassName::classTag; \ 34 } 35 36 #define BYTE_8_ALIGN(x) (((x) + (8 - 1)) & ~(8 - 1)) 37 38 #define BITX(x) (1U << (x)) 39 40 #define ULL(x) (static_cast<unsigned long long>(x)) 41 42 // Convert var or enum to variable name for printf 43 #define VNAME(name) (#name) 44 } 45 #endif // MACRO_UTILS_H 46