Branch data Line data Source code
1 : : // Copyright 2026 HPActor Contributors
2 : : //
3 : : // Licensed under the Apache License, Version 2.0 (the "License");
4 : : // you may not use this file except in compliance with the License.
5 : : // You may obtain a copy of the License at
6 : : //
7 : : // http://www.apache.org/licenses/LICENSE-2.0
8 : : //
9 : : // Unless required by applicable law or agreed to in writing, software
10 : : // distributed under the License is distributed on an "AS IS" BASIS,
11 : : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : : // See the License for the specific language governing permissions and
13 : : // limitations under the License.
14 : :
15 : : #include <hpactor/actor/scoped_actor.hpp>
16 : : #include <hpactor/core/actor_system.hpp>
17 : :
18 : : namespace hpactor {
19 : :
20 : 1 : ScopedActor::ScopedActor(ActorSystem& sys) : BlockingActor(nullptr, sys) {
21 : : // ScopedActor is used outside the normal spawn path (e.g., from main()).
22 : : // The ActorSystem may not be fully started, so we only set up the
23 : : // blocking actor infrastructure here. Full registration with mailbox,
24 : : // scheduler, and metrics happens in on_activate() if needed.
25 : : //
26 : : // For MVP: the actor is usable as a blocking receiver. Messages sent
27 : : // to it from spawned actors will be delivered through its mailbox once
28 : : // the system is running.
29 : 1 : }
30 : :
31 : 1 : ScopedActor::~ScopedActor() {
32 : 1 : on_deactivate();
33 : 1 : }
34 : :
35 : : } // namespace hpactor
|