![]() |
|
|||
File indexing completed on 2025-10-15 09:22:44
0001 0002 #pragma once 0003 #include <JANA/Components/JComponentFwd.h> 0004 0005 0006 class JServiceLocator; 0007 struct JService : public jana::components::JComponent { 0008 0009 /// JServices may require other JServices, which may be loaded out of order from 0010 /// different plugins. For this reason, initialization of JServices is delayed until 0011 /// all plugins are loaded. Suppose you are writing Service B which depends on Service A. 0012 /// To acquire A during B's initialization, you should 0013 /// either declare a `Service<A> m_a_svc{this}` helper member, or fetch it manually by calling 0014 /// `GetApplication()->GetService<A>()` from inside `B::Init()`. Either way, the JServices will 0015 /// be initialized recursively and in the correct order. 0016 /// 0017 /// Note that historically JServices used the `acquire_services()` callback instead of `Init()`. 0018 /// While `acquire_services` hasn't been deprecated yet, it is on the roadmap, so we strongly 0019 /// recommend you override `Init()` instead. 0020 /// 0021 /// Note: Don't call JApplication::GetService<SvcT>() or JServiceLocator::get<SvcT>() from InitPlugin()! 0022 0023 virtual ~JService() = default; 0024 0025 // JService has its own DoInit() for the sake of acquire_services() 0026 void DoInit(JServiceLocator*); 0027 0028 // This will be deprecated eventually 0029 virtual void acquire_services(JServiceLocator*) {}; 0030 }; 0031
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |