SMACC
Loading...
Searching...
No Matches
component.h
Go to the documentation of this file.
1/*****************************************************************************************************************
2 * ReelRobotix Inc. - Software License Agreement Copyright (c) 2018
3 * Authors: Pablo Inigo Blasco, Brett Aldrich
4 *
5 ******************************************************************************************************************/
6#pragma once
7
8#include <smacc/common.h>
9#include <boost/optional.hpp>
10
11namespace smacc
12{
13
15{
16public:
18
19 virtual ~ISmaccComponent();
20
21 // Returns a custom identifier defined by the specific plugin implementation
22 virtual std::string getName() const;
23
24protected:
25
26 virtual void initialize(ISmaccClient *owner);
27
28 // Assigns the owner of this resource to the given state machine parameter object
29 void setStateMachine(ISmaccStateMachine *stateMachine);
30
31 template <typename EventType>
32 void postEvent(const EventType &ev);
33
34 template <typename EventType>
35 void postEvent();
36
37 template <typename TOrthogonal, typename TSourceObject>
39
40 template <typename TComponent>
41 void requiresComponent(TComponent *& requiredComponentStorage);
42
43 template <typename TClient>
44 void requiresClient(TClient *& requiredClientStorage);
45
46 virtual void onInitialize();
47
48 template <typename SmaccComponentType, typename TOrthogonal, typename TClient, typename... TArgs>
49 SmaccComponentType *createSiblingComponent(TArgs... targs);
50
51 template <typename SmaccComponentType, typename TOrthogonal, typename TClient, typename... TArgs>
52 SmaccComponentType *createSiblingNamedComponent(std::string name, TArgs... targs);
53
54 // A reference to the state machine object that owns this resource
56
58
59 friend class ISmaccOrthogonal;
60 friend class ISmaccClient;
61};
62} // namespace smacc
virtual void initialize(ISmaccClient *owner)
void requiresClient(TClient *&requiredClientStorage)
void onOrthogonalAllocation()
Definition: component.h:38
SmaccComponentType * createSiblingComponent(TArgs... targs)
SmaccComponentType * createSiblingNamedComponent(std::string name, TArgs... targs)
virtual std::string getName() const
ISmaccClient * owner_
Definition: component.h:57
void requiresComponent(TComponent *&requiredComponentStorage)
ISmaccStateMachine * stateMachine_
Definition: component.h:55
virtual void onInitialize()
void setStateMachine(ISmaccStateMachine *stateMachine)