Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadSpecialModules
Commits
32ffaa18
Commit
32ffaa18
authored
Mar 04, 2019
by
Cristina Cocho
Browse files
Merge branch 'master' of
https://code.ill.fr/instrument-control/nomad-special-modules
parents
2e02ba8b
d85bf203
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/controllers/nomad3d/Module.xml
0 → 100644
View file @
32ffaa18
<module
name=
"nomad3d"
>
<controller
class=
"nomad3d::Nomad3DController"
/>
<include
path=
"$(NOMAD_HOME)/../NomadModules/src"
/>
</module>
src/controllers/nomad3d/Nomad3DController.cpp
0 → 100644
View file @
32ffaa18
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include "controllers/common/family/Families.h"
#include "contrib/rapidjson/document.h"
#include "contrib/rapidjson/reader.h"
#include "contrib/rapidjson/writer.h"
#include "contrib/rapidjson/prettywriter.h"
#include "Nomad3DController.h"
#include "InstrumentManager/InstrumentManager.h"
using
namespace
boost
;
using
namespace
std
;
using
namespace
rapidjson
;
namespace
nomad3d
{
const
string
Nomad3DController
::
TYPE
=
"nomad3d_controller"
;
Nomad3DController
::
Nomad3DController
(
const
string
&
name
)
:
ExperimentController
(
name
),
controller
::
Init
(
this
)
{
setFamily
(
family
::
HIDDEN
);
axisPositions
.
init
(
this
,
NOSAVE
,
"axis_positions"
);
}
Nomad3DController
::
Nomad3DController
(
const
Nomad3DController
&
controller
)
:
ExperimentController
(
controller
)
{
}
Nomad3DController
::~
Nomad3DController
()
{
}
void
Nomad3DController
::
postConfiguration
()
{
}
void
Nomad3DController
::
init
()
{
map
<
string
,
ExperimentController
*>
experimentControllersMap
=
InstrumentManager
::
getInstance
()
->
getAllInstalledExperimentControllersMap
();
map
<
string
,
ExperimentController
*>::
iterator
it
;
int
i
=
0
;
for
(
it
=
experimentControllersMap
.
begin
();
it
!=
experimentControllersMap
.
end
();
it
++
)
{
if
(
dynamic_cast
<
axis
::
AxisController
*>
(
it
->
second
)
!=
0
)
{
axis
::
AxisController
*
controller
=
dynamic_cast
<
axis
::
AxisController
*>
(
it
->
second
);
controller
->
attach
(
this
);
//Attach it to in order to be able to receive propertyChanged events.
m_axisControllers
.
push_back
(
controller
);
registerUpdater
(
controller
->
position
,
&
Nomad3DController
::
updateActualPosition
,
this
,
i
);
++
i
;
}
}
updateActualPosition
(
0
);
}
void
Nomad3DController
::
updateActualPosition
(
int32
i
)
{
PrettyWriter
<
StringBuffer
>
writer
(
s
);
s
.
Clear
();
writer
.
StartObject
();
for
(
auto
controller
:
m_axisControllers
)
{
writer
.
Key
(
controller
->
getName
().
c_str
());
writer
.
Double
(
controller
->
position
()
-
controller
->
position
.
offset
());
}
writer
.
EndObject
();
axisPositions
=
s
.
GetString
();
}
}
src/controllers/nomad3d/Nomad3DController.h
0 → 100644
View file @
32ffaa18
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#ifndef NOMAD3D_NOMAD3DCONTROLLER_H
#define NOMAD3D_NOMAD3DCONTROLLER_H
#include "controllers/common/axis/AxisController.h"
#include "contrib/rapidjson/stringbuffer.h"
#include <memory>
namespace
nomad3d
{
/**
* Class defining a controller for Nomad3D. The positions passed to the client integrate the offset.
*/
class
Nomad3DController
:
public
ExperimentController
,
public
controller
::
Init
{
public:
//! Type of controller
static
const
std
::
string
TYPE
;
Nomad3DController
(
const
std
::
string
&
name
);
Nomad3DController
(
const
Nomad3DController
&
controller
);
virtual
~
Nomad3DController
();
virtual
void
postConfiguration
();
virtual
void
init
();
void
updateActualPosition
(
int32
i
);
private:
std
::
vector
<
axis
::
AxisController
*>
m_axisControllers
;
Property
<
std
::
string
>
axisPositions
;
rapidjson
::
StringBuffer
s
;
};
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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