28template <
typename SmaccClientType>
33 storage =
dynamic_cast<SmaccClientType *
>(client.get());
34 if (storage !=
nullptr)
return true;
37 auto requiredClientName = demangledTypeName<SmaccClientType>();
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>();
90template <
typename TClientBehavior>
95 auto * ret =
dynamic_cast<TClientBehavior *
>(cb.get());
110inline const std::vector<std::shared_ptr<smacc2::ISmaccClientBehavior>> &
131template <
typename TOrthogonal,
typename TClient>
135 template <
typename... TArgs>
142 template <
typename SmaccComponentType,
typename... TArgs>
149 template <
typename SmaccComponentType,
typename... TArgs>
158 return smacc2::introspection::TypeInfo::getTypeInfoFromType<TClient>();
162template <
typename TOrthogonal>
166 template <
typename TClient,
typename... TArgs>
177 getLogger(),
"[%s] creating client object, type:'%s' object tag: '%s'",
178 demangleType(
typeid(*
this)).c_str(), demangledTypeName<TClient>().c_str(),
179 demangledTypeName<TOrthogonal>().c_str());
181 auto client = std::make_shared<ClientHandler<TOrthogonal, TClient>>(
args...);
182 this->
template assignClientToOrthogonal<TOrthogonal, TClient>(client.get());
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)
std::vector< std::shared_ptr< smacc2::ISmaccClientBehavior > > clientBehaviors_
ISmaccStateMachine * getStateMachine()
const std::vector< std::shared_ptr< smacc2::ISmaccClientBehavior > > & getClientBehaviors() const
TClientBehavior * getClientBehavior()
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)
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)
std::shared_ptr< ClientHandler< TOrthogonal, TClient > > createClient(TArgs... args)
std::shared_ptr< TypeInfo > Ptr
std::string demangleType(const std::type_info *tinfo)