Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jens Krüger
Lima
Commits
181c9dea
Commit
181c9dea
authored
Oct 24, 2012
by
Sebastien Petitdemange
Browse files
Pilatus code refactoring
parent
ccaf48f1
Changes
4
Hide whitespace changes
Inline
Side-by-side
tango
@
ab45b47b
Compare
9a9f9d76
...
ab45b47b
Subproject commit
9a9f9d76d02690f9de3ac098634d7e8ae5062fcc
Subproject commit
ab45b47b45a9a4130ef7ad9ef9f83cc2e795499b
pilatus
@
f62bc46b
Compare
f299a6de
...
f62bc46b
Subproject commit f
299a6dec9a5662792011c7bcb76f59b662ce7d7
Subproject commit f
62bc46bb4dbca5be759cc3901277e3521ca5bee
hardware/include/HwFileEventMgr.h
View file @
181c9dea
...
...
@@ -33,12 +33,14 @@ namespace lima
class
HwFileEventCallbackHelper
:
public
DirectoryEvent
::
Callback
{
public:
enum
CallFrom
{
Acquisition
,
OnDemand
};
class
Callback
{
public:
virtual
void
prepare
(
const
DirectoryEvent
::
Parameters
&
)
{}
virtual
bool
getFrameInfo
(
int
image_number
,
const
char
*
full_path
,
HwFrameInfoType
&
)
=
0
;
CallFrom
,
HwFrameInfoType
&
)
=
0
;
virtual
bool
newFrameReady
(
const
HwFrameInfoType
&
)
=
0
;
};
...
...
@@ -49,6 +51,7 @@ namespace lima
int
&
next_file_number_expected
)
throw
();
virtual
bool
newFile
(
int
file_number
,
const
char
*
full_path
)
throw
();
int
getNbOfFramePending
()
const
{
return
m_pending_frame_infos
.
size
();}
private:
typedef
std
::
map
<
int
,
HwFrameInfoType
>
DatasPendingType
;
...
...
@@ -63,7 +66,10 @@ namespace lima
class
Callback
{
public:
virtual
void
prepare
(
const
DirectoryEvent
::
Parameters
&
)
{}
virtual
bool
getFrameInfo
(
int
image_number
,
const
char
*
full_path
,
HwFileEventCallbackHelper
::
CallFrom
,
HwFrameInfoType
&
)
=
0
;
virtual
void
getFrameDim
(
FrameDim
&
frame_dim
)
=
0
;
};
...
...
@@ -80,6 +86,8 @@ namespace lima
bool
isStopped
()
const
;
int
getLastAcquiredFrame
()
const
;
int
getNbOfFramePending
()
const
{
return
m_directory_cbk
.
getNbOfFramePending
();}
//methodes used by Lima core
virtual
void
setFrameDim
(
const
FrameDim
&
frame_dim
);
virtual
void
getFrameDim
(
FrameDim
&
frame_dim
);
...
...
@@ -105,6 +113,7 @@ namespace lima
friend
class
_CBK
;
int
_calcNbMaxImages
();
bool
_getFrameInfo
(
int
image_number
,
const
char
*
full_path
,
HwFileEventCallbackHelper
::
CallFrom
,
HwFrameInfoType
&
frame_info
);
std
::
string
m_tmpfs_path
;
...
...
hardware/src/HwFileEventMgr.cpp
View file @
181c9dea
...
...
@@ -47,8 +47,9 @@ bool HwFileEventCallbackHelper::nextFileExpected(int file_number,
bool
continueFlag
=
true
;
try
{
continueFlag
=
m_cbk
.
getFrameInfo
(
file_number
,
full_path
,
aNewFrameInfo
);
bool
continueAcq
=
!
m_cbk
.
newFrameReady
(
aNewFrameInfo
);
continueFlag
=
m_cbk
.
getFrameInfo
(
file_number
,
full_path
,
Acquisition
,
aNewFrameInfo
);
bool
continueAcq
=
m_cbk
.
newFrameReady
(
aNewFrameInfo
);
if
(
continueFlag
)
continueFlag
=
continueAcq
;
DatasPendingType
::
iterator
i
=
m_pending_frame_infos
.
begin
();
while
(
i
!=
m_pending_frame_infos
.
end
()
&&
continueFlag
)
...
...
@@ -82,7 +83,9 @@ bool HwFileEventCallbackHelper::newFile(int file_number,const char *full_path) t
try
{
HwFrameInfoType
aNewFrameInfo
;
continueFlag
=
m_cbk
.
getFrameInfo
(
file_number
,
full_path
,
aNewFrameInfo
);
continueFlag
=
m_cbk
.
getFrameInfo
(
file_number
,
full_path
,
Acquisition
,
aNewFrameInfo
);
m_pending_frame_infos
[
file_number
]
=
aNewFrameInfo
;
}
catch
(...)
...
...
@@ -119,12 +122,14 @@ public:
unlink
(
fullPath
);
}
closedir
(
aWatchDir
);
}
}
m_cnt
.
m_cbk
.
prepare
(
params
);
}
virtual
bool
getFrameInfo
(
int
image_number
,
const
char
*
full_path
,
HwFileEventCallbackHelper
::
CallFrom
mode
,
HwFrameInfoType
&
frame_info
)
{
return
m_cnt
.
_getFrameInfo
(
image_number
,
full_path
,
frame_info
);
return
m_cnt
.
_getFrameInfo
(
image_number
,
full_path
,
mode
,
frame_info
);
}
virtual
bool
newFrameReady
(
const
HwFrameInfoType
&
frame_info
)
{
...
...
@@ -271,14 +276,16 @@ void HwTmpfsBufferMgr::getStartTimestamp(Timestamp& start_ts)
void
HwTmpfsBufferMgr
::
getFrameInfo
(
int
acq_frame_nb
,
HwFrameInfoType
&
info
)
{
DEB_MEMBER_FUNCT
();
DEB_MEMBER_FUNCT
();
char
filename
[
1024
];
snprintf
(
filename
,
sizeof
(
filename
),
m_file_pattern
.
c_str
(),
acq_frame_nb
);
std
::
string
fullPath
=
m_tmpfs_path
+
"/"
;
fullPath
+=
filename
;
m_cbk
.
getFrameInfo
(
acq_frame_nb
,
fullPath
.
c_str
(),
info
);
char
filename
[
1024
];
snprintf
(
filename
,
sizeof
(
filename
),
m_file_pattern
.
c_str
(),
acq_frame_nb
);
std
::
string
fullPath
=
m_tmpfs_path
+
"/"
;
fullPath
+=
filename
;
m_cbk
.
getFrameInfo
(
acq_frame_nb
,
fullPath
.
c_str
(),
HwFileEventCallbackHelper
::
OnDemand
,
info
);
}
void
HwTmpfsBufferMgr
::
registerFrameCallback
(
HwFrameCallback
&
frame_cb
)
...
...
@@ -309,7 +316,8 @@ int HwTmpfsBufferMgr::_calcNbMaxImages()
}
bool
HwTmpfsBufferMgr
::
_getFrameInfo
(
int
image_number
,
const
char
*
full_path
,
HwFileEventCallbackHelper
::
CallFrom
mode
,
HwFrameInfoType
&
frame_info
)
{
return
m_cbk
.
getFrameInfo
(
image_number
,
full_path
,
frame_info
);
return
m_cbk
.
getFrameInfo
(
image_number
,
full_path
,
mode
,
frame_info
);
}
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