simulation_framework::standalone_activity_service::IStandaloneActivityCreator Class Reference
Last update: 16.07.2025This is the interface class for creating a standalone activity service. It defines how a customized activity needs to be instantiated through or not through StandaloneInitData. More...
#include <i_standalone_activity_creator.h>
Public Member Functions | |
| virtual std::string | GetName ()=0 |
| virtual std::unique_ptr< core::lifecycle::IActivity > | Create ([[maybe_unused]] const standalone_activity_service::StandaloneInitData &standalone_init_data)=0 |
| Create an std::unique_ptr<IActivity> which will be scheduled remotely through scheduling event. More... | |
Detailed Description
This is the interface class for creating a standalone activity service. It defines how a customized activity needs to be instantiated through or not through StandaloneInitData.
You have already the example how you create an activity "MyActivity" in simfwk-core/lifecycle/activity/base_activity.h
This example shows how to implement the IStandaloneActivityCreator interface based on "MyActivity"
using TopicToBePublished = Topic<MsgToBePublished>;
using TopicSubscribingOn = Topic<MsgSubscribingOn>;
class MyActivityCreator : public IStandaloneActivityCreator
{
public:
MyActivityCreator(const std::string& name) : standalone_activity_name_(name) {}
std::unique_ptr<IActivity> Create(const standalone_activity_service::StandaloneInitData& standalone_init_data)
override
{
std::shared_ptr<ITopic> topic_going_to_publish = std::make_shared<TopicToBePublished>("TopicToBePublished");
std::shared_ptr<ITopic> topic_want_to_receive = std::make_shared<TopicSubscribingOn>("TopicSubscribingOn");
return std::make_unique<MyActivity>(
standalone_activity_name_, Topics{topic_going_to_publish, topic_want_to_receive}, MyLogic{});
}
private:
std::string standalone_activity_name_;
};
Member Function Documentation
◆ Create()
|
pure virtual |
Create an std::unique_ptr<IActivity> which will be scheduled remotely through scheduling event.
- Parameters
-
standalone_init_data The class contains inputs required for this Standalone Activity. The StandaloneActivityCreator is responsible to decode this properly and use the inputs data for initialization of Activity
- Returns
- A pointer of IActivity interface which will be controlled remotely by simfwk core
◆ GetName()
|
pure virtual |
- Returns
- the name of this standalone activity
The documentation for this class was generated from the following file: