X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=include%2Fbabeltrace%2Ftypes.h;fp=include%2Fbabeltrace%2Ftypes.h;h=f0bf0f10dd3e447248ac2027e5c198546d8d742a;hp=0000000000000000000000000000000000000000;hb=c55a9f585da53ea54ac458155fac3cdec1779d47;hpb=69b772a4f25fc4512abc877662a8c19e404b452c diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h new file mode 100644 index 00000000..f0bf0f10 --- /dev/null +++ b/include/babeltrace/types.h @@ -0,0 +1,81 @@ +#ifndef BABELTRACE_TYPES_H +#define BABELTRACE_TYPES_H + +/* + * Copyright (c) 2017 Philippe Proulx + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** +@defgroup ctypes Babeltrace C types +@ingroup apiref +@brief Babeltrace C types. + +@code +#include +@endcode + +This header contains custom type definitions used across the library. + +@file +@brief Babeltrace C types. +@sa ctypes + +@addtogroup ctypes +@{ +*/ + +/// False boolean value for the #bt_bool type. +#define BT_FALSE 0 + +/// True boolean value for the #bt_bool type. +#define BT_TRUE 1 + +/** +@brief Babeltrace's boolean type. + +Use only the #BT_FALSE and #BT_TRUE definitions for #bt_bool parameters. +It is guaranteed that the library functions which return a #bt_bool +value return either #BT_FALSE or #BT_TRUE. + +You can always test the truthness of a #bt_bool value directly, without +comparing it to #BT_TRUE directly: + +@code +bt_bool ret = bt_some_function(...); + +if (ret) { + // ret is true +} +@endcode +*/ +typedef int bt_bool; + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_TYPES_H */