Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cbmroot
Manage
Activity
Members
Labels
Plan
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Computing
cbmroot
Commits
e1583f36
Commit
e1583f36
authored
3 years ago
by
Sergei Zharko
Browse files
Options
Downloads
Patches
Plain Diff
L1Algo core: featuring L1Assert
parent
61a9f408
No related branches found
No related tags found
1 merge request
!796
L1Algo interface and tools: updates
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
reco/L1/L1Algo/L1Algo.h
+9
-0
9 additions, 0 deletions
reco/L1/L1Algo/L1Algo.h
reco/L1/L1Algo/L1Assert.h
+53
-0
53 additions, 0 deletions
reco/L1/L1Algo/L1Assert.h
with
62 additions
and
0 deletions
reco/L1/L1Algo/L1Algo.h
+
9
−
0
View file @
e1583f36
...
...
@@ -37,7 +37,16 @@ class L1AlgoDraw;
//#define MERGE_CLONES
/*********************************************************************************
************ TEMPORARY MACROS, SHOULD BE REMOVED (TODO!!, S. Zharko) ***********
* */
#define FEATURING_L1ALGO_INIT 1 // If defined, new initialization will be used, if not - the old one
// Macro: 1 - new track finder loop, other - old track finder loop
#define FEATURING_L1ALGO_CATRACKFINDER_ITERATIONLOOP 1
/* *
*********************************************************************************/
#include
<array>
#include
<iomanip>
...
...
This diff is collapsed.
Click to expand it.
reco/L1/L1Algo/L1Assert.h
0 → 100644
+
53
−
0
View file @
e1583f36
/* Copyright (C) 2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Sergey Gorbunov, Sergei Zharko [committer] */
/// @file L1Assert.h
/// @author Sergei Zharko
/// @date 22.02.2022
/// @brief Level-defined assertion functionality
///
/// This file provides level-dependent assertion mechanism. Two defined macros L1ASSERT(LEVEL, COND)
/// and L1MASSERT(LEVEL, COND, MSG), which will do the assertion for LEVEL >= L1Assert::kAssertionLevel
/// and skip it otherwise. When L1ASSERT(LEVEL, COND) is called the COND expression is printed on the screen.
/// When L
#ifndef L1Assert_h
#define L1Assert_h 1
#include
"FairLogger.h"
#if defined(NDEBUG) || defined(L1_NO_ASSERT)
#define L1ASSERT(LEVEL, COND)
#define L1MASSERT(LEVEL, COND, MSG)
#else
#define L1ASSERT(LEVEL, COND) L1Assert::DoAssertion<(LEVEL) >= L1Assert::kAssertionLevel>((LEVEL), (COND), (#COND), __FILE__, __LINE__)
#define L1MASSERT(LEVEL, COND, MSG) L1Assert::DoAssertion<(LEVEL) >= L1Assert::kAssertionLevel>((LEVEL), (COND), (MSG), __FILE__, __LINE__)
#endif // defined(NDEBUG) || defined(L1_NO_ASSERT)
namespace
L1Assert
{
constexpr
int
kAssertionLevel
{
1
};
/// Basic template function. Usage: place "level >= L1Assert::kAssertionLevel"
template
<
bool
IsAsserted
>
int
DoAssertion
(
int
level
,
bool
condition
,
const
char
*
msg
,
const
char
*
fileName
,
int
lineNo
);
/// Specialization in case of IsAsserted = true, i.e. the assertion is made
template
<
>
int
DoAssertion
<
true
>
(
int
level
,
bool
condition
,
const
char
*
msg
,
const
char
*
fileName
,
int
lineNo
)
{
if
(
!
condition
)
{
LOG
(
fatal
)
<<
"Level "
<<
level
<<
" assertion failed: "
<<
msg
<<
" ("
<<
fileName
<<
" : "
<<
lineNo
<<
")
\n
"
;
//std::abort(); // Do we need it with LOG(fatal)?
}
return
1
;
}
/// Specialization in case of IsAsserted = false, i.e. the assertion is not made
template
<
>
int
DoAssertion
<
false
>
(
int
level
,
bool
condition
,
const
char
*
msg
,
const
char
*
fileName
,
int
lineNo
)
{
return
0
};
};
#endif // L1Assert_h
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