LCOV - code coverage report
Current view: top level - core/src - ROOT-Sim.h Hit Total Coverage
Test: ROOT-Sim develop Documentation Coverage Lines: 4 20 20.0 %
Date: 2021-03-02 11:24:52

          Line data    Source code
       1           1 : /**
       2             :  * @file ROOT-Sim.h
       3             :  *
       4             :  * @brief ROOT-Sim header for model development
       5             :  *
       6             :  * This header defines all the symbols which are needed to develop a model
       7             :  * to be simulated on top of ROOT-Sim.
       8             :  *
       9             :  * This header is the only file which should be included when developing
      10             :  * a simulation model. All function prototypes exposed to the application
      11             :  * developer are exposed and defined here.
      12             :  *
      13             :  * SPDX-FileCopyrightText: 2008-2021 HPDCS Group <rootsim@googlegroups.com>
      14             :  * SPDX-License-Identifier: GPL-3.0-only
      15             :  */
      16             : #pragma once
      17             : 
      18             : #include <limits.h>
      19             : #include <stdbool.h>
      20             : #include <stdint.h>
      21             : #include <stdlib.h>
      22             : 
      23           0 : enum rootsim_event {
      24             :         MODEL_INIT = 65532,
      25             :         LP_INIT,
      26             :         LP_FINI,
      27             :         MODEL_FINI
      28             : };
      29             : 
      30           0 : typedef double simtime_t;
      31           0 : typedef uint64_t lp_id_t;
      32             : 
      33             : struct ap_option {
      34             :         const char *name;
      35             :         int key;
      36             :         const char *arg;
      37             :         const char *doc;
      38             : };
      39             : 
      40           0 : enum ap_event_key {
      41             :         AP_KEY_INIT = 1 << 14,
      42             :         AP_KEY_FINI
      43             : };
      44             : 
      45             : __attribute((weak)) extern struct ap_option model_options[];
      46           0 : __attribute((weak)) extern void model_parse(int key, const char *arg);
      47             : 
      48           1 : extern lp_id_t n_lps;
      49             : 
      50           0 : extern void ScheduleNewEvent(lp_id_t receiver, simtime_t timestamp,
      51             :         unsigned event_type, const void *event_content, unsigned event_size);
      52             : 
      53           0 : extern void SetState(void *new_state);
      54             : 
      55           0 : extern double Random(void);
      56           0 : extern uint64_t RandomU64(void);
      57           1 : extern double Expent(double mean);
      58           1 : extern double Normal(void);
      59             : 
      60           0 : enum _topology_geometry_t {
      61             :         TOPOLOGY_HEXAGON = 1,   //!< hexagonal grid topology
      62             :         TOPOLOGY_SQUARE,        //!< square grid topology
      63             :         TOPOLOGY_RING,          //!< a ring shaped topology walkable in a single direction
      64             :         TOPOLOGY_BIDRING,       //!< a ring shaped topology
      65             :         TOPOLOGY_TORUS,         //!< a torus shaped grid topology (a wrapping around square topology)
      66             :         TOPOLOGY_STAR,          //!< a star shaped topology
      67             :         TOPOLOGY_MESH,          //!< an arbitrary shaped topology
      68             : };
      69             : 
      70           0 : enum _direction_t {
      71             :         DIRECTION_N,    //!< North direction
      72             :         DIRECTION_S,    //!< South direction
      73             :         DIRECTION_E,    //!< East direction
      74             :         DIRECTION_W,    //!< West direction
      75             :         DIRECTION_NE,   //!< North-east direction
      76             :         DIRECTION_SW,   //!< South-west direction
      77             :         DIRECTION_NW,   //!< North-west direction
      78             :         DIRECTION_SE,   //!< South-east direction
      79             : 
      80             :         // FIXME this is bad if the n_lps is more than INT_MAX - 1
      81             :         DIRECTION_INVALID = INT_MAX     //!< A generic invalid direction
      82             : };
      83             : 
      84             : extern struct topology_settings_t {
      85             :         enum _topology_geometry_t default_geometry;
      86             :         lp_id_t out_of_topology;
      87           0 : } topology_settings;
      88             : 
      89           0 : extern __attribute__ ((pure)) lp_id_t RegionsCount(void);
      90           0 : extern __attribute__ ((pure)) lp_id_t DirectionsCount(void);
      91           0 : extern __attribute__ ((pure)) lp_id_t GetReceiver(lp_id_t from, enum _direction_t direction);
      92           0 : extern lp_id_t FindReceiver(void);

Generated by: LCOV version 1.14