solstice

Compute collected power and efficiencies of a solar plant
git clone git://git.meso-star.com/solstice.git
Log | Files | Refs | README | LICENSE

srcvl.h (2456B)


      1 /* Copyright (C) 2018-2026 |Meso|Star> (contact@meso-star.com)
      2  * Copyright (C) 2016-2018 CNRS
      3  *
      4  * This program is free software: you can redistribute it and/or modify
      5  * it under the terms of the GNU General Public License as published by
      6  * the Free Software Foundation, either version 3 of the License, or
      7  * (at your option) any later version.
      8  *
      9  * This program is distributed in the hope that it will be useful,
     10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     12  * GNU General Public License for more details.
     13  *
     14  * You should have received a copy of the GNU General Public License
     15  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     16 
     17 #ifndef SRCVL_H /* Solstice ReCeiVers Loader */
     18 #define SRCVL_H
     19 
     20 #include <rsys/rsys.h>
     21 
     22 /* Library symbol management */
     23 #if defined(SRCVL_SHARED_BUILD) /* Build shared library */
     24   #define SRCVL_API extern EXPORT_SYM
     25 #elif defined(SRCVL_STATIC) /* Use/build static library */
     26   #define SRCVL_API extern LOCAL_SYM
     27 #else /* Use shared library */
     28   #define SRCVL_API extern IMPORT_SYM
     29 #endif
     30 
     31 enum srcvl_side {
     32   SRCVL_FRONT = BIT(0),
     33   SRCVL_BACK = BIT(1),
     34   SRCVL_FRONT_AND_BACK = SRCVL_FRONT + SRCVL_BACK
     35 };
     36 
     37 enum srcvl_pp_output {
     38   SRCVL_PP_NONE = 0,
     39   SRCVL_PP_INCOMING = BIT(0),
     40   SRCVL_PP_ABSORBED = BIT(1),
     41   SRCVL_PP_INCOMING_AND_ABSORBED = SRCVL_PP_INCOMING + SRCVL_PP_ABSORBED
     42 };
     43 
     44 struct srcvl_receiver {
     45   const char* name;
     46   enum srcvl_side side;
     47   enum srcvl_pp_output per_primitive_output;
     48 };
     49 
     50 struct mem_allocator;
     51 struct srcvl;
     52 
     53 /*******************************************************************************
     54  * Solstice Receiver API
     55  ******************************************************************************/
     56 SRCVL_API res_T
     57 srcvl_create
     58   (struct mem_allocator* allocator, /* May be NULL <=> use default allocator */
     59    struct srcvl** rcvl);
     60 
     61 SRCVL_API void
     62 srcvl_ref_get
     63   (struct srcvl* rcvl);
     64 
     65 SRCVL_API void
     66 srcvl_ref_put
     67   (struct srcvl* rcvl);
     68 
     69 SRCVL_API res_T
     70 srcvl_setup_stream
     71   (struct srcvl* rcvl,
     72    const char* stream_name, /* May be NULL */
     73    FILE* stream);
     74 
     75 /* Return RES_BAD_OP if there is no more YAML document to parse */
     76 SRCVL_API res_T
     77 srcvl_load
     78   (struct srcvl* rcvl);
     79 
     80 SRCVL_API size_t
     81 srcvl_count
     82   (const struct srcvl* rcvl);
     83 
     84 SRCVL_API void
     85 srcvl_get
     86   (const struct srcvl* rcvl,
     87    const size_t i,
     88    struct srcvl_receiver* receiver);
     89 
     90 #endif /* SRCVL_H */
     91