Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hcana
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Whitney Armstrong
hcana
Commits
ba9c177c
Commit
ba9c177c
authored
5 years ago
by
Chao Peng
Browse files
Options
Downloads
Patches
Plain Diff
Adjust CMakeList to correctly include libHallC
parent
c125a5e7
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/PRadETChannel.cxx
+1
-2
1 addition, 2 deletions
src/PRadETChannel.cxx
tools/CMakeLists.txt
+1
-0
1 addition, 0 deletions
tools/CMakeLists.txt
tools/et_feeder.cpp
+46
-7
46 additions, 7 deletions
tools/et_feeder.cpp
tools/et_producer.cpp
+2
-2
2 additions, 2 deletions
tools/et_producer.cpp
with
50 additions
and
11 deletions
src/PRadETChannel.cxx
+
1
−
2
View file @
ba9c177c
...
@@ -36,8 +36,7 @@ PRadETChannel::~PRadETChannel()
...
@@ -36,8 +36,7 @@ PRadETChannel::~PRadETChannel()
// Close ET connection
// Close ET connection
void
PRadETChannel
::
ForceClose
()
void
PRadETChannel
::
ForceClose
()
{
{
if
(
et_id
!=
nullptr
&&
et_alive
(
et_id
))
if
((
et_id
!=
nullptr
)
&&
et_alive
(
et_id
))
{
{
et_forcedclose
(
et_id
);
et_forcedclose
(
et_id
);
et_id
=
nullptr
;
et_id
=
nullptr
;
}
}
...
...
This diff is collapsed.
Click to expand it.
tools/CMakeLists.txt
+
1
−
0
View file @
ba9c177c
...
@@ -20,6 +20,7 @@ foreach(exe_src ${APP_SOURCES})
...
@@ -20,6 +20,7 @@ foreach(exe_src ${APP_SOURCES})
target_link_libraries
(
${
exe
}
target_link_libraries
(
${
exe
}
PUBLIC
PUBLIC
${
PROJECT_NAME
}
::HallC
Podd::Podd
Podd::Podd
Podd::Decode
Podd::Decode
coda_et::coda_et
coda_et::coda_et
...
...
This diff is collapsed.
Click to expand it.
tools/et_feeder.cpp
+
46
−
7
View file @
ba9c177c
...
@@ -2,8 +2,21 @@
...
@@ -2,8 +2,21 @@
#include
"PRadETChannel.h"
#include
"PRadETChannel.h"
#include
"et.h"
#include
"et.h"
#include
"evio.h"
#include
"evio.h"
#include
<csignal>
#include
<thread>
#include
<chrono>
#include
<iostream>
#define PROGRESS_COUNT 1000
using
namespace
std
::
chrono
;
volatile
std
::
sig_atomic_t
gSignalStatus
;
void
signal_handler
(
int
signal
)
{
gSignalStatus
=
signal
;
}
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
...
@@ -14,15 +27,15 @@ int main(int argc, char* argv[])
...
@@ -14,15 +27,15 @@ int main(int argc, char* argv[])
conf_opt
.
AddOpt
(
ConfigOption
::
arg_require
,
'h'
);
conf_opt
.
AddOpt
(
ConfigOption
::
arg_require
,
'h'
);
conf_opt
.
AddOpt
(
ConfigOption
::
arg_require
,
'p'
);
conf_opt
.
AddOpt
(
ConfigOption
::
arg_require
,
'p'
);
conf_opt
.
AddOpt
(
ConfigOption
::
arg_require
,
'f'
);
conf_opt
.
AddOpt
(
ConfigOption
::
arg_require
,
'f'
);
conf_opt
.
AddOpt
(
ConfigOption
::
arg_require
,
'
r
'
);
conf_opt
.
AddOpt
(
ConfigOption
::
arg_require
,
'
i
'
);
conf_opt
.
SetDesc
(
"usage: %0 <data_file>"
);
conf_opt
.
SetDesc
(
"usage: %0 <data_file>"
);
conf_opt
.
SetDesc
(
'h'
,
"host address of the ET system, default
\"
localhost
\"
."
);
conf_opt
.
SetDesc
(
'h'
,
"host address of the ET system, default
\"
localhost
\"
."
);
conf_opt
.
SetDesc
(
'p'
,
"port to connect, default 11111."
);
conf_opt
.
SetDesc
(
'p'
,
"port to connect, default 11111."
);
conf_opt
.
SetDesc
(
'f'
,
"memory mapped et file, default
\"
/tmp/et_feeder
\"
."
);
conf_opt
.
SetDesc
(
'f'
,
"memory mapped et file, default
\"
/tmp/et_feeder
\"
."
);
conf_opt
.
SetDesc
(
'
r
'
,
"
rate
in mili
-
seconds to write data, default
\"
10
\"
"
);
conf_opt
.
SetDesc
(
'
i
'
,
"
interval
in mil
l
iseconds to write data, default
\"
10
\"
"
);
if
(
!
conf_opt
.
ParseArgs
(
argc
,
argv
)
||
conf_opt
.
NbofArgs
()
!=
2
)
{
if
(
!
conf_opt
.
ParseArgs
(
argc
,
argv
)
||
conf_opt
.
NbofArgs
()
!=
1
)
{
std
::
cout
<<
conf_opt
.
GetInstruction
()
<<
std
::
endl
;
std
::
cout
<<
conf_opt
.
GetInstruction
()
<<
std
::
endl
;
return
-
1
;
return
-
1
;
}
}
...
@@ -30,7 +43,7 @@ int main(int argc, char* argv[])
...
@@ -30,7 +43,7 @@ int main(int argc, char* argv[])
std
::
string
host
=
"localhost"
;
std
::
string
host
=
"localhost"
;
int
port
=
11111
;
int
port
=
11111
;
std
::
string
etf
=
"/tmp/et_feeder"
;
std
::
string
etf
=
"/tmp/et_feeder"
;
float
rate
=
10
.
;
int
interval
=
10
;
for
(
auto
&
opt
:
conf_opt
.
GetOptions
())
{
for
(
auto
&
opt
:
conf_opt
.
GetOptions
())
{
switch
(
opt
.
mark
)
{
switch
(
opt
.
mark
)
{
...
@@ -43,13 +56,39 @@ int main(int argc, char* argv[])
...
@@ -43,13 +56,39 @@ int main(int argc, char* argv[])
case
'f'
:
case
'f'
:
etf
=
opt
.
var
.
String
();
etf
=
opt
.
var
.
String
();
break
;
break
;
case
'
r
'
:
case
'
i
'
:
rate
=
opt
.
var
.
Floa
t
();
interval
=
opt
.
var
.
In
t
();
break
;
break
;
default
:
default
:
std
::
cout
<<
conf_opt
.
GetInstruction
()
<<
std
::
endl
;
std
::
cout
<<
conf_opt
.
GetInstruction
()
<<
std
::
endl
;
return
-
1
;
return
-
1
;
}
}
}
}
auto
ch
=
new
PRadETChannel
();
try
{
ch
->
Open
(
host
.
c_str
(),
port
,
etf
.
c_str
());
ch
->
NewStation
(
"Data Feeder"
);
ch
->
AttachStation
();
}
catch
(
PRadException
e
)
{
std
::
cerr
<<
e
.
FailureType
()
<<
": "
<<
e
.
FailureDesc
()
<<
std
::
endl
;
return
-
1
;
}
// install signal handler
std
::
signal
(
SIGINT
,
signal_handler
);
while
(
true
)
{
if
(
gSignalStatus
==
SIGINT
)
{
std
::
cout
<<
"Received control-C, exiting..."
<<
std
::
endl
;
ch
->
ForceClose
();
break
;
}
system_clock
::
time_point
start
(
system_clock
::
now
());
system_clock
::
time_point
next
(
start
+
std
::
chrono
::
milliseconds
(
interval
));
std
::
this_thread
::
sleep_until
(
next
);
}
return
0
;
}
}
This diff is collapsed.
Click to expand it.
tools/et_producer.cpp
+
2
−
2
View file @
ba9c177c
...
@@ -614,10 +614,10 @@ static void * signal_thread (void *arg) {
...
@@ -614,10 +614,10 @@ static void * signal_thread (void *arg) {
sigset_t
signal_set
;
sigset_t
signal_set
;
int
sig_number
;
int
sig_number
;
sigemptyset
(
&
signal_set
);
sigemptyset
(
&
signal_set
);
sigaddset
(
&
signal_set
,
SIGINT
);
sigaddset
(
&
signal_set
,
SIGINT
);
/* Not necessary to clean up as ET system will do it */
/* Not necessary to clean up as ET system will do it */
sigwait
(
&
signal_set
,
&
sig_number
);
sigwait
(
&
signal_set
,
&
sig_number
);
printf
(
"Got control-C, exiting
\n
"
);
printf
(
"Got control-C, exiting
\n
"
);
...
...
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