SST 15.0
Structural Simulation Toolkit
envquery.h
1// Copyright 2009-2025 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-2025, 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 SST_CORE_ENV_ENVQUERY_H
13#define SST_CORE_ENV_ENVQUERY_H
14
15#include "sst_config.h"
16
17#include "sst/core/env/envconfig.h"
18
19#include <cstdio>
20#include <cstdlib>
21#include <cstring>
22#include <iostream>
23#include <string>
24#include <vector>
25
26namespace SST::Core::Environment {
27
28/**
29Reads the next new-line delimited entry in a file and put
30into the buffer provided. The user is responsible for ensuring
31that the buffer is of an appropriate length.
32*/
33void configReadLine(FILE* theFile, char* lineBuffer);
34
35/**
36Opens a configuration file specified and populates an
37EnvironmentConfiguration instance with the contents.
38*/
39void populateEnvironmentConfig(const std::string& path, EnvironmentConfiguration* cfg, bool errorOnNotOpen);
40
41/**
42Uses an already open file, reads the contents and populates an instance
43of an EnvironmentConfiguration with the contents
44*/
45void populateEnvironmentConfig(FILE* configFile, EnvironmentConfiguration* cfg, bool errorOnNotOpen);
46
47/**
48Provides an SST-guaranteed precedence ordering loading of configuration
49files. The user can supply an override list of file paths which should
50take precedence over the default configuration locations.
51*/
52EnvironmentConfiguration* getSSTEnvironmentConfiguration(const std::vector<std::string>& overridePaths);
53
54} // namespace SST::Core::Environment
55
56#endif // SST_CORE_ENV_ENVQUERY_H