Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
scdaq
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
scouting-demonstrator
scdaq
Commits
9c2fefe3
Commit
9c2fefe3
authored
1 year ago
by
Giovanna Lazzari Miotto
Browse files
Options
Downloads
Patches
Plain Diff
OutputFile: Add new constructors
parent
9f4142a9
No related branches found
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/OutputFile.h
+52
-2
52 additions, 2 deletions
src/OutputFile.h
with
52 additions
and
2 deletions
src/OutputFile.h
+
52
−
2
View file @
9c2fefe3
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include
<fstream>
#include
<fstream>
#include
<iostream>
#include
<iostream>
#include
<string>
#include
<string>
#include
<string_view>
#include
<thread>
#include
<thread>
#include
<utility>
#include
<utility>
#include
<vector>
#include
<vector>
...
@@ -29,11 +30,57 @@ class OutputFile {
...
@@ -29,11 +30,57 @@ class OutputFile {
lumisection_
(
lumisection
),
lumisection_
(
lumisection
),
index_
(
index
),
index_
(
index
),
rundir_
(
rundir
)
{}
rundir_
(
rundir
)
{}
OutputFile
()
:
filePtr_
(
NULL
),
fileName_
(
""
),
fileHeader_
(
0
,
0
,
0
,
0
,
0
,
0
)
{}
OutputFile
()
:
filePtr_
(
NULL
),
fileName_
(
""
),
fileHeader_
(
0
,
0
,
0
,
0
,
0
,
0
)
{}
OutputFile
(
std
::
string_view
filepath
,
std
::
string_view
filename
,
std
::
string_view
run_dir
,
FRDFileHeader_v2
&
header
,
uint32_t
num_lumisection
,
uint32_t
file_index
)
:
filepath_
(
filepath
),
fileName_
(
filename
),
rundir_
(
run_dir
),
fileHeader_
(
header
),
lumisection_
(
num_lumisection
),
index_
(
file_index
),
file_
(
filepath_
+
"/"
+
fileName_
,
std
::
fstream
::
out
|
std
::
fstream
::
binary
)
{
// try {
// fstream(filepath_ + "/" + fileName_, ios::out | ios::binary);
// } catch (std::exception &e) {
// LOG(FATAL) << "Could not open file: " << filepath_ + "/" + fileName_
// << ", exception: " << e.what();
// }
}
OutputFile
(
const
OutputFile
&
)
=
delete
;
// Delete copy constructor
OutputFile
&
operator
=
(
const
OutputFile
&
)
=
delete
;
// Delete copy assignment operator
OutputFile
(
OutputFile
&&
other
)
noexcept
:
filepath_
(
std
::
move
(
other
.
filepath_
)),
fileName_
(
std
::
move
(
other
.
fileName_
)),
rundir_
(
std
::
move
(
other
.
rundir_
)),
fileHeader_
(
std
::
move
(
other
.
fileHeader_
)),
lumisection_
(
other
.
lumisection_
),
index_
(
other
.
index_
)
{
file_
=
std
::
move
(
other
.
file_
);
}
OutputFile
&
operator
=
(
OutputFile
&&
other
)
noexcept
{
if
(
this
!=
&
other
)
{
filepath_
=
std
::
move
(
other
.
filepath_
);
fileName_
=
std
::
move
(
other
.
fileName_
);
rundir_
=
std
::
move
(
other
.
rundir_
);
fileHeader_
=
std
::
move
(
other
.
fileHeader_
);
lumisection_
=
other
.
lumisection_
;
index_
=
other
.
index_
;
file_
=
std
::
move
(
other
.
file_
);
}
return
*
this
;
}
std
::
string
getFileName
()
{
return
fileName_
;
}
std
::
string
getFileName
()
{
return
fileName_
;
}
FILE
*
getFilePtr
()
{
return
filePtr_
;
}
FILE
*
getFilePtr
()
{
return
filePtr_
;
}
FRDFileHeader_v2
getFileHeader
()
{
return
fileHeader_
;
}
FRDFileHeader_v2
getFileHeader
()
{
return
fileHeader_
;
}
std
::
string
getRunDir
()
{
return
rundir_
;
}
std
::
string
getRunDir
()
{
return
rundir_
;
}
bool
writeFileHeader
()
{
bool
writeFileHeader
()
{
fseek
(
filePtr_
,
0
,
SEEK_SET
);
fseek
(
filePtr_
,
0
,
SEEK_SET
);
size_t
written
=
fwrite
(
&
fileHeader_
,
1
,
sizeof
(
fileHeader_
),
filePtr_
);
size_t
written
=
fwrite
(
&
fileHeader_
,
1
,
sizeof
(
fileHeader_
),
filePtr_
);
...
@@ -84,10 +131,13 @@ class OutputFile {
...
@@ -84,10 +131,13 @@ class OutputFile {
private
:
private
:
std
::
string
filepath_
;
std
::
string
filepath_
;
std
::
string
fileName_
;
std
::
string
fileName_
;
std
::
string
rundir_
;
uint32_t
index_
;
FRDFileHeader_v2
fileHeader_
;
FRDFileHeader_v2
fileHeader_
;
uint32_t
lumisection_
;
uint32_t
lumisection_
;
uint32_t
index_
;
std
::
string
rundir_
;
std
::
fstream
file_
;
FILE
*
filePtr_
;
};
};
#endif
#endif
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