Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
shared_cpp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
monticore
EmbeddedMontiArc
simulators
shared_cpp
Commits
4ed98ea7
Commit
4ed98ea7
authored
May 20, 2021
by
Jean Meurice
Browse files
Options
Downloads
Patches
Plain Diff
added "err_out"
parent
5b49cc13
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
err_out/err_out.h
+27
-0
27 additions, 0 deletions
err_out/err_out.h
err_out/standalone_err_out.cpp
+28
-0
28 additions, 0 deletions
err_out/standalone_err_out.cpp
with
55 additions
and
0 deletions
err_out/err_out.h
0 → 100644
+
27
−
0
View file @
4ed98ea7
#pragma once
/*
This header should be used as an abstraction in an autopilot in order to:
- throw errors
- print error messages (cerr)
- print information messages (cout)
The goal is that the hardware_emulator can substitute its own function calls (dynamically loaded)
in order to properly transmit messages and errors from the autopilot.
In order to use the different implementations (standalone_err_out.cpp, ...) the correct file has to be compiled into the autopilot.
*/
#ifdef __cplusplus
extern
"C"
{
#endif
void
throw_error
(
const
char
*
type
,
const
char
*
message
);
void
print_cout
(
const
char
*
message
);
void
print_cerr
(
const
char
*
message
);
#ifdef __cplusplus
}
#endif
This diff is collapsed.
Click to expand it.
err_out/standalone_err_out.cpp
0 → 100644
+
28
−
0
View file @
4ed98ea7
#include
"err_out.h"
#include
<exception>
#include
<string>
#include
<iostream>
/*
This "backend" for err_out.h just uses the standard outputs and throws a standard c++ exception.
*/
class
StandaloneException
:
public
std
::
exception
{
std
::
string
msg
;
public:
StandaloneException
(
const
char
*
type
,
const
char
*
message
)
:
msg
((
std
::
string
(
type
)
+
": "
)
+
message
)
{}
virtual
const
char
*
what
()
const
throw
()
{
return
msg
.
c_str
();
}
};
void
throw_error
(
const
char
*
type
,
const
char
*
message
)
{
throw
StandaloneException
(
type
,
message
);
}
void
print_cout
(
const
char
*
message
)
{
std
::
cout
<<
message
;
}
void
print_cerr
(
const
char
*
message
)
{
std
::
cerr
<<
message
;
}
\ No newline at end of file
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