NASA Logo
Ocean Color Science Software

ocssw V2022
getenv.cpp
Go to the documentation of this file.
1 #include <boost/algorithm/string.hpp>
2 #include <vector>
3 #include <regex>
4 #include <iostream>
5 
6 #ifdef WINPATH
7 #define SEP "\\"
8 #define REGEX ".*%(\\w+)%.*"
9 #else
10 #define SEP "/"
11 #define REGEX ".*\\$(\\w+).*"
12 #endif
13 
14 std::string filenv(const std::string &file_env_path) {
15  std::vector<std::string> path_sep;
16  boost::split(path_sep,file_env_path,boost::is_any_of(SEP));
17  std::string out_path;
18  for (const auto &el : path_sep) {
19  std::string s = el;
20  std::regex rgx(REGEX);
21  std::smatch match;
22  if (std::regex_search(s, match, rgx)) {
23  std::string env_ = match[1];
24  out_path += std::getenv(env_.c_str());
25  } else {
26  out_path += SEP + s;
27  }
28  }
29  return out_path;
30 }
31 
32 extern "C" void filenv_(char *inp, char *out) {
33  strcpy(out, filenv(inp).c_str());
34 }
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude resolving resolving GSFcd00179 Corrected handling of fill values for[Sensor|Solar][Zenith|Azimuth] resolving MODxl01751 Changed to validate LUT version against a value retrieved from the resolving MODxl02056 Changed to calculate Solar Diffuser angles without adjustment for estimated post launch changes in the MODIS orientation relative to incidentally resolving defects MODxl01766 Also resolves MODxl01947 Changed to ignore fill values in SCI_ABNORM and SCI_STATE rather than treating them as resolving MODxl01780 Changed to use spacecraft ancillary data to recognise when the mirror encoder data is being set by side A or side B and to change calculations accordingly This removes the need for seperate LUTs for Side A and Side B data it makes the new LUTs incompatible with older versions of the and vice versa Also resolves MODxl01685 A more robust GRing algorithm is being which will create a non default GRing anytime there s even a single geolocated pixel in a granule Removed obsolete messages from seed as required for compatibility with version of the SDP toolkit Corrected test output file names to end in out
Definition: HISTORY.txt:422
@ string
#define SEP
Definition: getenv.cpp:10
std::string filenv(const std::string &file_env_path)
Definition: getenv.cpp:14
void filenv_(char *inp, char *out)
Definition: getenv.cpp:32
#define REGEX
Definition: getenv.cpp:11
bool match(char *first, char *second)
Definition: l2qc_viirs.cpp:45
data_t s[NROOTS]
Definition: decode_rs.h:75
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
el
Definition: decode_rs.h:168