SMACC2
Loading...
Searching...
No Matches
smacc_component_impl.hpp
Go to the documentation of this file.
1// Copyright 2021 RobosoftAI Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15/*****************************************************************************************************************
16 *
17 * Authors: Pablo Inigo Blasco, Brett Aldrich
18 *
19 ******************************************************************************************************************/
20
21#pragma once
22
23#include <string>
24
25#include <smacc2/component.hpp>
27
28namespace smacc2
29{
30template <typename EventType>
31void ISmaccComponent::postEvent(const EventType & ev)
32{
34}
35
36template <typename TComponent>
37void ISmaccComponent::requiresComponent(TComponent *& requiredComponentStorage)
38{
39 requiredComponentStorage = this->owner_->getComponent<TComponent>();
40}
41
42template <typename TClient>
43void ISmaccComponent::requiresClient(TClient *& requiredClientStorage)
44{
45 this->owner_->requiresClient(requiredClientStorage);
46}
47
48template <typename SmaccComponentType, typename TOrthogonal, typename TClient, typename... TArgs>
49SmaccComponentType * ISmaccComponent::createSiblingComponent(TArgs... targs)
50{
51 return this->owner_->createComponent<SmaccComponentType, TOrthogonal, TClient>(targs...);
52}
53
54template <typename SmaccComponentType, typename TOrthogonal, typename TClient, typename... TArgs>
55SmaccComponentType * ISmaccComponent::createSiblingNamedComponent(std::string name, TArgs... targs)
56{
57 return this->owner_->createNamedComponent<SmaccComponentType, TOrthogonal, TClient>(
58 name, targs...);
59}
60
61} // namespace smacc2
SmaccComponentType * createNamedComponent(std::string name, TArgs... targs)
SmaccComponentType * createComponent(TArgs... targs)
void requiresClient(SmaccClientType *&storage)
TComponent * getComponent()
ISmaccClient * owner_
Definition: component.hpp:77
void requiresClient(TClient *&requiredClientStorage)
void requiresComponent(TComponent *&requiredComponentStorage)
SmaccComponentType * createSiblingComponent(TArgs... targs)
SmaccComponentType * createSiblingNamedComponent(std::string name, TArgs... targs)
ISmaccStateMachine * stateMachine_
Definition: component.hpp:75
void postEvent(EventType *ev, EventLifeTime evlifetime=EventLifeTime::ABSOLUTE)