28template <
typename SmaccClientType>
33 storage =
dynamic_cast<SmaccClientType *
>(client.get());
34 if (storage !=
nullptr)
return true;
41 <<
"] not found in current orthogonal. Searching in other orthogonals.");
45 for (
auto & client : orthoentry.second->getClients())
47 storage =
dynamic_cast<SmaccClientType *
>(client.get());
48 if (storage !=
nullptr)
52 "Required client [" << requiredClientName <<
"] found in other orthogonal.");
61 <<
"] not found even in other orthogonals. Returning null pointer. If the "
62 "requested client is used may result in a segmentation fault.");
66template <
typename SmaccComponentType>
73 "Cannot use the requiresComponent funcionality from an orthogonal before onInitialize");
81template <
typename TOrthogonal,
typename TClient>
85 client->setOrthogonal(
this);
87 client->template onOrthogonalAllocation<TOrthogonal, TClient>();
88 client->template onStateOrthogonalAllocation<TOrthogonal, TClient>();
91template <
typename TClientBehavior>
97 auto * ret =
dynamic_cast<TClientBehavior *
>(cb.get());
114inline const std::vector<std::vector<std::shared_ptr<smacc2::ISmaccClientBehavior>>> &
135template <
typename TOrthogonal,
typename TClient>
139 template <
typename... TArgs>
146 template <
typename SmaccComponentType,
typename... TArgs>
153 template <
typename SmaccComponentType,
typename... TArgs>
166template <
typename TOrthogonal>
170 template <
typename TClient,
typename... TArgs>
171 std::shared_ptr<ClientHandler<TOrthogonal, TClient>>
createClient(TArgs... args)
181 getLogger(),
"[%s] creating client object, type:'%s' object tag: '%s'",
185 auto client = std::make_shared<ClientHandler<TOrthogonal, TClient>>(args...);
190 clientPtr->template onComponentInitialization<TOrthogonal, TClient>();
ClientHandler(TArgs... args)
smacc2::introspection::TypeInfo::Ptr getType() override
SmaccComponentType * createComponent(TArgs... targs)
SmaccComponentType * createNamedComponent(std::string name, TArgs... targs)
SmaccComponentType * createNamedComponent(std::string name, TArgs... targs)
SmaccComponentType * createComponent(TArgs... targs)
ISmaccStateMachine * getStateMachine()
void setGlobalSMData(std::string name, T value)
bool getGlobalSMData(std::string name, T &ret)
rclcpp::Logger getLogger()
void requiresComponent(SmaccComponentType *&storage)
std::vector< std::shared_ptr< smacc2::ISmaccClient > > clients_
ISmaccStateMachine * stateMachine_
bool requiresClient(SmaccClientType *&storage)
void assignClientToOrthogonal(TClient *client)
std::vector< std::vector< std::shared_ptr< smacc2::ISmaccClientBehavior > > > clientBehaviors_
const std::vector< std::vector< std::shared_ptr< smacc2::ISmaccClientBehavior > > > & getClientBehaviors() const
TClientBehavior * getClientBehavior(int index=0)
const std::vector< std::shared_ptr< smacc2::ISmaccClient > > & getClients()
bool getGlobalSMData(std::string name, T &ret)
void setGlobalSMData(std::string name, T value)
void requiresComponent(SmaccComponentType *&storage, bool throwsExceptionIfNotExist=false)
std::shared_ptr< ClientHandler< TOrthogonal, TClient > > createClient(TArgs... args)
static TypeInfo::Ptr getTypeInfoFromType()
std::shared_ptr< TypeInfo > Ptr
std::string demangledTypeName()
std::string demangleType(const std::type_info *tinfo)