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
9f4142a9
Commit
9f4142a9
authored
1 year ago
by
Giovanna Lazzari Miotto
Browse files
Options
Downloads
Patches
Plain Diff
Add Rename and Flush functions
parent
15e74a59
No related branches found
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
+24
-1
24 additions, 1 deletion
src/OutputFile.h
with
24 additions
and
1 deletion
src/OutputFile.h
+
24
−
1
View file @
9f4142a9
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include
<atomic>
#include
<atomic>
#include
<cstdint>
#include
<cstdint>
#include
<cstdio>
#include
<cstdio>
#include
<filesystem>
#include
<fstream>
#include
<fstream>
#include
<iostream>
#include
<iostream>
#include
<string>
#include
<string>
...
@@ -14,6 +15,9 @@
...
@@ -14,6 +15,9 @@
#include
<vector>
#include
<vector>
#include
"cmssw/FRDFileHeader_v2.h"
#include
"cmssw/FRDFileHeader_v2.h"
#include
"log.h"
namespace
fs
=
std
::
filesystem
;
class
OutputFile
{
class
OutputFile
{
public:
public:
...
@@ -53,13 +57,32 @@ class OutputFile {
...
@@ -53,13 +57,32 @@ class OutputFile {
}
}
}
}
std
::
string
GetFullPath
()
const
{
return
fs
::
path
(
rundir_
)
/
filepath_
/
fileName_
;
}
void
Rename
(
const
std
::
string
&
new_path
)
const
{
fs
::
path
from
=
GetFullPath
();
fs
::
path
to
=
new_path
;
try
{
fs
::
rename
(
from
,
to
);
}
catch
(
fs
::
filesystem_error
&
err
)
{
LOG
(
FATAL
)
<<
"Error renaming file: "
<<
err
.
what
();
}
}
void
Flush
()
{
if
(
file_
.
is_open
())
{
file_
.
close
();
}
}
void
setFileHeader
(
FRDFileHeader_v2
fileHeader
)
{
fileHeader_
=
fileHeader
;
}
void
setFileHeader
(
FRDFileHeader_v2
fileHeader
)
{
fileHeader_
=
fileHeader
;
}
uint32_t
Lumisection
()
{
return
lumisection_
;
}
uint32_t
Lumisection
()
{
return
lumisection_
;
}
uint32_t
Index
()
{
return
index_
;
}
uint32_t
Index
()
{
return
index_
;
}
private
:
private
:
FILE
*
file
Ptr
_
;
std
::
string
file
path
_
;
std
::
string
fileName_
;
std
::
string
fileName_
;
FRDFileHeader_v2
fileHeader_
;
FRDFileHeader_v2
fileHeader_
;
uint32_t
lumisection_
;
uint32_t
lumisection_
;
...
...
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