source: finroc_core/tFrameworkElementFlags.h @ 430:e166ab6b6ac3

17.03
Last change on this file since 430:e166ab6b6ac3 was 430:e166ab6b6ac3, checked in by Max Reichardt <mreichardt@…>, 6 years ago

Marks obsolete PUSH_STRATEGY_REVERSE flag 'legacy'

File size: 7.7 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    core/tFrameworkElementFlags.h
23 *
24 * \author  Max Reichardt
25 *
26 * \date    2012-10-27
27 *
28 * \brief   Contains tFrameworkElementFlags
29 *
30 * \b tFrameworkElementFlags
31 *
32 * Set of framework element flags.
33 * As enums do not support OR operations, this type is used to handle combining of flags.
34 */
35//----------------------------------------------------------------------
36#ifndef __core__tFrameworkElementFlags_h__
37#define __core__tFrameworkElementFlags_h__
38
39//----------------------------------------------------------------------
40// External includes (system with <>, local with "")
41//----------------------------------------------------------------------
42#include "rrlib/util/tEnumBasedFlags.h"
43
44//----------------------------------------------------------------------
45// Internal includes with ""
46//----------------------------------------------------------------------
47
48//----------------------------------------------------------------------
49// Namespace declaration
50//----------------------------------------------------------------------
51namespace finroc
52{
53namespace core
54{
55
56//----------------------------------------------------------------------
57// Forward declarations / typedefs / enums
58//----------------------------------------------------------------------
59//! Flags that can be set for framework elements
60/*!
61 * This enum contains flags for framework elements.
62 * The lower 22 bit are constant flags which may not change
63 * at runtime whereas the upper 10 may change
64 * (we omit the last bit in Java, because the sign may have ugly side effects).
65 * The custom flag may be used by a framework element subclass.
66 *
67 * Note for future development: If more flags are needed (all 32 bits are used),
68 * the following are required for construction only:
69 * HAS_QUEUE, MAY_ACCEPT_REVERSE_DATA, NON_STANDARD_ASSIGN, MULTI_TYPE_BUFFER_POOL
70 */
71enum class tFrameworkElementFlag
72{
73  // Constant flags (both ports and non-ports - first 8 are tranferred to finstruct)
74  PORT,                  //!< Is this framework element a port?
75  EDGE_AGGREGATOR,       //!< Is this an edge aggregating framework element? (edges connect ports)
76  INTERFACE,             //!< Is this framework element (usually also edge aggregator) an interface of its parent? (one of possibly many)
77  SENSOR_DATA,           //!< Is the data processed in this framework element and all framework elements below only sensor data? (hint for visualization; relevant for interface especially)
78  CONTROLLER_DATA,       //!< Is the data processed in this framework element and all framework elements below only controller data? (hint for visualization; relevant for interface especially)
79  NETWORK_ELEMENT,       //!< Is this a network port or framework element?
80  GLOBALLY_UNIQUE_LINK,  //!< Has this framework element a globally unique qualified name? (used by tools such as fingui to decide whether to store host name with connection)
81  ALTERNATIVE_LOCAL_URI_ROOT, //!< Is this an alternative root for local URIs (such as a remote runtime environments mapped into this one)
82
83  RUNTIME,               //!< Non-port use: Is this the one and only runtime environment (in this process)? Port use: flag hijacked ports (see below).
84  SHARED,                //!< Should framework element be visible/accessible from other runtime environments?
85  AUTO_RENAME,           //!< Automatically rename children with duplicate names?
86
87  // Constant port-only flags
88  HAS_QUEUE,               //!< Does Port have a queue for storing incoming data?
89  HAS_DEQUEUE_ALL_QUEUE,   //!< Does Port have a queue with tDequeueMode::ALL instead of tDequeueMode::FIFO?
90  //MAY_ACCEPT_REVERSE_DATA, //!< Does the flag ACCEPTS_REVERSE_DATA may change at runtime?
91  ACCEPTS_DATA,            //!< Does port accept incoming data? Also set for server RPC ports, since they accept RPC calls
92  EMITS_DATA,              //!< Does port emit data (normal direction)? Also set for client RPC ports, since they "emit" RPC calls
93  MULTI_TYPE_BUFFER_POOL,  //!< Does port have buffer pool with multiple data types?
94  EXPRESS_PORT,            //!< Transport data for this port through the network with high priority? */
95  VOLATILE,                //!< Is this port volatile (meaning that it's not always there and connections to it should preferably be links) */
96  NO_INITIAL_PUSHING,      //!< Deactivates initial pushing when this (output) port is connected to another port with push strategy */
97  TOOL_PORT,               //!< Port from network connection from tooling (e.g. finstruct/fingui). Connection constraints are ignored for such ports
98  FINSTRUCT_READ_ONLY,     //!< Port value cannot be set from finstruct
99
100  /*!
101   * From it's general characteristics: Is port input or output port?
102   * (for ports in interfaces of composite components: from the outside component view)
103   * (for RPC ports client ports are output port since they "emit" RPC calls)
104   */
105  OUTPUT_PORT,
106
107  /*!
108   * Are port values assigned to port in a non-standard way?
109   * In this case, a port's virtual method NonStandardAssign() is used instead of plain Assign() in order to change the data buffer of a port.
110   * Constant flag automatically set by data port classes.
111   */
112  NON_STANDARD_ASSIGN,
113
114  // Non-constant flags - need to be changed synchronously
115  READY,                 //!< Is framework element ready?
116  PUBLISHED,             //!< Has framework element been published?
117  DELETED,               //!< Has framework element been deleted? - dangerous if you actually encounter this in C++...
118  FINSTRUCTED,           //!< Is this an element created by finstruct?
119  FINSTRUCTABLE_GROUP,   //!< Is this a finstructable group?
120
121  // Non-constant port-only flags
122  USES_QUEUE,            //!< Does Port currently store incoming data in queue? - requires HAS_QUEUE
123  DEFAULT_ON_DISCONNECT, //!< Restore default value, if port is disconnected?
124  PUSH_STRATEGY,         //!< Use push strategy rather than pull strategy?
125  LEGACY_PUSH_STRATEGY_REVERSE, //!< Unused legacy flag: use push strategy in reverse direction?
126  HIJACKED_PORT = RUNTIME //!< Is this a port hijacked e.g. by the data_playback plugin? If set, values set/received by components are discarded.
127};
128
129static_assert(static_cast<uint>(tFrameworkElementFlag::LEGACY_PUSH_STRATEGY_REVERSE) < 32, "Too many flags");
130
131
132/*!
133 * Set of framework element flags.
134 */
135typedef rrlib::util::tEnumBasedFlags<tFrameworkElementFlag> tFrameworkElementFlags;
136
137
138constexpr inline tFrameworkElementFlags operator | (const tFrameworkElementFlags& flags1, const tFrameworkElementFlags& flags2)
139{
140  return tFrameworkElementFlags(flags1.Raw() | flags2.Raw());
141}
142
143constexpr inline tFrameworkElementFlags operator | (tFrameworkElementFlag flag1, tFrameworkElementFlag flag2)
144{
145  return tFrameworkElementFlags(flag1) | tFrameworkElementFlags(flag2);
146}
147
148//----------------------------------------------------------------------
149// End of namespace declaration
150//----------------------------------------------------------------------
151}
152}
153
154
155#endif
Note: See TracBrowser for help on using the repository browser.