15template <
typename SmaccClientType>
20 storage =
dynamic_cast<SmaccClientType *
>(client.get());
21 if (storage !=
nullptr)
25 auto requiredClientName = demangledTypeName<SmaccClientType>();
26 ROS_WARN_STREAM(
"Required client ["<< requiredClientName<<
"] not found in current orthogonal. Searching in other orthogonals.");
30 for (
auto &client : orthoentry.second->getClients())
32 storage =
dynamic_cast<SmaccClientType *
>(client.get());
33 if (storage !=
nullptr)
35 ROS_WARN_STREAM(
"Required client ["<< requiredClientName<<
"] found in other orthogonal.");
41 ROS_ERROR_STREAM(
"Required client ["<< requiredClientName<<
"] not found even in other orthogonals. Returning null pointer. If the requested client is used may result in a segmentation fault.");
45template <
typename SmaccComponentType>
50 ROS_ERROR(
"Cannot use the requiresComponent funcionality from an orthogonal before onInitialize");
58template <
typename TOrthogonal,
typename TClient>
62 client->setOrthogonal(
this);
64 client->template onOrthogonalAllocation<TOrthogonal, TClient>();
67template <
typename TClientBehavior>
72 auto *ret =
dynamic_cast<TClientBehavior *
>(cb.get());
107template <
typename TOrthogonal,
typename TClient>
111 template <
typename... TArgs>
122 template <
typename SmaccComponentType,
typename... TArgs>
128 template <
typename SmaccComponentType,
typename... TArgs>
136 return smacc::introspection::TypeInfo::getTypeInfoFromType<TClient>();
140template <
typename TOrthogonal>
144 template <
typename TClient,
typename... TArgs>
145 std::shared_ptr<ClientHandler<TOrthogonal, TClient>>
createClient(TArgs... args)
154 ROS_INFO(
"[%s] creates a client of type '%s' and object tag '%s'",
156 demangledTypeName<TClient>().c_str(),
157 demangledTypeName<TOrthogonal>().c_str()
160 auto client = std::make_shared<ClientHandler<TOrthogonal, TClient>>(args...);
161 this->
template assignClientToOrthogonal<TOrthogonal, TClient>(client.get());
virtual smacc::introspection::TypeInfo::Ptr getType() override
SmaccComponentType * createNamedComponent(std::string name, TArgs... targs)
ClientHandler(TArgs... args)
SmaccComponentType * createComponent(TArgs... targs)
SmaccComponentType * createComponent(TArgs... targs)
SmaccComponentType * createNamedComponent(std::string name, TArgs... targs)
std::vector< std::shared_ptr< smacc::ISmaccClient > > clients_
void assignClientToOrthogonal(TClient *client)
void setGlobalSMData(std::string name, T value)
void requiresComponent(SmaccComponentType *&storage)
ISmaccStateMachine * stateMachine_
TClientBehavior * getClientBehavior()
bool requiresClient(SmaccClientType *&storage)
const std::vector< std::vector< std::shared_ptr< smacc::ISmaccClientBehavior > > > & getClientBehaviors() const
const std::vector< std::shared_ptr< smacc::ISmaccClient > > & getClients()
std::vector< std::vector< std::shared_ptr< smacc::ISmaccClientBehavior > > > clientBehaviors_
bool getGlobalSMData(std::string name, T &ret)
ISmaccStateMachine * getStateMachine()
void setGlobalSMData(std::string name, T value)
void requiresComponent(SmaccComponentType *&storage)
bool getGlobalSMData(std::string name, T &ret)
std::shared_ptr< ClientHandler< TOrthogonal, TClient > > createClient(TArgs... args)
std::shared_ptr< TypeInfo > Ptr
std::string demangleType(const std::type_info *tinfo)