Program Listing for File AnnotationParameterValue.h
↰ Return to documentation for file (/tmp/ws/src/fastrtps/include/fastrtps/types/AnnotationParameterValue.h
)
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _ANNOTATIONPARAMETERVALUE_H_
#define _ANNOTATIONPARAMETERVALUE_H_
#if _MSC_VER
#if defined(max)
#pragma push_macro("max")
#undef max
#define FASTDDS_RESTORE_MAX
#endif // defined(max)
#if defined(min)
#pragma push_macro("min")
#undef min
#define FASTDDS_RESTORE_MIN
#endif // defined(min)
#endif // if _MSC_VER
#include <fastrtps/types/TypesBase.h>
#include <fastrtps/types/TypeIdentifier.h>
#include <fastrtps/utils/string_convert.hpp>
#include <fastrtps/fastrtps_dll.h>
#include <stdint.h>
#include <array>
#include <vector>
namespace eprosima {
namespace fastcdr {
class Cdr;
} // namespace fastcdr
} // namespace eprosima
namespace eprosima {
namespace fastrtps {
namespace types {
class ExtendedAnnotationParameterValue
{
public:
RTPS_DllAPI ExtendedAnnotationParameterValue();
RTPS_DllAPI ~ExtendedAnnotationParameterValue();
RTPS_DllAPI ExtendedAnnotationParameterValue(
const ExtendedAnnotationParameterValue& x);
RTPS_DllAPI ExtendedAnnotationParameterValue(
ExtendedAnnotationParameterValue&& x);
RTPS_DllAPI ExtendedAnnotationParameterValue& operator =(
const ExtendedAnnotationParameterValue& x);
RTPS_DllAPI ExtendedAnnotationParameterValue& operator =(
ExtendedAnnotationParameterValue&& x);
RTPS_DllAPI static size_t getCdrSerializedSize(
const ExtendedAnnotationParameterValue& data,
size_t current_alignment = 0);
RTPS_DllAPI void serialize(
eprosima::fastcdr::Cdr& cdr) const;
RTPS_DllAPI void deserialize(
eprosima::fastcdr::Cdr& cdr);
RTPS_DllAPI static size_t getKeyMaxCdrSerializedSize(
size_t current_alignment = 0);
RTPS_DllAPI static bool isKeyDefined();
RTPS_DllAPI void serializeKey(
eprosima::fastcdr::Cdr& cdr) const;
RTPS_DllAPI bool operator ==(
const ExtendedAnnotationParameterValue&) const
{
return true;
}
private:
};
class AnnotationParameterValue
{
public:
RTPS_DllAPI AnnotationParameterValue();
RTPS_DllAPI ~AnnotationParameterValue();
RTPS_DllAPI AnnotationParameterValue(
const AnnotationParameterValue& x);
RTPS_DllAPI AnnotationParameterValue(
AnnotationParameterValue&& x);
RTPS_DllAPI AnnotationParameterValue& operator =(
const AnnotationParameterValue& x);
RTPS_DllAPI AnnotationParameterValue& operator =(
AnnotationParameterValue&& x);
RTPS_DllAPI void _d(
char __d);
RTPS_DllAPI char _d() const;
RTPS_DllAPI char& _d();
RTPS_DllAPI void boolean_value(
bool _boolean_value);
RTPS_DllAPI bool boolean_value() const;
RTPS_DllAPI bool& boolean_value();
RTPS_DllAPI void byte_value(
uint8_t _byte_value);
RTPS_DllAPI uint8_t byte_value() const;
RTPS_DllAPI uint8_t& byte_value();
RTPS_DllAPI void int16_value(
int16_t _int16_value);
RTPS_DllAPI int16_t int16_value() const;
RTPS_DllAPI int16_t& int16_value();
RTPS_DllAPI void uint_16_value(
uint16_t _uint_16_value);
RTPS_DllAPI uint16_t uint_16_value() const;
RTPS_DllAPI uint16_t& uint_16_value();
RTPS_DllAPI void int32_value(
int32_t _int32_value);
RTPS_DllAPI int32_t int32_value() const;
RTPS_DllAPI int32_t& int32_value();
RTPS_DllAPI void uint32_value(
uint32_t _uint32_value);
RTPS_DllAPI uint32_t uint32_value() const;
RTPS_DllAPI uint32_t& uint32_value();
RTPS_DllAPI void int64_value(
int64_t _int64_value);
RTPS_DllAPI int64_t int64_value() const;
RTPS_DllAPI int64_t& int64_value();
RTPS_DllAPI void uint64_value(
uint64_t _uint64_value);
RTPS_DllAPI uint64_t uint64_value() const;
RTPS_DllAPI uint64_t& uint64_value();
RTPS_DllAPI void float32_value(
float _float32_value);
RTPS_DllAPI float float32_value() const;
RTPS_DllAPI float& float32_value();
RTPS_DllAPI void float64_value(
double _float64_value);
RTPS_DllAPI double float64_value() const;
RTPS_DllAPI double& float64_value();
RTPS_DllAPI void float128_value(
long double _float128_value);
RTPS_DllAPI long double float128_value() const;
RTPS_DllAPI long double& float128_value();
RTPS_DllAPI void char_value(
char _char_value);
RTPS_DllAPI char char_value() const;
RTPS_DllAPI char& char_value();
RTPS_DllAPI void wchar_value(
wchar_t _wchar_value);
RTPS_DllAPI wchar_t wchar_value() const;
RTPS_DllAPI wchar_t& wchar_value();
RTPS_DllAPI void enumerated_value(
int32_t _enumerated_value);
RTPS_DllAPI int32_t enumerated_value() const;
RTPS_DllAPI int32_t& enumerated_value();
RTPS_DllAPI void string8_value(
const std::string& _string8_value);
RTPS_DllAPI void string8_value(
std::string&& _string8_value);
RTPS_DllAPI const std::string& string8_value() const;
RTPS_DllAPI std::string& string8_value();
RTPS_DllAPI void string16_value(
const std::wstring& _string16_value);
RTPS_DllAPI void string16_value(
std::wstring&& _string16_value);
RTPS_DllAPI const std::wstring& string16_value() const;
RTPS_DllAPI std::wstring& string16_value();
RTPS_DllAPI void extended_value(
const ExtendedAnnotationParameterValue& _extended_value);
RTPS_DllAPI void extended_value(
ExtendedAnnotationParameterValue&& _extended_value);
RTPS_DllAPI const ExtendedAnnotationParameterValue& extended_value() const;
RTPS_DllAPI ExtendedAnnotationParameterValue& extended_value();
RTPS_DllAPI static size_t getCdrSerializedSize(
const AnnotationParameterValue& data,
size_t current_alignment = 0);
RTPS_DllAPI void serialize(
eprosima::fastcdr::Cdr& cdr) const;
RTPS_DllAPI void deserialize(
eprosima::fastcdr::Cdr& cdr);
RTPS_DllAPI static size_t getKeyMaxCdrSerializedSize(
size_t current_alignment = 0);
RTPS_DllAPI static bool isKeyDefined();
RTPS_DllAPI void serializeKey(
eprosima::fastcdr::Cdr& cdr) const;
RTPS_DllAPI bool operator ==(
const AnnotationParameterValue& other) const;
RTPS_DllAPI std::string to_string() const
{
switch (m__d)
{
case TK_BOOLEAN:
return (m_boolean_value) ? "true" : "false";
case TK_BYTE:
return std::to_string(m_byte_value);
case TK_INT16:
return std::to_string(m_int16_value);
case TK_UINT16:
return std::to_string(m_uint_16_value);
case TK_INT32:
return std::to_string(m_int32_value);
case TK_UINT32:
return std::to_string(m_uint32_value);
case TK_INT64:
return std::to_string(m_int64_value);
case TK_UINT64:
return std::to_string(m_uint64_value);
case TK_FLOAT32:
return std::to_string(m_float32_value);
case TK_FLOAT64:
return std::to_string(m_float64_value);
case TK_FLOAT128:
return std::to_string(m_float128_value);
case TK_CHAR8:
return std::to_string(m_char_value);
case TK_CHAR16:
return std::to_string(m_wchar_value);
case TK_ENUM:
return std::to_string(m_enumerated_value);
case TK_STRING16:
{
return wstring_to_bytes(m_string16_value);
}
case TK_STRING8:
case TK_NONE: // Cheat!
return m_string8_value;
default:
return "";
}
}
RTPS_DllAPI void from_string(
const std::string& value)
{
switch (m__d)
{
case TK_BOOLEAN:
{
std::string val_ = value;
std::transform(val_.begin(), val_.end(), val_.begin(),
[](unsigned char c)
{
return static_cast<char>(std::tolower(c));
});
boolean_value(val_.compare("0") != 0 || val_.compare(CONST_TRUE) == 0);
}
break;
case TK_BYTE:
{
byte_value(static_cast<uint8_t>(std::stoul(value)));
}
break;
case TK_INT16:
{
int16_value(static_cast<int16_t>(std::stoi(value)));
}
break;
case TK_INT32:
{
int32_value(static_cast<int32_t>(std::stoi(value)));
}
break;
case TK_INT64:
{
int64_value(static_cast<int64_t>(std::stoll(value)));
}
break;
case TK_UINT16:
{
uint_16_value(static_cast<uint16_t>(std::stoul(value)));
}
break;
case TK_UINT32:
{
uint32_value(static_cast<uint32_t>(std::stoul(value)));
}
break;
case TK_UINT64:
{
uint64_value(static_cast<uint64_t>(std::stoull(value)));
}
break;
case TK_FLOAT32:
{
float32_value(std::stof(value));
}
break;
case TK_FLOAT64:
{
float64_value(std::stod(value));
}
break;
case TK_FLOAT128:
{
float128_value(std::stold(value));
}
break;
case TK_CHAR8:
{
char_value(value.c_str()[0]);
}
break;
case TK_CHAR16:
{
wchar_value(wstring_from_bytes(value).c_str()[0]);
}
break;
case TK_STRING8:
case TK_NONE: // Cheat!
{
string8_value(value);
}
break;
case TK_STRING16:
{
string16_value(wstring_from_bytes(value));
}
break;
case TK_ENUM:
{
// TODO Translate from enum value name to integer value
enumerated_value(static_cast<int32_t>(std::stoul(value)));
}
break;
default:
break;
}
}
private:
char m__d;
bool m_boolean_value;
uint8_t m_byte_value;
int16_t m_int16_value;
uint16_t m_uint_16_value;
int32_t m_int32_value;
uint32_t m_uint32_value;
int64_t m_int64_value;
uint64_t m_uint64_value;
float m_float32_value;
double m_float64_value;
long double m_float128_value;
char m_char_value;
wchar_t m_wchar_value;
int32_t m_enumerated_value;
std::string m_string8_value;
std::wstring m_string16_value;
ExtendedAnnotationParameterValue m_extended_value;
};
class AppliedAnnotationParameter
{
public:
RTPS_DllAPI AppliedAnnotationParameter();
RTPS_DllAPI ~AppliedAnnotationParameter();
RTPS_DllAPI AppliedAnnotationParameter(
const AppliedAnnotationParameter& x);
RTPS_DllAPI AppliedAnnotationParameter(
AppliedAnnotationParameter&& x);
RTPS_DllAPI AppliedAnnotationParameter& operator =(
const AppliedAnnotationParameter& x);
RTPS_DllAPI AppliedAnnotationParameter& operator =(
AppliedAnnotationParameter&& x);
inline void paramname_hash(
const NameHash& _paramname_hash)
{
m_paramname_hash = _paramname_hash;
}
inline void paramname_hash(
NameHash&& _paramname_hash)
{
m_paramname_hash = std::move(_paramname_hash);
}
inline const NameHash& paramname_hash() const
{
return m_paramname_hash;
}
inline NameHash& paramname_hash()
{
return m_paramname_hash;
}
inline void value(
const AnnotationParameterValue& _value)
{
m_value = _value;
}
inline void value(
AnnotationParameterValue&& _value)
{
m_value = std::move(_value);
}
inline const AnnotationParameterValue& value() const
{
return m_value;
}
inline AnnotationParameterValue& value()
{
return m_value;
}
RTPS_DllAPI static size_t getCdrSerializedSize(
const AppliedAnnotationParameter& data,
size_t current_alignment = 0);
RTPS_DllAPI void serialize(
eprosima::fastcdr::Cdr& cdr) const;
RTPS_DllAPI void deserialize(
eprosima::fastcdr::Cdr& cdr);
RTPS_DllAPI static size_t getKeyMaxCdrSerializedSize(
size_t current_alignment = 0);
RTPS_DllAPI static bool isKeyDefined();
RTPS_DllAPI void serializeKey(
eprosima::fastcdr::Cdr& cdr) const;
RTPS_DllAPI bool operator ==(
const AppliedAnnotationParameter& other) const;
private:
NameHash m_paramname_hash;
AnnotationParameterValue m_value;
};
// The application of an annotation to some type or type member
/*struct AppliedAnnotationParameter {
NameHash paramname_hash;
AnnotationParameterValue value;
};*/
/*
class AppliedAnnotationParameter
{
public:
AppliedAnnotationParameter();
~AppliedAnnotationParameter();
AppliedAnnotationParameter(const AppliedAnnotationParameter &x);
AppliedAnnotationParameter(AppliedAnnotationParameter &&x);
AppliedAnnotationParameter& operator=(const AppliedAnnotationParameter &x);
AppliedAnnotationParameter& operator=(AppliedAnnotationParameter &&x);
inline void paramname_hash(const NameHash &_paramname_hash) { m_paramname_hash = _paramname_hash; }
inline void paramname_hash(NameHash &&_paramname_hash) { m_paramname_hash = std::move(_paramname_hash); }
inline const NameHash& paramname_hash() const { return m_paramname_hash; }
inline NameHash& paramname_hash() { return m_paramname_hash; }
inline void value(const AnnotationParameterValue &_value) { m_value = _value; }
inline void value(AnnotationParameterValue &&_value) { m_value = std::move(_value); }
inline const AnnotationParameterValue& value() const { return m_value; }
inline AnnotationParameterValue& value() { return m_value; }
static size_t getCdrSerializedSize(const AppliedAnnotationParameter& data, size_t current_alignment = 0);
void serialize(eprosima::fastcdr::Cdr &cdr) const;
void deserialize(eprosima::fastcdr::Cdr &cdr);
static size_t getKeyMaxCdrSerializedSize(size_t current_alignment = 0);
static bool isKeyDefined();
void serializeKey(eprosima::fastcdr::Cdr &cdr) const;
private:
NameHash m_paramname_hash;
AnnotationParameterValue m_value;
};
*/
// Sorted by AppliedAnnotationParameter.paramname_hash
typedef std::vector<AppliedAnnotationParameter> AppliedAnnotationParameterSeq;
/*struct AppliedAnnotation {
TypeIdentifier annotation_typeid;
AppliedAnnotationParameterSeq param_seq; // @Optional
};*/
class AppliedAnnotation
{
public:
RTPS_DllAPI AppliedAnnotation();
RTPS_DllAPI ~AppliedAnnotation();
RTPS_DllAPI AppliedAnnotation(
const AppliedAnnotation& x);
RTPS_DllAPI AppliedAnnotation(
AppliedAnnotation&& x);
RTPS_DllAPI AppliedAnnotation& operator =(
const AppliedAnnotation& x);
RTPS_DllAPI AppliedAnnotation& operator =(
AppliedAnnotation&& x);
inline void annotation_typeid(
const TypeIdentifier& _annotation_typeid)
{
m_annotation_typeid = _annotation_typeid;
}
inline void annotation_typeid(
TypeIdentifier&& _annotation_typeid)
{
m_annotation_typeid = std::move(_annotation_typeid);
}
inline const TypeIdentifier& annotation_typeid() const
{
return m_annotation_typeid;
}
inline TypeIdentifier& annotation_typeid()
{
return m_annotation_typeid;
}
inline void param_seq(
const AppliedAnnotationParameterSeq& _param_seq)
{
m_param_seq = _param_seq;
}
inline void param_seq(
AppliedAnnotationParameterSeq&& _param_seq)
{
m_param_seq = std::move(_param_seq);
}
inline const AppliedAnnotationParameterSeq& param_seq() const
{
return m_param_seq;
}
inline AppliedAnnotationParameterSeq& param_seq()
{
return m_param_seq;
}
RTPS_DllAPI static size_t getCdrSerializedSize(
const AppliedAnnotation& data,
size_t current_alignment = 0);
RTPS_DllAPI void serialize(
eprosima::fastcdr::Cdr& cdr) const;
RTPS_DllAPI void deserialize(
eprosima::fastcdr::Cdr& cdr);
RTPS_DllAPI static size_t getKeyMaxCdrSerializedSize(
size_t current_alignment = 0);
RTPS_DllAPI static bool isKeyDefined();
RTPS_DllAPI void serializeKey(
eprosima::fastcdr::Cdr& cdr) const;
RTPS_DllAPI bool operator ==(
const AppliedAnnotation& other) const;
private:
TypeIdentifier m_annotation_typeid;
AppliedAnnotationParameterSeq m_param_seq;
};
// Sorted by AppliedAnnotation.annotation_typeid
typedef std::vector<AppliedAnnotation> AppliedAnnotationSeq;
// @verbatim(placement="<placement>", language="<lang>", text="<text>")
/*struct AppliedVerbatimAnnotation {
std::string placement; // 32
std::string language; // 32
std::string text;
};*/
class AppliedVerbatimAnnotation
{
public:
RTPS_DllAPI AppliedVerbatimAnnotation();
RTPS_DllAPI ~AppliedVerbatimAnnotation();
RTPS_DllAPI AppliedVerbatimAnnotation(
const AppliedVerbatimAnnotation& x);
RTPS_DllAPI AppliedVerbatimAnnotation(
AppliedVerbatimAnnotation&& x);
RTPS_DllAPI AppliedVerbatimAnnotation& operator =(
const AppliedVerbatimAnnotation& x);
RTPS_DllAPI AppliedVerbatimAnnotation& operator =(
AppliedVerbatimAnnotation&& x);
inline void placement(
const std::string& _placement)
{
m_placement = _placement;
}
inline void placement(
std::string&& _placement)
{
m_placement = std::move(_placement);
}
inline const std::string& placement() const
{
return m_placement;
}
inline std::string& placement()
{
return m_placement;
}
inline void language(
const std::string& _language)
{
m_language = _language;
}
inline void language(
std::string&& _language)
{
m_language = std::move(_language);
}
inline const std::string& language() const
{
return m_language;
}
inline std::string& language()
{
return m_language;
}
inline void text(
const std::string& _text)
{
m_text = _text;
}
inline void text(
std::string&& _text)
{
m_text = std::move(_text);
}
inline const std::string& text() const
{
return m_text;
}
inline std::string& text()
{
return m_text;
}
RTPS_DllAPI static size_t getCdrSerializedSize(
const AppliedVerbatimAnnotation& data,
size_t current_alignment = 0);
RTPS_DllAPI void serialize(
eprosima::fastcdr::Cdr& cdr) const;
RTPS_DllAPI void deserialize(
eprosima::fastcdr::Cdr& cdr);
RTPS_DllAPI static size_t getKeyMaxCdrSerializedSize(
size_t current_alignment = 0);
RTPS_DllAPI static bool isKeyDefined();
RTPS_DllAPI void serializeKey(
eprosima::fastcdr::Cdr& cdr) const;
RTPS_DllAPI bool operator ==(
const AppliedVerbatimAnnotation& other) const;
private:
std::string m_placement;
std::string m_language;
std::string m_text;
};
// --- Aggregate types: -----------------------------------------------
/*struct AppliedBuiltinMemberAnnotations {
std::string unit; // @unit("<unit>") // @Optional
AnnotationParameterValue min; // @min , @range // @Optional
AnnotationParameterValue max; // @max , @range // @Optional
std::string hash_id; // @hash_id("<membername>") // @Optional
};
*/
class AppliedBuiltinMemberAnnotations
{
public:
RTPS_DllAPI AppliedBuiltinMemberAnnotations();
RTPS_DllAPI ~AppliedBuiltinMemberAnnotations();
RTPS_DllAPI AppliedBuiltinMemberAnnotations(
const AppliedBuiltinMemberAnnotations& x);
RTPS_DllAPI AppliedBuiltinMemberAnnotations(
AppliedBuiltinMemberAnnotations&& x);
RTPS_DllAPI AppliedBuiltinMemberAnnotations& operator =(
const AppliedBuiltinMemberAnnotations& x);
RTPS_DllAPI AppliedBuiltinMemberAnnotations& operator =(
AppliedBuiltinMemberAnnotations&& x);
inline void unit(
const std::string& _unit)
{
m_unit = _unit;
}
inline void unit(
std::string&& _unit)
{
m_unit = std::move(_unit);
}
inline const std::string& unit() const
{
return m_unit;
}
inline std::string& unit()
{
return m_unit;
}
inline void min(
const AnnotationParameterValue& _min)
{
m_min = _min;
}
inline void min(
AnnotationParameterValue&& _min)
{
m_min = std::move(_min);
}
inline const AnnotationParameterValue& min() const
{
return m_min;
}
inline AnnotationParameterValue& min()
{
return m_min;
}
inline void max(
const AnnotationParameterValue& _max)
{
m_max = _max;
}
inline void max(
AnnotationParameterValue&& _max)
{
m_max = std::move(_max);
}
inline const AnnotationParameterValue& max() const
{
return m_max;
}
inline AnnotationParameterValue& max()
{
return m_max;
}
inline void hash_id(
const std::string& _hash_id)
{
m_hash_id = _hash_id;
}
inline void hash_id(
std::string&& _hash_id)
{
m_hash_id = std::move(_hash_id);
}
inline const std::string& hash_id() const
{
return m_hash_id;
}
inline std::string& hash_id()
{
return m_hash_id;
}
RTPS_DllAPI static size_t getCdrSerializedSize(
const AppliedBuiltinMemberAnnotations& data,
size_t current_alignment = 0);
RTPS_DllAPI void serialize(
eprosima::fastcdr::Cdr& cdr) const;
RTPS_DllAPI void deserialize(
eprosima::fastcdr::Cdr& cdr);
RTPS_DllAPI static size_t getKeyMaxCdrSerializedSize(
size_t current_alignment = 0);
RTPS_DllAPI static bool isKeyDefined();
RTPS_DllAPI void serializeKey(
eprosima::fastcdr::Cdr& cdr) const;
RTPS_DllAPI bool operator ==(
const AppliedBuiltinMemberAnnotations& other) const;
private:
std::string m_unit;
AnnotationParameterValue m_min;
AnnotationParameterValue m_max;
std::string m_hash_id;
};
} // namespace types
} // namespace fastrtps
} // namespace eprosima
#if _MSC_VER
#if defined(FASTDDS_RESTORE_MIN)
#pragma pop_macro("min")
#undef FASTDDS_RESTORE_MIN
#endif // defined(FASTDDS_RESTORE_MIN)
#if defined(FASTDDS_RESTORE_MAX)
#pragma pop_macro("max")
#undef FASTDDS_RESTORE_MAX
#endif // defined(FASTDDS_RESTORE_MAX)
#endif // if _MSC_VER
#endif // _ANNOTATIONPARAMETERVALUE_H_