source: finroc_plugins_composite_ports/interface_types.h @ 23:3c9cac2a0cc1

Last change on this file since 23:3c9cac2a0cc1 was 23:3c9cac2a0cc1, checked in by Max Reichardt <mreichardt@…>, 14 months ago

Adds 'interface modifiers' for customization of port composite interface creation (as there are diverse use cases). Refactors and tidies partial interface creation with this new feature.

File size: 3.6 KB
Line 
1//
2// You received this file as part of Finroc
3// A framework for intelligent robot control
4//
5// Copyright (C) Finroc GbR (finroc.org)
6//
7// This program is free software; you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation; either version 2 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License along
18// with this program; if not, write to the Free Software Foundation, Inc.,
19// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20//
21//----------------------------------------------------------------------
22/*!\file    plugins/composite_ports/interface_types.h
23 *
24 * \author  Max Reichardt
25 *
26 * \date    2021-03-20
27 *
28 * Utility functions for handling port composite interface types
29 *
30 */
31//----------------------------------------------------------------------
32#ifndef __plugins__composite_ports__interface_types_h__
33#define __plugins__composite_ports__interface_types_h__
34
35//----------------------------------------------------------------------
36// External includes (system with <>, local with "")
37//----------------------------------------------------------------------
38
39//----------------------------------------------------------------------
40// Internal includes with ""
41//----------------------------------------------------------------------
42#include "plugins/composite_ports/internal/tInterfaceTypeInfo.h"
43
44//----------------------------------------------------------------------
45// Namespace declaration
46//----------------------------------------------------------------------
47namespace finroc
48{
49namespace composite_ports
50{
51
52//----------------------------------------------------------------------
53// Forward declarations / typedefs / enums
54//----------------------------------------------------------------------
55
56//----------------------------------------------------------------------
57// Function declarations
58//----------------------------------------------------------------------
59
60/*!
61 * \param type Data type to check
62 * \return Is specified data type a port composite interface type?
63 */
64inline bool IsInterfaceType(const rrlib::rtti::tType& type)
65{
66  return type.GetTypeClassification() == rrlib::rtti::tTypeClassification::PORT_COMPOSITE_INTERFACE;
67}
68
69/*!
70 * \param type Data type
71 * \return Full interface type if type is a port composite interface type - possibly a partial interface type
72 */
73inline bool GetFullInterfaceType(const rrlib::rtti::tType& type)
74{
75  return IsInterfaceType(type) && static_cast<const internal::tInterfaceTypeInfo&>(type.SharedTypeInfo()).GetFullType();
76}
77
78/*!
79 * \param type Data type
80 * \return Partial interface type if type is a port composite interface type with a partial interface type
81 */
82inline bool GetPartialInterfaceType(const rrlib::rtti::tType& type)
83{
84  return IsInterfaceType(type) && static_cast<const internal::tInterfaceTypeInfo&>(type.SharedTypeInfo()).GetPartialType();
85}
86
87/*!
88 * \param type Data type to check
89 * \return Is specified data type a partial port composite interface type?
90 */
91inline bool IsPartialInterfaceType(const rrlib::rtti::tType& type)
92{
93  return GetPartialInterfaceType(type) == type;
94}
95
96//----------------------------------------------------------------------
97// End of namespace declaration
98//----------------------------------------------------------------------
99}
100}
101
102
103#endif
Note: See TracBrowser for help on using the repository browser.