Skip to content

Commit

Permalink
Merge pull request #345 from JeffersonLab/nbrei_deprecate_jmetadata
Browse files Browse the repository at this point in the history
Deprecate JMetadata
  • Loading branch information
nathanwbrei authored Aug 21, 2024
2 parents b65ac3c + 96c17e8 commit c5674aa
Show file tree
Hide file tree
Showing 15 changed files with 5 additions and 458 deletions.
21 changes: 0 additions & 21 deletions docs/howto/other-howtos.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Table of contents
6. [Benchmark a JANA program](benchmarking.html)
4. [Generate code skeletons](#creating-code-skeletons) for projects, plugins, components, etc
5. [Run the JANA Status/Control/Debugger GUI](#run-the-status-control-debugger-gui)
6. [Work with factory metadata](#using-factory-metadata) for collecting statistics, etc
7. Create a service which can be shared between different plugins
8. Handle both real and simulated data
9. Handle EPICS data
Expand Down Expand Up @@ -232,26 +231,6 @@ The JANA Status/Control/Debugger GUI can be a useful tool for probing a running
be found on the [dedicated page for the GUI](GUI_Monitor_Debug.md)


Using factory metadata
----------------------

The `JFactoryT<T>` interface abstracts the creation logic for a vector of n objects of type `T`. However, often
we also care about single pieces of data associated with the same computation. For instance, a track fitting factory
might want to return statistics about how many fits succeeded and failed.

A naive solution is to put member variables on the factory and then access them from a `JEventProcessor`
by obtaining the `JFactoryT<T>` via `GetFactory<>` and performing a dynamic cast to the underlying factory type.
Although this works, it means that that factory can no longer be swapped with an alternate version without modifying
the calling code. This degrades the whole project's ability to take advantage of the plugin architecture and hurts
its overall code quality.

Instead, we recommend using the `JMetadata` template trait. Each `JFactoryT<T>` not only produces a vector of `T`,
but also a singular `JMetadata<T>` struct whose contents can be completely arbitrary, but cannot be redefined for a
particular T. All `JFactoryT<T>` for some `T` will use it.

An example project demonstrating usage of JMetadata can be found under `examples/MetadataExample`.





Expand Down
1 change: 0 additions & 1 deletion src/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ add_subdirectory(DstExample)
add_subdirectory(Tutorial)
add_subdirectory(StreamingExample)
add_subdirectory(EventGroupExample)
add_subdirectory(MetadataExample)
add_subdirectory(SubeventExample)
add_subdirectory(SubeventCUDAExample)
add_subdirectory(UnitTestingExample)
Expand Down
7 changes: 0 additions & 7 deletions src/examples/MetadataExample/CMakeLists.txt

This file was deleted.

62 changes: 0 additions & 62 deletions src/examples/MetadataExample/MetadataAggregator.cc

This file was deleted.

51 changes: 0 additions & 51 deletions src/examples/MetadataExample/MetadataAggregator.h

This file was deleted.

25 changes: 0 additions & 25 deletions src/examples/MetadataExample/MetadataExample.cc

This file was deleted.

19 changes: 0 additions & 19 deletions src/examples/MetadataExample/README.md

This file was deleted.

93 changes: 0 additions & 93 deletions src/examples/MetadataExample/RandomTrackSource.cc

This file was deleted.

36 changes: 0 additions & 36 deletions src/examples/MetadataExample/RandomTrackSource.h

This file was deleted.

55 changes: 0 additions & 55 deletions src/examples/MetadataExample/Track.h

This file was deleted.

Loading

0 comments on commit c5674aa

Please sign in to comment.