8#include <boost/filesystem.hpp>
9#include <boost/foreach.hpp>
10#include <boost/algorithm/string.hpp>
11#include <boost/algorithm/string/predicate.hpp>
26 std::set<string>
archs;
29 const string words =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_"
30 "abcdefghijklmnopqrstuvwxyz";
35 while ((offset =
s.find(
construct, offset)) != string::npos) {
51 namespace fs = boost::filesystem;
53 string libpath = (fs::path(
p) / fs::path(
"lib" + lib +
SUFFIX)).
string();
57 std::ifstream f (
libpath.c_str());
59 f.seekg(0, std::ios::end);
61 f.seekg(0, std::ios::beg);
62 s.assign((std::istreambuf_iterator<char>(f)),
63 std::istreambuf_iterator<char>());
71 spec =
p +
":" + lib +
":" + (*it);
83 namespace fs = boost::filesystem;
87 boost::system::error_code
errc;
88 boost::system::error_code
no_err;
90 fs::recursive_directory_iterator
it(
pth,
errc);
91 fs::recursive_directory_iterator
last;
103 it.disable_recursion_pending();
104 if (
it.depth() > 0) {
108 }
else if (fs::is_directory(
pth,
errc)) {
110 }
else if (!boost::algorithm::ends_with(
pthstr,
SUFFIX)) {
113 string p =
pth.parent_path().string();
114 string lib =
pth.filename().string();
115 if (
d.length() <
p.length())
116 p =
p.substr(
d.length()+1, string::npos);
119 lib = lib.substr(3, lib.rfind(
".") - 3);
156 std::set<std::string>::iterator
it;
168 root[
"specs"] = spec;
Value & append(const Value &value)
Append value to array at the end.
The abstract base class used by all types of agents that live and interact in a simulation.
virtual Json::Value annotations()
Returns an agent's json annotations for all state variables and any other information the developer w...
virtual std::string schema()
Returns an agent's xml rng schema for initializing from input files.
A simulation context provides access to necessary simulation-global functions and state.
void DelAgent(Agent *m)
Destructs and cleans up m (and it's children recursively).
static Agent * Make(Context *ctx, AgentSpec spec)
Returns a newly constructed agent for the given module spec.
static bool Exists(AgentSpec spec)
Tests that an agent spec really exists.
static std::string FindModule(std::string path)
Returns the full path to a module by searching through default install and CYCLUS_PATH directories.
static const std::vector< std::string > cyclus_path()
for failed reading/writing to files, network connections, etc..
Collects and manages output data generation for the cyclus core and agents during a simulation.
Controls simulation timestepping and inter-timestep phases.
@ arrayValue
array value (ordered list)
@ objectValue
object value (collection of name/value pairs).
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
std::set< std::string > DiscoverSpecsInDir(std::string d)
Discover archetype specifications that live recursively in modules in a dir.
std::set< std::string > DiscoverSpecsInCyclusPath()
Discover archetype specifications that live recursively in CYCLUS_PATH directories.
Json::Value DiscoverMetadataInCyclusPath()
Discover archetype metadata in cyclus path.
std::set< std::string > DiscoverArchetypes(const std::string s)
This function returns a vector of archetype names in a given string that is the binary represnetation...
std::set< std::string > DiscoverSpecs(std::string p, std::string lib)
Discover archetype specifications for a path and library.
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters