Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
fe1cf713
Commit
fe1cf713
authored
Nov 29, 2011
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
add onelab::string "kinds"
parent
27bc0a85
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Common/onelab.h
+20
-13
20 additions, 13 deletions
Common/onelab.h
Fltk/onelabWindow.cpp
+6
-0
6 additions, 0 deletions
Fltk/onelabWindow.cpp
with
26 additions
and
13 deletions
Common/onelab.h
+
20
−
13
View file @
fe1cf713
...
...
@@ -216,26 +216,27 @@ namespace onelab{
}
};
// The string class. A string has a mutable "type": we do not derive
// specialized classes, because the type should be changeable at
// runtime (e.g. from client-dependent function to onelab-function
// to table of values)
// The string class. A string has a mutable "kind": we do not derive
// specialized classes, because the kind should be changeable at
// runtime (e.g. from client-dependent mathematical expression to to
// table of values). Possible kinds: generic, filename, hostname,
// client-dependent mathematical expression, comma-separated list of
// values, matlab matrix, onelab mathematical expression (through
// mathex?), ...
class
string
:
public
parameter
{
private:
std
::
string
_value
;
std
::
string
_value
,
_kind
;
std
::
vector
<
std
::
string
>
_choices
;
// FIXME add a "type" to interpret the string: file name,
// comma-separated values for a list, hostname, table of numbers,
// client-dependent mathematical expression ("3 sin(X[])"),
// onlab-expression (through mathex?), ...
public:
string
(
const
std
::
string
&
name
=
""
,
const
std
::
string
&
value
=
""
,
const
std
::
string
&
shortHelp
=
""
,
const
std
::
string
&
help
=
""
)
:
parameter
(
name
,
shortHelp
,
help
),
_value
(
value
)
{}
:
parameter
(
name
,
shortHelp
,
help
),
_value
(
value
)
,
_kind
(
"generic"
)
{}
void
setValue
(
const
std
::
string
&
value
){
_value
=
value
;
}
void
setKind
(
const
std
::
string
&
kind
){
_kind
=
kind
;
}
void
setChoices
(
const
std
::
vector
<
std
::
string
>
&
choices
){
_choices
=
choices
;
}
std
::
string
getType
()
const
{
return
"string"
;
}
const
std
::
string
&
getValue
()
const
{
return
_value
;
}
const
std
::
string
&
getKind
()
const
{
return
_kind
;
}
const
std
::
vector
<
std
::
string
>
&
getChoices
()
const
{
return
_choices
;
}
void
update
(
const
string
&
p
)
{
...
...
@@ -243,6 +244,10 @@ namespace onelab{
setValue
(
p
.
getValue
());
setChanged
(
true
);
}
if
(
p
.
getKind
()
!=
getKind
()){
setKind
(
p
.
getKind
());
setChanged
(
true
);
}
if
(
p
.
getChoices
().
size
())
setChoices
(
p
.
getChoices
());
}
...
...
@@ -250,6 +255,7 @@ namespace onelab{
{
std
::
ostringstream
sstream
;
sstream
<<
parameter
::
toChar
()
<<
sanitize
(
_value
)
<<
charSep
()
<<
sanitize
(
_kind
)
<<
charSep
()
<<
_choices
.
size
()
<<
charSep
();
for
(
unsigned
int
i
=
0
;
i
<
_choices
.
size
();
i
++
)
sstream
<<
sanitize
(
_choices
[
i
])
<<
charSep
();
...
...
@@ -273,6 +279,7 @@ namespace onelab{
setAttribute
(
key
,
getNextToken
(
msg
,
pos
));
}
setValue
(
getNextToken
(
msg
,
pos
));
setKind
(
getNextToken
(
msg
,
pos
));
_choices
.
resize
(
atoi
(
getNextToken
(
msg
,
pos
).
c_str
()));
for
(
unsigned
int
i
=
0
;
i
<
_choices
.
size
();
i
++
)
_choices
[
i
]
=
getNextToken
(
msg
,
pos
);
...
...
@@ -284,7 +291,7 @@ namespace onelab{
// regions will include union, intersection, etc.
class
region
:
public
parameter
{
private:
std
::
string
_value
;
//
FIXME
: change this into std::set<std::string>
std
::
string
_value
;
//
TODO
: change this into std::set<std::string>
std
::
vector
<
std
::
string
>
_choices
;
public:
region
(
const
std
::
string
&
name
=
""
,
const
std
::
string
&
value
=
""
,
...
...
@@ -321,9 +328,9 @@ namespace onelab{
// regions.
class
function
:
public
parameter
{
private:
//
C
hange this to onelab::string
//
TODO: c
hange this to onelab::string
std
::
string
_value
;
//
C
hange this into std::map<onelab::region, onelab::string>
//
TODO: c
hange this into std::map<onelab::region, onelab::string>
std
::
map
<
std
::
string
,
std
::
string
>
_pieceWiseValues
;
std
::
vector
<
std
::
string
>
_choices
;
public:
...
...
This diff is collapsed.
Click to expand it.
Fltk/onelabWindow.cpp
+
6
−
0
View file @
fe1cf713
...
...
@@ -296,6 +296,7 @@ static std::string getMshFileName(onelab::client *c)
name
=
GetDefaultFileName
(
CTX
::
instance
()
->
mesh
.
fileFormat
);
}
onelab
::
string
o
(
"Gmsh/MshFileName"
,
name
,
"Mesh name"
);
o
.
setKind
(
"file"
);
c
->
set
(
o
);
return
name
;
}
...
...
@@ -571,6 +572,11 @@ void onelabWindow::rebuildTree()
std
::
vector
<
onelab
::
string
>
strings
;
onelab
::
server
::
instance
()
->
get
(
strings
);
for
(
unsigned
int
i
=
0
;
i
<
strings
.
size
();
i
++
){
if
(
strings
[
i
].
getKind
()
==
"file"
){
printf
(
"got file string
\n
"
);
}
Fl_Tree_Item
*
n
=
_tree
->
add
(
strings
[
i
].
getName
().
c_str
());
n
->
labelsize
(
FL_NORMAL_SIZE
+
2
);
std
::
string
label
=
strings
[
i
].
getShortHelp
();
...
...
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