Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alvarez, Gonzalo
PsimagLite
Commits
dc43bd22
Commit
dc43bd22
authored
Dec 12, 2021
by
Alvarez, Gonzalo
Browse files
InputNg: returns map of key/value pairs
parent
fb44e393
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/Ainur/AinurSpirit.h
View file @
dc43bd22
...
...
@@ -60,6 +60,7 @@ public:
typedef
std
::
string
::
iterator
IteratorType
;
typedef
Vector
<
char
>::
Type
VectorCharType
;
typedef
AinurState
::
VectorStringType
VectorStringType
;
Ainur
(
String
str
);
...
...
@@ -83,6 +84,12 @@ public:
state_
.
readValue
(
t
,
dummy_
+
label
);
}
template
<
typename
SomeMapType
>
void
setMap
(
SomeMapType
&
map
)
const
{
state_
.
setMap
(
map
);
}
private:
static
bool
allEmpty
(
IteratorType
first
,
IteratorType
last
)
...
...
src/Ainur/AinurState.h
View file @
dc43bd22
...
...
@@ -11,6 +11,8 @@ namespace PsimagLite {
class
AinurState
{
public:
typedef
Vector
<
SizeType
>::
Type
VectorSizeType
;
typedef
Vector
<
String
>::
Type
VectorStringType
;
typedef
std
::
complex
<
DoubleOrFloatType
>
ComplexType
;
...
...
@@ -60,8 +62,6 @@ class AinurState {
Matrix
<
T
>&
t_
;
};
// struct ActionMatrix
public:
enum
ErrorEnum
{
ERR_PARSE_UNDECLARED
,
...
...
@@ -150,6 +150,15 @@ public:
used_
[
x
]
++
;
}
template
<
typename
SomeMapType
>
void
setMap
(
SomeMapType
&
map
)
const
{
const
SizeType
n
=
keys_
.
size
();
assert
(
n
==
values_
.
size
());
for
(
SizeType
i
=
0
;
i
<
n
;
++
i
)
map
[
keys_
[
i
]]
=
map
[
values_
[
i
]];
}
static
bool
verbose
()
{
return
false
;
}
static
String
errLabel
(
ErrorEnum
e
,
String
key
)
...
...
src/InputNg.h
View file @
dc43bd22
...
...
@@ -538,6 +538,7 @@ public:
}
ainur_
=
new
Ainur
(
inputWriteable
.
inputCheck
().
import
()
+
data_
);
ainur_
->
setMap
(
mapStrStr_
);
}
}
...
...
@@ -547,14 +548,6 @@ public:
ainur_
=
0
;
}
template
<
typename
SomeMemResolvType
>
SizeType
memResolv
(
SomeMemResolvType
&
,
SizeType
,
String
=
""
)
const
{
return
0
;
}
void
rewind
()
{}
bool
isAinur
()
const
{
return
(
ainur_
!=
nullptr
);
}
...
...
@@ -849,6 +842,11 @@ public:
throw
RuntimeError
(
"InputNg: Matrix<String> not supported in POD inputs
\n
"
);
}
MapStrStrType
map
()
const
{
return
mapStrStr_
;
}
const
String
&
filename
()
const
{
return
file_
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment