28template <
typename EventType>
34template <
typename EventType>
40template <
typename TComponent>
43 return this->getComponent<TComponent>(std::string());
46template <
typename TComponent>
52 auto * tcomponent =
dynamic_cast<TComponent *
>(component.second.get());
53 if (tcomponent !=
nullptr)
70template <
typename TComponent>
75 if (component.first.name != name)
continue;
77 auto * tcomponent =
dynamic_cast<TComponent *
>(component.second.get());
78 if (tcomponent !=
nullptr)
90template <
typename SmaccComponentType,
typename TOrthogonal,
typename TClient,
typename... TArgs>
93 ComponentKey componentkey(&
typeid(SmaccComponentType), name);
95 std::shared_ptr<SmaccComponentType> ret;
101 auto tname = demangledTypeName<SmaccComponentType>();
104 "Creating a new component of type %s smacc component is required by client '%s'. Creating a "
106 this->
getName().c_str(), demangledTypeName<SmaccComponentType>().c_str(), tname.c_str());
108 ret = std::shared_ptr<SmaccComponentType>(
new SmaccComponentType(targs...));
111 ret->initialize(
this);
115 RCLCPP_DEBUG(
getLogger(),
"%s resource is required. Done.", tname.c_str());
120 getLogger(),
"%s resource is required. Found resource in cache.",
121 demangledTypeName<SmaccComponentType>().c_str());
122 ret = dynamic_pointer_cast<SmaccComponentType>(it->second);
125 ret->template onOrthogonalAllocation<TOrthogonal, TClient>();
130template <
typename SmaccComponentType,
typename TOrthogonal,
typename TClient,
typename... TArgs>
133 return this->createNamedComponent<SmaccComponentType, TOrthogonal, TClient>(
134 std::string(), targs...);
137template <
typename TSmaccSignal,
typename T>
143template <
typename SmaccClientType>
ISmaccStateMachine * stateMachine_
ISmaccStateMachine * getStateMachine()
std::map< ComponentKey, std::shared_ptr< smacc2::ISmaccComponent > > components_
virtual std::string getName() const
SmaccComponentType * createNamedComponent(std::string name, TArgs... targs)
rclcpp::Logger getLogger()
SmaccComponentType * createComponent(TArgs... targs)
void connectSignal(TSmaccSignal &signal, void(T::*callback)(), T *object)
ISmaccOrthogonal * orthogonal_
void requiresClient(SmaccClientType *&storage)
TComponent * getComponent()
bool requiresClient(SmaccClientType *&storage)
boost::signals2::connection createSignalConnection(TSmaccSignal &signal, TMemberFunctionPrototype callback, TSmaccObjectType *object)
void postEvent(EventType *ev, EventLifeTime evlifetime=EventLifeTime::ABSOLUTE)