Biorbd
Release_1.13.0
Toggle main menu visibility
Loading...
Searching...
No Matches
IfStream.h
1
#ifndef BIORBD_UTILS_IFSTREAM_H
2
#define BIORBD_UTILS_IFSTREAM_H
3
4
#include "biorbdConfig.h"
5
6
#include <iostream>
7
#include <map>
8
9
#include "Utils/Path.h"
10
#include "rbdl/rbdl_math.h"
11
12
namespace
BIORBD_NAMESPACE {
13
namespace
utils {
14
class
Equation
;
15
class
Vector3d
;
16
20
class
BIORBD_API
IfStream
{
21
public
:
25
IfStream
();
26
32
IfStream
(
const
Path
& path, std::ios_base::openmode mode);
33
39
IfStream
(
const
char
* path, std::ios_base::openmode mode);
40
47
bool
open
(
const
Path
& path, std::ios_base::openmode mode);
48
54
bool
read
(
String
& text);
55
61
bool
readAWord
(
String
& text);
62
68
bool
read
(
int
& val);
69
75
bool
read
(
bool
& val);
76
82
bool
read
(
size_t
& val);
83
89
bool
read
(
double
& val);
90
#ifdef BIORBD_USE_CASADI_MATH
96
bool
read
(RBDLCasadiMath::MX_Xd_SubMatrix val);
97
#endif
98
105
bool
read
(
double
& result,
const
std::map<Equation, double>& variables);
106
#ifdef BIORBD_USE_CASADI_MATH
113
bool
read
(
114
RBDLCasadiMath::MX_Xd_SubMatrix result,
115
const
std::map<Equation, double>& variables);
116
#endif
117
124
bool
readFromBinary
(
char
* output,
int
n_elements);
125
131
bool
readFromBinary
(
float
& result);
132
138
bool
readFromBinary
(
Vector3d
& v);
139
146
bool
readSpecificTag
(
const
String
& tag,
String
& text);
147
154
bool
reachSpecificTag
(
const
String
& tag,
size_t
maxTag = -1);
155
162
int
countTagsInAConsecutiveLines
(
const
String
& tag);
163
168
void
getline
(
String
& text);
169
173
void
resetCursor
();
174
179
bool
close
();
180
185
bool
eof
();
186
187
protected
:
188
std::shared_ptr<bool>
m_isOpen
;
189
char
m_floatBuffer
[
sizeof
(float)];
190
191
private
:
192
std::shared_ptr<std::ifstream> m_ifs;
193
std::shared_ptr<Path> m_path;
194
};
195
196
}
// namespace utils
197
}
// namespace BIORBD_NAMESPACE
198
199
#endif
// BIORBD_UTILS_IFSTREAM_H
BIORBD_NAMESPACE::utils::Equation
Strings that are to be interpreted as equation that can be evaluated.
Definition
Equation.h:17
BIORBD_NAMESPACE::utils::IfStream::reachSpecificTag
bool reachSpecificTag(const String &tag, size_t maxTag=-1)
Advance in the file to a specific tag.
Definition
IfStream.cpp:58
BIORBD_NAMESPACE::utils::IfStream::close
bool close()
Close the file.
Definition
IfStream.cpp:220
BIORBD_NAMESPACE::utils::IfStream::eof
bool eof()
Return if the file is at the end.
Definition
IfStream.cpp:225
BIORBD_NAMESPACE::utils::IfStream::countTagsInAConsecutiveLines
int countTagsInAConsecutiveLines(const String &tag)
Counts the number of consecutive lines starting with the same tag and then brings it back to the init...
Definition
IfStream.cpp:80
BIORBD_NAMESPACE::utils::IfStream::m_floatBuffer
char m_floatBuffer[sizeof(float)]
Buffer for reading float in binaries.
Definition
IfStream.h:189
BIORBD_NAMESPACE::utils::IfStream::readFromBinary
bool readFromBinary(char *output, int n_elements)
Read a certain amounts of bits in binary.
Definition
IfStream.cpp:152
BIORBD_NAMESPACE::utils::IfStream::m_isOpen
std::shared_ptr< bool > m_isOpen
If file is open.
Definition
IfStream.h:188
BIORBD_NAMESPACE::utils::IfStream::readSpecificTag
bool readSpecificTag(const String &tag, String &text)
Advance in the file to a specific tag.
Definition
IfStream.cpp:51
BIORBD_NAMESPACE::utils::IfStream::IfStream
IfStream()
Construct IfStream.
Definition
IfStream.cpp:14
BIORBD_NAMESPACE::utils::IfStream::getline
void getline(String &text)
Read a whole line.
Definition
IfStream.cpp:210
BIORBD_NAMESPACE::utils::IfStream::open
bool open(const Path &path, std::ios_base::openmode mode)
Open the file.
Definition
IfStream.cpp:40
BIORBD_NAMESPACE::utils::IfStream::readAWord
bool readAWord(String &text)
Read a word in the file.
Definition
IfStream.cpp:123
BIORBD_NAMESPACE::utils::IfStream::read
bool read(String &text)
Read a word in the file skipping the word if it is c-like commented.
Definition
IfStream.cpp:101
BIORBD_NAMESPACE::utils::IfStream::resetCursor
void resetCursor()
Reset the file cursor to the 0 position.
Definition
IfStream.cpp:214
BIORBD_NAMESPACE::utils::Path
Collection of methods to manipulate path.
Definition
Path.h:16
BIORBD_NAMESPACE::utils::String
Wrapper around the std::string class with augmented functionality.
Definition
String.h:18
BIORBD_NAMESPACE::utils::Vector3d
Wrapper around Eigen Vector3d and attach it to a parent.
Definition
Vector3d.h:27
include
Utils
IfStream.h
Generated by
1.18.0