Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yuhao Liu
ogs
Commits
8c62eaa9
Commit
8c62eaa9
authored
4 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[App/IO] Use std::any in csv I/F replacing boost.
parent
dd9b10a3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Applications/FileIO/CsvInterface.cpp
+6
-7
6 additions, 7 deletions
Applications/FileIO/CsvInterface.cpp
Applications/FileIO/CsvInterface.h
+4
-6
4 additions, 6 deletions
Applications/FileIO/CsvInterface.h
with
10 additions
and
13 deletions
Applications/FileIO/CsvInterface.cpp
+
6
−
7
View file @
8c62eaa9
...
...
@@ -295,15 +295,15 @@ std::size_t CsvInterface::getVectorSize(std::size_t idx) const
{
if
(
_data
[
idx
].
type
()
==
typeid
(
std
::
vector
<
std
::
string
>
))
{
return
boo
st
::
any_cast
<
std
::
vector
<
std
::
string
>>
(
_data
[
idx
]).
size
();
return
st
d
::
any_cast
<
std
::
vector
<
std
::
string
>>
(
_data
[
idx
]).
size
();
}
if
(
_data
[
idx
].
type
()
==
typeid
(
std
::
vector
<
double
>
))
{
return
boo
st
::
any_cast
<
std
::
vector
<
double
>>
(
_data
[
idx
]).
size
();
return
st
d
::
any_cast
<
std
::
vector
<
double
>>
(
_data
[
idx
]).
size
();
}
if
(
_data
[
idx
].
type
()
==
typeid
(
std
::
vector
<
int
>
))
{
return
boo
st
::
any_cast
<
std
::
vector
<
int
>>
(
_data
[
idx
]).
size
();
return
st
d
::
any_cast
<
std
::
vector
<
int
>>
(
_data
[
idx
]).
size
();
}
return
0
;
}
...
...
@@ -312,17 +312,16 @@ void CsvInterface::writeValue(std::size_t vec_idx, std::size_t in_vec_idx)
{
if
(
_data
[
vec_idx
].
type
()
==
typeid
(
std
::
vector
<
std
::
string
>
))
{
_out
<<
boo
st
::
any_cast
<
std
::
vector
<
std
::
string
>>
(
_out
<<
st
d
::
any_cast
<
std
::
vector
<
std
::
string
>>
(
_data
[
vec_idx
])[
in_vec_idx
];
}
else
if
(
_data
[
vec_idx
].
type
()
==
typeid
(
std
::
vector
<
double
>
))
{
_out
<<
boost
::
any_cast
<
std
::
vector
<
double
>>
(
_data
[
vec_idx
])[
in_vec_idx
];
_out
<<
std
::
any_cast
<
std
::
vector
<
double
>>
(
_data
[
vec_idx
])[
in_vec_idx
];
}
else
if
(
_data
[
vec_idx
].
type
()
==
typeid
(
std
::
vector
<
int
>
))
{
_out
<<
boo
st
::
any_cast
<
std
::
vector
<
int
>>
(
_data
[
vec_idx
])[
in_vec_idx
];
_out
<<
st
d
::
any_cast
<
std
::
vector
<
int
>>
(
_data
[
vec_idx
])[
in_vec_idx
];
}
}
...
...
This diff is collapsed.
Click to expand it.
Applications/FileIO/CsvInterface.h
+
4
−
6
View file @
8c62eaa9
...
...
@@ -13,9 +13,7 @@
#pragma once
#include
<boost/any.hpp>
#include
"BaseLib/Logging.h"
#include
<any>
#include
<array>
#include
<fstream>
#include
<iterator>
...
...
@@ -25,9 +23,9 @@
#include
<typeinfo>
#include
<vector>
#include
"BaseLib/StringTools.h"
#include
"BaseLib/IO/Writer.h"
#include
"BaseLib/Logging.h"
#include
"BaseLib/StringTools.h"
namespace
GeoLib
{
...
...
@@ -253,7 +251,7 @@ private:
bool
_writeCsvHeader
{
true
};
std
::
vector
<
std
::
string
>
_vec_names
;
std
::
vector
<
boo
st
::
any
>
_data
;
std
::
vector
<
st
d
::
any
>
_data
;
};
}
// namespace FileIO
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment