SST  11.0.0
StructuralSimulationToolkit
envquery.h
1 // Copyright 2009-2021 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2021, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef _H_SST_CORE_ENV_QUERY_H
13 #define _H_SST_CORE_ENV_QUERY_H
14 
15 #include "sst_config.h"
16 
17 #include "sst/core/env/envconfig.h"
18 
19 #include <cstdio>
20 #include <cstdlib>
21 #include <iostream>
22 #include <cstring>
23 #include <string>
24 
25 namespace SST {
26 namespace Core {
27 namespace Environment {
28 
29 /**
30 Reads the next new-line delimited entry in a file and put
31 into the buffer provided. The user is responsible for ensuring
32 that the buffer is of an appropriate length.
33 */
34 void configReadLine(FILE* theFile, char* lineBuffer);
35 
36 /**
37 Opens a configuration file specified and populates an
38 EnvironmentConfiguration instance with the contents.
39 */
40 void populateEnvironmentConfig(const std::string& path, EnvironmentConfiguration* cfg,
41  bool errorOnNotOpen);
42 
43 /**
44 Uses an already open file, reads the contents and populates an instance
45 of an EnvironmentConfiguration with the contents
46 */
47 void populateEnvironmentConfig(FILE* configFile, EnvironmentConfiguration* cfg,
48  bool errorOnNotOpen);
49 
50 /**
51 Provides an SST-guaranteed precedence ordering loading of configuration
52 files. The user can supply an override list of file paths which should
53 take precedence over the default configuration locations.
54 */
55 EnvironmentConfiguration* getSSTEnvironmentConfiguration(const std::vector<std::string>& overridePaths);
56 
57 }
58 }
59 }
60 
61 #endif