Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OPOSSUM
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
phelix
rust
OPOSSUM
Commits
8a1f5aad
Commit
8a1f5aad
authored
1 year ago
by
Udo Eisenbarth
Browse files
Options
Downloads
Patches
Plain Diff
Doc work
parent
bc40a8aa
No related branches found
No related tags found
No related merge requests found
Pipeline
#7706
passed
1 year ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/nodes/dummy.rs
+1
-1
1 addition, 1 deletion
src/nodes/dummy.rs
src/optical.rs
+17
-2
17 additions, 2 deletions
src/optical.rs
with
18 additions
and
3 deletions
src/nodes/dummy.rs
+
1
−
1
View file @
8a1f5aad
...
...
@@ -152,7 +152,7 @@ mod test {
#[test]
fn
name
()
{
let
mut
node
=
Dummy
::
default
();
node
.set_name
(
"Test1"
);
node
.set_
property
(
"
name
"
,
"Test1"
.into
())
.unwrap
(
);
assert_eq!
(
node
.name
(),
"Test1"
)
}
#[test]
...
...
This diff is collapsed.
Click to expand it.
src/optical.rs
+
17
−
2
View file @
8a1f5aad
...
...
@@ -23,6 +23,7 @@ type Result<T> = std::result::Result<T, OpossumError>;
/// This is the basic trait that must be implemented by all concrete optical components.
pub
trait
Optical
:
Dottable
{
/// Sets the name of this [`Optical`].
#[deprecated(note
=
"set_property(
\"
name
\"
,...) should used instead"
)]
fn
set_name
(
&
mut
self
,
_name
:
&
str
)
{}
/// Returns a reference to the name of this [`Optical`].
fn
name
(
&
self
)
->
&
str
{
...
...
@@ -49,7 +50,7 @@ pub trait Optical: Dottable {
print!
(
"{}: No analyze function defined."
,
self
.node_type
());
Ok
(
LightResult
::
default
())
}
/// Export analysis data to file with the given
name
.
/// Export analysis data to file
(s)
with
in
the given
directory path
.
///
/// This function should be overridden by a node in order to export node-specific data into a file.
/// The default implementation does nothing.
...
...
@@ -65,8 +66,18 @@ pub trait Optical: Dottable {
fn
as_group
(
&
self
)
->
Result
<&
NodeGroup
>
{
Err
(
OpossumError
::
Other
(
"cannot cast to group"
.into
()))
}
/// Return the properties of this [`Optical`].
///
/// Return all properties of an optical node. Note, that some properties might be read-only.
fn
properties
(
&
self
)
->
&
Properties
;
fn
set_property
(
&
mut
self
,
_name
:
&
str
,
_prop
:
Property
)
->
Result
<
()
>
;
/// Set a property of this [`Optical`].
///
/// Set a property of an optical node. This property must already exist (e.g. defined in new() / default() functions of the node).
///
/// # Errors
///
/// This function will return an error if a non-defined property is set or the property has the wrong data type.
fn
set_property
(
&
mut
self
,
name
:
&
str
,
property
:
Property
)
->
Result
<
()
>
;
fn
set_properties
(
&
mut
self
,
properties
:
&
Properties
)
->
Result
<
()
>
{
let
own_properties
=
self
.properties
()
.props
.clone
();
...
...
@@ -77,6 +88,10 @@ pub trait Optical: Dottable {
}
Ok
(())
}
/// Return a JSON representation of the current state of this [`Optical`].
///
/// This function must be overridden for generating output in the analysis report. Mainly detector nodes use this feature.
/// The default implementation is to return a JSON `null` value.
fn
report
(
&
self
)
->
serde_json
::
Value
{
json!
(
null
)
}
...
...
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