LandscapeDNDC 1.37.0
Loading...
Searching...
No Matches
Lresources.h
1/*
2 * SPDX-FileCopyrightText: Karlsruhe Institute of Technology (KIT)
3 * SPDX-License-Identifier: LicenseRef-Crabmeat
4 * This file is part of Crabmeat. Redistribution or commercial use is
5 * prohibited without express written permission. See LICENCE.
6 */
7
21
22/*
23 *
24 *
25 * Lresources.txt
26 * ## BEGIN
27 * # this is the top-level resources file
28 * #
29 * airchemistry.bc.* = 0.0 (???)
30 * airchemistry.bc.nitrogen = 370
31 *
32 * include moreresources.txt
33 * include evenmoreresources.txt
34 *
35 * species.maximumslots = 256
36 *
37 * ## END
38 */
39
40#ifndef LDNDC_LRESOURCES_H_
41#define LDNDC_LRESOURCES_H_
42
43#include "crabmeat-config.h"
44#include "crabmeat-dllexport.h"
45#include "cbm_rtcfg.h"
46
47#include "containers/lkeyvalbase.h"
48
49#include <stdio.h>
50
51#define LRESOURCES_TARGETVERSION_KEY "__system__.Lresources.targetversion"
52
53#define LRESOURCES_FILE LDNDC_RESOURCES_PATH "/" LDNDC_RESOURCES_FILENAME
54#define LRESOURCES_TABLE_SIZE 65536
55#define LRESOURCES_KEY_MAXSIZE 127
56#define LRESOURCES_VALUE_MAXSIZE 91
57namespace cbm
58{
59 typedef keyvaluebase_t< LRESOURCES_TABLE_SIZE, LRESOURCES_KEY_MAXSIZE, LRESOURCES_VALUE_MAXSIZE > resource_container_t;
60 class CBM_API Lresources_t : public resource_container_t
61 {
62 public:
63 bool is_open() const;
68 lerr_t read(
69 char const * /*package version*/,
70 char const * = LDNDC_RESOURCES_FILENAME /*filename*/);
71
72 private:
73
74 FILE * open_file(
75 char const * /*filename*/);
76 int read_file(
77 FILE * /*opened resources file*/, int * /*line number*/);
78 int try_open_include_file(
79 FILE **, char const *, std::string * /*resulting filename*/);
80 int insert_resource(
81 char const *,
82 char const *, char const *);
83 };
84}
85
86/* resources dictionary */
87namespace cbm {
88 extern CBM_API Lresources_t & DefaultResources(); }
89#define CBM_DefaultResources cbm::DefaultResources()
90
91#endif /* !LDNDC_LRESOURCES_H_ */
92