Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jens Krüger
Lima
Commits
7153b8a5
Commit
7153b8a5
authored
Sep 23, 2013
by
Sebastien Petitdemange
Committed by
Alejandro Homs Puron
Sep 24, 2013
Browse files
Add missing code for roi2spectrum
parent
fb51107a
Changes
3
Hide whitespace changes
Inline
Side-by-side
control/software_operation/sip/SoftOpExternalMgr.sip
View file @
7153b8a5
...
...
@@ -59,15 +59,19 @@ sipRes = aReturnListPt;
SIP_PYOBJECT addOp(SoftOpId,const alias&,int stage);
%MethodCode
SoftOpInstance anInstance;
TRY
sipCpp->addOp(a0,*a1,a2,anInstance);
INSTANCE_2_SoftOp
CATCH
%End
void delOp(const alias&);
SIP_PYOBJECT getOpClass(const alias&) const;
%MethodCode
SoftOpInstance anInstance;
TRY
sipCpp->getOpClass(*a0,anInstance);
INSTANCE_2_SoftOp
CATCH
%End
void setEndLinkTaskCallback(TaskEventCallback *aCbk);
...
...
@@ -115,5 +119,17 @@ INSTANCE_2_SoftOp
Py_INCREF(Py_None); \
sipRes = Py_None; \
}
#define TRY try \
{
#define CATCH \
} \
catch(Exception &exp) \
{ \
const std::string& tmpString = exp.getErrMsg(); \
const char *detail = tmpString.c_str(); \
PyErr_SetString(sipException_Exception, detail); \
return NULL; \
}
%End
};
control/software_operation/src/SoftOpExternalMgr.cpp
View file @
7153b8a5
...
...
@@ -30,6 +30,7 @@ static SoftOpKey SoftOpTable[] = {
SoftOpKey
(
FLIP
,
"Flip"
),
SoftOpKey
(
MASK
,
"Mask"
),
SoftOpKey
(
ROICOUNTERS
,
"Roi counters"
),
SoftOpKey
(
ROI2SPECTRUM
,
"Roi 2 spectrum"
),
SoftOpKey
(
SOFTROI
,
"Software roi"
),
SoftOpKey
(
USER_LINK_TASK
,
"User link task"
),
SoftOpKey
(
USER_SINK_TASK
,
"User sink task"
),
...
...
@@ -136,6 +137,9 @@ void SoftOpExternalMgr::addOp(SoftOpId aSoftOpId,
newInstance
.
m_opt
=
new
SoftOpMask
();
newInstance
.
m_linkable
=
true
;
break
;
case
ROI2SPECTRUM
:
newInstance
.
m_opt
=
new
SoftOpRoi2Spectrum
();
break
;
case
SOFTROI
:
newInstance
.
m_opt
=
new
SoftOpSoftRoi
();
newInstance
.
m_linkable
=
true
;
...
...
@@ -148,7 +152,7 @@ void SoftOpExternalMgr::addOp(SoftOpId aSoftOpId,
newInstance
.
m_opt
=
new
SoftUserSinkTask
();
break
;
default:
throw
LIMA
_CTL_E
XC
(
InvalidValue
,
"Not yet managed"
)
;
THROW
_CTL_E
RROR
(
InvalidValue
)
<<
"Not yet managed"
;
}
std
::
pair
<
Stage2Instance
::
iterator
,
bool
>
aResult
=
m_stage2instance
.
insert
(
std
::
pair
<
stage
,
std
::
list
<
SoftOpInstance
>
>
(
aStage
,
std
::
list
<
SoftOpInstance
>
()));
...
...
@@ -269,6 +273,7 @@ void SoftOpExternalMgr::_checkIfPossible(SoftOpId aSoftOpId,
case
ROICOUNTERS
:
case
BPM
:
case
USER_SINK_TASK
:
case
ROI2SPECTRUM
:
break
;
// always possible
case
BACKGROUNDSUBSTRACTION
:
case
BINNING
:
...
...
@@ -280,7 +285,7 @@ void SoftOpExternalMgr::_checkIfPossible(SoftOpId aSoftOpId,
checkLinkable
=
true
;
break
;
default:
throw
LIMA
_CTL_E
XC
(
InvalidValue
,
"Not yet managed"
)
;
THROW
_CTL_E
RROR
(
InvalidValue
)
<<
"Not yet managed"
;
}
DEB_TRACE
()
<<
DEB_VAR1
(
checkLinkable
);
...
...
@@ -298,7 +303,7 @@ void SoftOpExternalMgr::_checkIfPossible(SoftOpId aSoftOpId,
char
buffer
[
256
];
snprintf
(
buffer
,
sizeof
(
buffer
),
"%s task %s is already active on that level"
,
k
->
m_key
.
m_name
,
k
->
m_alias
.
c_str
());
throw
LIMA
_CTL_E
XC
(
Error
,
buffer
)
;
THROW
_CTL_E
RROR
(
Error
)
<<
buffer
;
}
}
}
...
...
control/software_operation/src/SoftOpId.cpp
View file @
7153b8a5
...
...
@@ -418,7 +418,7 @@ void SoftOpRoi2Spectrum::del(const std::list<int> &roiIds)
AutoMutex
aLock
(
m_cond
.
mutex
());
std
::
list
<
int
>::
iterator
i
=
aTmpList
.
begin
();
std
::
list
<
ManagerNCounter
>::
iterator
k
=
m_manager_tasks
.
begin
();
for
(
int
index
=
1
;
i
!=
aTmpList
.
end
()
&&
k
!=
m_manager_tasks
.
end
();
++
i
)
for
(
int
index
=
0
;
i
!=
aTmpList
.
end
()
&&
k
!=
m_manager_tasks
.
end
();
++
i
)
{
while
(
index
!=
*
i
&&
k
!=
m_manager_tasks
.
end
())
++
k
,
++
index
;
...
...
@@ -456,7 +456,7 @@ void SoftOpRoi2Spectrum::getRoiMode(std::list<int> &aReturnList) const
void
SoftOpRoi2Spectrum
::
setRoiMode
(
int
roiId
,
int
mode
)
{
AutoMutex
aLock
(
m_cond
.
mutex
());
int
rId
=
1
;
int
rId
=
0
;
for
(
std
::
list
<
ManagerNCounter
>::
const_iterator
i
=
m_manager_tasks
.
begin
();
i
!=
m_manager_tasks
.
end
();
++
i
,
++
rId
)
{
...
...
@@ -514,7 +514,7 @@ void SoftOpRoi2Spectrum::getBufferSize(int &size) const
void
SoftOpRoi2Spectrum
::
readCounters
(
int
from
,
std
::
list
<
RoiIdAndResults
>
&
result
)
const
{
AutoMutex
aLock
(
m_cond
.
mutex
());
int
roiIndex
=
1
;
int
roiIndex
=
0
;
for
(
std
::
list
<
ManagerNCounter
>::
const_iterator
i
=
m_manager_tasks
.
begin
();
i
!=
m_manager_tasks
.
end
();
++
i
,
++
roiIndex
)
{
...
...
@@ -527,7 +527,7 @@ void SoftOpRoi2Spectrum::readCounters(int from,std::list<RoiIdAndResults> &resul
void
SoftOpRoi2Spectrum
::
createImage
(
int
roiId
,
int
&
from
,
Data
&
aData
)
const
{
AutoMutex
aLock
(
m_cond
.
mutex
());
int
roiIndex
=
1
;
int
roiIndex
=
0
;
for
(
std
::
list
<
ManagerNCounter
>::
const_iterator
i
=
m_manager_tasks
.
begin
();
i
!=
m_manager_tasks
.
end
();
++
i
,
++
roiIndex
)
{
...
...
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