Macros | Functions
Persist.cxx File Reference
#include "WireCellUtil/Persist.h"
#include "WireCellUtil/String.h"
#include "WireCellUtil/Logging.h"
#include "WireCellUtil/Exceptions.h"
#include "libjsonnet++.h"
#include <cstdlib>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/filesystem.hpp>
#include <string>
#include <sstream>
#include <fstream>

Go to the source code of this file.

Macros

#define WIRECELL_PATH_VARNAME   "WIRECELL_PATH"
 

Functions

static std::string file_extension (const std::string &filename)
 
static std::vector< std::stringget_path ()
 
static void init_parser (jsonnet::Jsonnet &parser, const Persist::externalvars_t &extvar, const Persist::externalvars_t &extcode)
 

Macro Definition Documentation

#define WIRECELL_PATH_VARNAME   "WIRECELL_PATH"

Definition at line 26 of file Persist.cxx.

Function Documentation

static std::string file_extension ( const std::string filename)
static

Definition at line 28 of file Persist.cxx.

29 {
30  auto ind = filename.rfind(".");
31  if (ind == string::npos) {
32  return "";
33  }
34  return filename.substr(ind);
35 }
string filename
Definition: train.py:213
static std::vector<std::string> get_path ( )
static

Definition at line 84 of file Persist.cxx.

85 {
86  std::vector<std::string> ret;
87  const char* cpath = std::getenv(WIRECELL_PATH_VARNAME);
88  if (!cpath) {
89  return ret;
90  }
91  for (auto path : String::split(cpath)) {
92  ret.push_back(path);
93  }
94  return ret;
95 }
#define WIRECELL_PATH_VARNAME
Definition: Persist.cxx:26
std::string getenv(std::string const &name)
Definition: getenv.cc:15
void split(std::string const &s, char c, OutIter dest)
Definition: split.h:35
static void init_parser ( jsonnet::Jsonnet &  parser,
const Persist::externalvars_t extvar,
const Persist::externalvars_t extcode 
)
static

Definition at line 170 of file Persist.cxx.

173 {
174  parser.init();
175  for (auto path : get_path()) {
176  parser.addImportPath(path);
177  }
178  for (auto& vv : extvar) {
179  parser.bindExtVar(vv.first, vv.second);
180  }
181  for (auto& vv : extcode) {
182  parser.bindExtCodeVar(vv.first, vv.second);
183  }
184 }
static std::vector< std::string > get_path()
Definition: Persist.cxx:84