Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NomadShell
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Instrument Control
NomadShell
Commits
4853f91c
Commit
4853f91c
authored
8 years ago
by
Jerome Locatelli
Browse files
Options
Downloads
Patches
Plain Diff
remove scan viewer temporary
parent
0ca9ec76
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/NomadState.cpp
+84
-76
84 additions, 76 deletions
src/NomadState.cpp
with
84 additions
and
76 deletions
src/NomadState.cpp
+
84
−
76
View file @
4853f91c
...
...
@@ -312,8 +312,8 @@ int main(int argc, char* argv[]) {
DataPlotDescription
dataplot
;
map
<
std
::
string
,
std
::
string
>
scans
;
map
<
std
::
string
,
std
::
string
>
scanviewers
;
//
map<std::string, std::string> scans;
//
map<std::string, std::string> scanviewers;
std
::
string
scanspy
;
nscom
::
OctetSequence_var
binaryResult
=
servantManager
->
getWholeConfiguration
(
0
);
...
...
@@ -354,29 +354,30 @@ int main(int argc, char* argv[]) {
}
++
piter
;
}
}
else
if
(
type
==
"scan_viewer"
)
{
::
google
::
protobuf
::
RepeatedPtrField
<
configuration
::
PropertyDescriptor
>::
const_iterator
piter
=
desc
.
properties
().
begin
();
while
(
piter
!=
desc
.
properties
().
end
())
{
string
name
=
(
*
piter
).
name
();
if
(
name
.
find
(
"plot_name"
)
!=
std
::
string
::
npos
)
{
scanviewers
[
desc
.
name
()]
=
DatabaseAccessorVar
->
getFormattedValue
(
0
,
(
*
piter
).
idarray
(
0
));
}
++
piter
;
}
}
else
if
(
type
==
"parameterizable_scan_1d"
)
{
scans
[
desc
.
name
()]
=
desc
.
name
();
//
} else if (type == "scan_viewer") {
//
::google::protobuf::RepeatedPtrField<configuration::PropertyDescriptor>::const_iterator piter =
//
desc.properties().begin();
//
while (piter != desc.properties().end()) {
//
string name = (*piter).name();
//
if (name.find("plot_name") != std::string::npos) {
//
scanviewers[desc.name()] = DatabaseAccessorVar->getFormattedValue(0, (*piter).idarray(0));
//
}
//
++piter;
//
}
//
} else if (type == "parameterizable_scan_1d") {
//
scans[desc.name()] = desc.name();
}
else
if
(
type
==
"scan_spy"
)
{
::
google
::
protobuf
::
RepeatedPtrField
<
configuration
::
PropertyDescriptor
>::
const_iterator
piter
=
desc
.
properties
().
begin
();
while
(
piter
!=
desc
.
properties
().
end
())
{
string
name
=
(
*
piter
).
name
();
if
(
name
.
find
(
"scan_controller_name"
)
!=
std
::
string
::
npos
)
{
scanspy
=
DatabaseAccessorVar
->
getFormattedValue
(
0
,
(
*
piter
).
idarray
(
0
));
break
;
}
++
piter
;
}
scanspy
=
desc
.
name
();
// ::google::protobuf::RepeatedPtrField<configuration::PropertyDescriptor>::const_iterator piter =
// desc.properties().begin();
// while (piter != desc.properties().end()) {
// string name = (*piter).name();
// if (name.find("scan_controller_name") != std::string::npos) {
// scanspy = DatabaseAccessorVar->getFormattedValue(0, (*piter).idarray(0));
// break;
// }
// ++piter;
// }
}
}
...
...
@@ -398,7 +399,8 @@ int main(int argc, char* argv[]) {
servantSpyProperties
.
MergeFrom
(
servantSpyDynamicProperties
);
if
((
desc
.
enabled
()
==
true
)
&&
((
desc
.
visible
()
==
true
)
||
((
desc
.
visible
()
==
false
)
&&
(
desc
.
type
()
==
"acquisition_spy"
))
||
((
desc
.
visible
()
==
false
)
&&
(
desc
.
type
()
==
"scan_spy"
)))
&&
(
servantSpyProperties
.
properties_size
()
>
3
))
{
((
desc
.
visible
()
==
false
)
&&
(
desc
.
type
()
==
"scan_spy"
))
||
((
desc
.
visible
()
==
false
)
&&
(
desc
.
type
()
==
"level"
))
||
((
desc
.
visible
()
==
false
)
&&
(
desc
.
type
()
==
"commandline"
)))
&&
(
servantSpyProperties
.
properties_size
()
>
3
))
{
// cout << desc.name() << " : ENABLE" << endl;
for
(
int32
j
=
0
;
j
<
servantSpyProperties
.
properties_size
();
++
j
)
{
configuration
::
SpyPropertyDescriptor
spydesc
=
servantSpyProperties
.
properties
(
j
);
...
...
@@ -420,6 +422,12 @@ int main(int argc, char* argv[]) {
if
((
*
piter
).
name
()
==
"commandStatus"
)
{
value
=
lexical_cast
<
string
>
(
DatabaseAccessorVar
->
getInt32Value
(
0
,
spydesc
.
actualid
()));
}
else
if
((
*
piter
).
name
()
==
"title"
)
{
replace_all
(
value
,
"'"
,
" "
);
}
else
if
((
*
piter
).
name
()
==
"subtitle"
)
{
replace_all
(
value
,
"'"
,
" "
);
}
WebServantProperty
sp
((
*
piter
).
name
(),
value
);
if
(
spydesc
.
setpointid
()
!=
0
)
{
piter
=
desc
.
properties
().
begin
();
...
...
@@ -523,60 +531,60 @@ int main(int argc, char* argv[]) {
// }
}
}
// Scan viewers
map
<
std
::
string
,
std
::
string
>::
iterator
iters
=
scanviewers
.
begin
();
while
(
iters
!=
scanviewers
.
end
())
{
// cout << "plot : " << iters->first << " : " << iters->second << endl;
ostringstream
imgloc
;
imgloc
<<
LOCALPATH
<<
picsInstrumentName
<<
"_"
<<
iters
->
first
<<
".png"
;
if
(
boost
::
filesystem
::
exists
(
imgloc
.
str
())
==
true
)
{
// cout << "remove file: " << imgloc.str() << endl;
boost
::
filesystem
::
remove
(
imgloc
.
str
());
}
// copy image
ostringstream
imgrem
;
imgrem
<<
"/net/"
<<
picsInstrumentName
<<
"/users/"
<<
picsUserName
<<
"/offscreenImages/web/"
<<
iters
->
first
<<
"#scan_viewer_plot#"
<<
iters
->
second
<<
".png"
;
// if (boost::filesystem::exists(imgrem.str()) == true) {
// cout << "copy file : " << imgrem.str() << " to " << imgloc.str() << endl;
try
{
boost
::
filesystem
::
copy_file
(
imgrem
.
str
(),
imgloc
.
str
());
boost
::
filesystem
::
last_write_time
(
imgloc
.
str
(),
boost
::
filesystem
::
last_write_time
(
imgrem
.
str
()));
}
catch
(...)
{
}
// } else {
// cout << "file doesn't: " << imgrem.str() << endl;
// // Scan viewers
// map<std::string, std::string>::iterator iters = scanviewers.begin();
// while (iters != scanviewers.end()) {
//// cout << "plot : " << iters->first << " : " << iters->second << endl;
// ostringstream imgloc;
// imgloc << LOCALPATH << picsInstrumentName << "_" << iters->first << ".png";
// if (boost::filesystem::exists(imgloc.str()) == true) {
//// cout << "remove file: " << imgloc.str() << endl;
// boost::filesystem::remove(imgloc.str());
// }
++
iters
;
}
// // copy image
// ostringstream imgrem;
// imgrem << "/net/" << picsInstrumentName << "/users/" << picsUserName << "/offscreenImages/web/" << iters->first
// << "#scan_viewer_plot#" << iters->second << ".png";
//// if (boost::filesystem::exists(imgrem.str()) == true) {
//// cout << "copy file : " << imgrem.str() << " to " << imgloc.str() << endl;
// try {
// boost::filesystem::copy_file(imgrem.str(), imgloc.str());
// boost::filesystem::last_write_time(imgloc.str(), boost::filesystem::last_write_time(imgrem.str()));
// } catch (...) {
//
// }
//// } else {
//// cout << "file doesn't: " << imgrem.str() << endl;
//// }
// ++iters;
// }
// Scans
map
<
std
::
string
,
std
::
string
>::
iterator
itersv
=
scans
.
begin
();
while
(
itersv
!=
scans
.
end
())
{
// cout << "plot : " << itersv->first << " : " << itersv->second << endl;
ostringstream
imgloc
;
imgloc
<<
LOCALPATH
<<
picsInstrumentName
<<
"_"
<<
itersv
->
first
<<
".png"
;
if
(
boost
::
filesystem
::
exists
(
imgloc
.
str
())
==
true
)
{
// cout << "remove file: " << imgloc.str() << endl;
boost
::
filesystem
::
remove
(
imgloc
.
str
());
}
// copy image
ostringstream
imgrem
;
imgrem
<<
"/net/"
<<
picsInstrumentName
<<
"/users/"
<<
picsUserName
<<
"/offscreenImages/web/"
<<
itersv
->
first
<<
"#optimisationParameterizableScan1DPlot#parameterizable_scan_1d.optimisationPlotTitle.png"
;
// if (boost::filesystem::exists(imgrem.str()) == true) {
// cout << "copy file : " << imgrem.str() << " to " << imgloc.str() << endl;
try
{
boost
::
filesystem
::
copy_file
(
imgrem
.
str
(),
imgloc
.
str
());
boost
::
filesystem
::
last_write_time
(
imgloc
.
str
(),
boost
::
filesystem
::
last_write_time
(
imgrem
.
str
()));
}
catch
(...)
{
}
// } else {
// cout << "file doesn't: " << imgrem.str() << endl;
// map<std::string, std::string>::iterator itersv = scans.begin();
// while (itersv != scans.end()) {
//// cout << "plot : " << itersv->first << " : " << itersv->second << endl;
// ostringstream imgloc;
// imgloc << LOCALPATH << picsInstrumentName << "_" << itersv->first << ".png";
// if (boost::filesystem::exists(imgloc.str()) == true) {
//// cout << "remove file: " << imgloc.str() << endl;
// boost::filesystem::remove(imgloc.str());
// }
++
itersv
;
}
// // copy image
// ostringstream imgrem;
// imgrem << "/net/" << picsInstrumentName << "/users/" << picsUserName << "/offscreenImages/web/" << itersv->first
// << "#optimisationParameterizableScan1DPlot#parameterizable_scan_1d.optimisationPlotTitle.png";
//// if (boost::filesystem::exists(imgrem.str()) == true) {
//// cout << "copy file : " << imgrem.str() << " to " << imgloc.str() << endl;
// try {
// boost::filesystem::copy_file(imgrem.str(), imgloc.str());
// boost::filesystem::last_write_time(imgloc.str(), boost::filesystem::last_write_time(imgrem.str()));
// } catch (...) {
//
// }
//// } else {
//// cout << "file doesn't: " << imgrem.str() << endl;
//// }
// ++itersv;
// }
if
(
scanspy
.
empty
()
==
false
)
{
ostringstream
imgloc
;
...
...
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