1 #define BIORBD_API_EXPORTS
2 #include "Utils/IfStream.h"
6 #include "Utils/Error.h"
7 #include "Utils/Equation.h"
11 m_isOpen(std::make_shared<bool>(false)),
12 m_ifs(std::make_shared<std::ifstream>()),
13 m_path(std::make_shared<biorbd::utils::
Path>())
15 setlocale(LC_ALL,
"C");
19 std::ios_base::openmode mode = std::ios_base::in ) :
20 m_isOpen(std::make_shared<bool>(false)),
21 m_ifs(std::make_shared<std::ifstream>()),
22 m_path(std::make_shared<biorbd::utils::
Path>(path))
24 open(m_path->absolutePath().c_str(), mode);
25 setlocale(LC_ALL,
"C");
29 std::ios_base::openmode mode = std::ios_base::in ) :
30 m_isOpen(std::make_shared<bool>(false)),
31 m_ifs(std::make_shared<std::ifstream>()),
32 m_path(std::make_shared<biorbd::utils::
Path>(path))
34 open(m_path->absolutePath().c_str(), mode);
35 setlocale(LC_ALL,
"C");
42 std::ios_base::openmode mode = std::ios_base::in )
45 *m_ifs = std::ifstream(path.
absolutePath().c_str(), mode);
54 reachSpecificTag(tag);
61 if (!text.
tolower().compare(tag))
75 std::streamoff positionInFile(m_ifs->tellg());
82 if (!text.compare(tag)){
90 m_ifs->seekg(positionInFile);
95 bool out(*m_ifs >> text);
100 if (!text(0,1).compare(
"//")){
104 else if (!text(0,1).compare(
"/*")){
105 while (readAWord(text)){
106 if (!text(0,1).compare(
"*/") || (text.length()>=2 && !text(
static_cast<unsigned int>(text.length()-2),
static_cast<unsigned int>(text.length()-1)).compare(
"*/")))
114 bool out(*m_ifs >> text);
119 std::map<biorbd::utils::Equation, double> dumb;
120 return read(val, dumb);
122 #ifdef BIORBD_USE_CASADI_MATH
124 RBDLCasadiMath::MX_Xd_SubMatrix val){
125 std::map<biorbd::utils::Equation, double> dumb;
126 return read(val, dumb);
131 const std::map<biorbd::utils::Equation, double> &variables){
137 }
catch (std::runtime_error) {
142 #ifdef BIORBD_USE_CASADI_MATH
144 RBDLCasadiMath::MX_Xd_SubMatrix result,
145 const std::map<biorbd::utils::Equation, double> &variables){
151 }
catch (std::runtime_error) {
168 val =
static_cast<unsigned int>(std::stoul(tp));
175 val = std::stoi(tp) != 0;
180 std::getline(*m_ifs, text);