Class ROSField
Defined in File ros_field.hpp
Class Documentation
-
class ROSField
A ROSMessage will contain one or more ROSField(s). Each field is little more than a name / type pair.
Public Functions
-
ROSField(const std::string &definition)
-
inline const std::string &name() const
-
inline bool isConstant() const
True if field is a constant in message definition.
-
inline const std::string &value() const
If constant, value of field, else undefined.
-
inline bool isArray() const
True if the type is an array.
-
inline int arraySize() const
1 if !is_array, -1 if is_array and array is variable length, otherwise length in name
-
inline void setArray(bool is_array, int size)
-
inline bool isUpperBound() const
True if the field is a bounded sequence (e.g.
int32[<=5]). Bounded sequences carry a CDR length prefix on the wire just like unbounded ones, so arraySize() returns -1 in that case.
-
inline int maxSize() const
Declared upper bound for a bounded sequence, or -1 if not bounded.
-
inline const SmallVector<int, 2> &arrayDimensions() const
For multi-dimensional arrays: stores each dimension separately. E.g., data[3][4] → {3, 4}. Empty for 1D arrays or non-arrays.
-
inline void setArrayDimensions(const SmallVector<int, 2> &dims)
-
inline bool isOptional() const
-
inline void setOptional(bool optional)
-
inline bool isKey() const
-
inline void setIsKey(bool key)
-
inline const EnumDefinition *getEnum() const
-
inline void setEnumPtr(const EnumDefinition *ptr)
-
inline const DiscriminatedUnion *getUnion() const
-
inline void setUnionPtr(const DiscriminatedUnion *ptr)
-
std::shared_ptr<ROSMessage> getMessagePtr(const RosMessageLibrary &library) const
Protected Attributes
-
std::string _fieldname
-
std::string _value
-
bool _is_array
-
bool _is_constant = false
-
bool _is_bounded = false
-
int _array_size
-
int _max_size = -1
-
SmallVector<int, 2> _array_dims
-
bool _is_optional = false
-
bool _is_key = false
-
const EnumDefinition *_enum_ptr = nullptr
-
const DiscriminatedUnion *_union_ptr = nullptr
-
mutable const RosMessageLibrary *_cache_library = nullptr
-
mutable std::shared_ptr<ROSMessage> _cache_message
Friends
- friend class ROSMessage
-
ROSField(const std::string &definition)