Stan
2.5.0
probability, sampling & optimization
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
stan
common
context_factory.hpp
Go to the documentation of this file.
1
#ifndef STAN__COMMON__CONTEXT_FACTORY_HPP
2
#define STAN__COMMON__CONTEXT_FACTORY_HPP
3
4
#include <fstream>
5
#include <
stan/io/dump.hpp
>
6
7
namespace
stan {
8
namespace
common {
9
10
template
<
typename
VARCON>
11
class
var_context_factory
{
12
public
:
13
var_context_factory
() {}
14
virtual
VARCON
operator()
(
const
std::string source) = 0;
15
typedef
VARCON
var_context_t
;
16
};
17
18
// FIXME: Move to CmdStan
19
class
dump_factory
:
public
var_context_factory
<stan::io::dump> {
20
public
:
21
stan::io::dump
operator()
(
const
std::string source) {
22
std::fstream source_stream(source.c_str(),
23
std::fstream::in);
24
25
if
(source_stream.fail()) {
26
std::string message(
"dump_factory Error: the file "
+ source +
" does not exist."
);
27
throw
std::runtime_error(message);
28
}
29
30
stan::io::dump
dump(source_stream);
31
source_stream.close();
32
33
return
dump;
34
}
35
};
36
37
}
38
}
39
40
#endif
stan::common::dump_factory
Definition:
context_factory.hpp:19
stan::common::dump_factory::operator()
stan::io::dump operator()(const std::string source)
Definition:
context_factory.hpp:21
stan::common::var_context_factory::var_context_factory
var_context_factory()
Definition:
context_factory.hpp:13
stan::common::var_context_factory::operator()
virtual VARCON operator()(const std::string source)=0
stan::common::var_context_factory::var_context_t
VARCON var_context_t
Definition:
context_factory.hpp:15
stan::common::var_context_factory
Definition:
context_factory.hpp:11
dump.hpp
stan::io::dump
Represents named arrays with dimensions.
Definition:
dump.hpp:902
[
Stan Home Page
]
© 2011–2014, Stan Development Team.