star-line

Structure for accelerating line importance sampling
git clone git://git.meso-star.com/star-line.git
Log | Files | Refs | README | LICENSE

sln_device_c.h (1739B)


      1 /* Copyright (C) 2022, 2026 |Méso|Star> (contact@meso-star.com)
      2  * Copyright (C) 2026 Université de Lorraine
      3  * Copyright (C) 2022 Centre National de la Recherche Scientifique
      4  * Copyright (C) 2022 Université Paul Sabatier
      5  *
      6  * This file is part of Star-Line.
      7  *
      8  * This program is free software: you can redistribute it and/or modify
      9  * it under the terms of the GNU General Public License as published by
     10  * the Free Software Foundation, either version 3 of the License, or
     11  * (at your option) any later version.
     12  *
     13  * This program is distributed in the hope that it will be useful,
     14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     16  * GNU General Public License for more details.
     17  *
     18  * You should have received a copy of the GNU General Public License
     19  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     20 
     21 #ifndef SLN_DEVICE_C_H
     22 #define SLN_DEVICE_C_H
     23 
     24 #include <rsys/logger.h>
     25 #include <rsys/ref_count.h>
     26 
     27 #define MSG_INFO_PREFIX ""
     28 #define MSG_ERROR_PREFIX "error: "
     29 #define MSG_WARNING_PREFIX "warning: "
     30 
     31 /* Helper macros for logging */
     32 #define LOG__(Dev, Lvl, Type, ...) { \
     33   if ((Dev)->verbose >= (Lvl)) \
     34     logger_print((Dev)->logger, Type, __VA_ARGS__); \
     35 } (void)0
     36 #define ERROR(Dev, ...) LOG__(Dev, 1, LOG_ERROR,   MSG_ERROR_PREFIX __VA_ARGS__)
     37 #define WARN(Dev, ...) LOG__(Dev, 2, LOG_WARNING, MSG_WARNING_PREFIX __VA_ARGS__)
     38 #define INFO(Dev, ...) LOG__(Dev, 3, LOG_OUTPUT,  MSG_INFO_PREFIX __VA_ARGS__)
     39 
     40 struct mem_allocator;
     41 
     42 struct sln_device {
     43   struct mem_allocator* allocator;
     44   struct logger* logger;
     45   struct logger logger__; /* Default logger */
     46   int verbose;
     47   ref_T ref;
     48 };
     49 
     50 #endif /* SLN_DEVICE_C_H */