OpenDDS
Snapshot(2023/04/28-20:55)
|
#include "be_extern.h"
#include "be_util.h"
#include <dds/DCPS/ValueHelper.h>
#include <utl_scoped_name.h>
#include <utl_identifier.h>
#include <utl_string.h>
#include <ast.h>
#include <ast_component_fwd.h>
#include <ast_eventtype_fwd.h>
#include <ast_structure_fwd.h>
#include <ast_union_fwd.h>
#include <ast_valuetype_fwd.h>
#include <ace/CDR_Base.h>
#include <string>
#include <vector>
#include <cstring>
#include <set>
#include <stdexcept>
#include <iomanip>
#include <cctype>
#include <climits>
Go to the source code of this file.
Classes | |
class | dds_generator |
class | composite_generator |
struct | NamespaceGuard |
struct | ScopedNamespaceGuard |
struct | Function |
class | PreprocessorIfGuard |
struct | NestedForLoops |
struct | Intro |
class | Fields |
class | Fields::Iterator |
struct | RefWrapper |
Namespaces | |
AstTypeClassification | |
Typedefs | |
typedef size_t | AstTypeClassification::Classification |
typedef std::string(* | CommonFn) (const std::string &indent, AST_Decl *node, const std::string &name, AST_Type *type, const std::string &prefix, bool wrap_nested_key_only, Intro &intro, const std::string &) |
Enumerations | |
enum | EscapeContext { EscapeContext_ForGenIdl, EscapeContext_FromGenIdl, EscapeContext_StripEscapes, EscapeContext_Normal } |
enum | WrapDirection { WD_OUTPUT, WD_INPUT } |
enum | FieldFilter { FieldFilter_All, FieldFilter_NestedKeyOnly, FieldFilter_KeyOnly } |
Functions | |
std::string | canonical_name (UTL_ScopedName *sn) |
std::string | canonical_name (Identifier *id) |
std::string | canonical_name (AST_Decl *node) |
std::string | scoped (UTL_ScopedName *sn, EscapeContext ec=EscapeContext_Normal) |
std::string | module_scope (UTL_ScopedName *sn) |
AST_Type * | AstTypeClassification::resolveActualType (AST_Type *element) |
Classification | AstTypeClassification::classify (AST_Type *type) |
std::string | wrapPrefix (AST_Type *type, WrapDirection wd) |
std::string | string_type (AstTypeClassification::Classification cls) |
std::string | to_cxx_type (AST_Type *type, std::size_t &size) |
std::string | getWrapper (const std::string &name, AST_Type *type, WrapDirection wd) |
std::string | getEnumLabel (AST_Expression *label_val, AST_Type *disc) |
std::ostream & | operator<< (std::ostream &o, const AST_Expression::AST_ExprValue &ev) |
std::string | bounded_arg (AST_Type *type) |
std::string | type_to_default (const std::string &indent, AST_Type *type, const std::string &name, bool is_anonymous=false, bool is_union=false) |
void | generateBranchLabels (AST_UnionBranch *branch, AST_Type *discriminator, size_t &n_labels, bool &has_default) |
bool | needSyntheticDefault (AST_Type *disc, size_t n_labels) |
std::string | field_type_name (AST_Field *field, AST_Type *field_type=0) |
AST_Type * | deepest_named_type (AST_Type *type) |
void | generateCaseBody (CommonFn commonFn, CommonFn commonFn2, AST_UnionBranch *branch, const char *statementPrefix, const char *namePrefix, const char *uni, bool generateBreaks, bool parens) |
bool | generateSwitchBody (AST_Union *, CommonFn commonFn, const std::vector< AST_UnionBranch *> &branches, AST_Type *discriminator, const char *statementPrefix, const char *namePrefix="", const char *uni="", bool forceDisableDefault=false, bool parens=true, bool breaks=true, CommonFn commonFn2=0) |
bool | generateSwitchForUnion (AST_Union *u, const char *switchExpr, CommonFn commonFn, const std::vector< AST_UnionBranch *> &branches, AST_Type *discriminator, const char *statementPrefix, const char *namePrefix="", const char *uni="", bool forceDisableDefault=false, bool parens=true, bool breaks=true, CommonFn commonFn2=0) |
returns true if a default: branch was generated (no default: label in IDL) More... | |
std::string | insert_cxx11_accessor_parens (const std::string &full_var_name_, bool is_union_member=false) |
AST_Field * | get_struct_field (AST_Structure *struct_node, unsigned index) |
bool | struct_has_explicit_keys (AST_Structure *node) |
ACE_CDR::ULong | array_element_count (AST_Array *arr) |
ACE_CDR::ULong | container_element_limit (AST_Type *type) |
AST_Type * | container_base_type (AST_Type *type) |
bool | needs_nested_key_only (AST_Type *type) |
bool | needs_forany (AST_Type *type) |
bool | needs_distinct_type (AST_Type *type) |
std::string | strip_shift_op (const std::string &s) |
const char * | get_shift_op (const std::string &s) |
Variables | |
const Classification | AstTypeClassification::CL_UNKNOWN = 0 |
const Classification | AstTypeClassification::CL_SCALAR = 1 |
const Classification | AstTypeClassification::CL_PRIMITIVE = 2 |
const Classification | AstTypeClassification::CL_STRUCTURE = 4 |
const Classification | AstTypeClassification::CL_STRING = 8 |
const Classification | AstTypeClassification::CL_ENUM = 16 |
const Classification | AstTypeClassification::CL_UNION = 32 |
const Classification | AstTypeClassification::CL_ARRAY = 64 |
const Classification | AstTypeClassification::CL_SEQUENCE = 128 |
const Classification | AstTypeClassification::CL_WIDE = 256 |
const Classification | AstTypeClassification::CL_BOUNDED = 512 |
const Classification | AstTypeClassification::CL_INTERFACE = 1024 |
const Classification | AstTypeClassification::CL_FIXED = 2048 |
const char *const | shift_out = "<< " |
const char *const | shift_in = ">> " |
typedef std::string(* CommonFn) (const std::string &indent, AST_Decl *node, const std::string &name, AST_Type *type, const std::string &prefix, bool wrap_nested_key_only, Intro &intro, const std::string &) |
Definition at line 799 of file dds_generator.h.
enum EscapeContext |
How to handle IDL underscore escaping. Depends on where the name is going and where the name came from.
Definition at line 37 of file dds_generator.h.
enum FieldFilter |
Enumerator | |
---|---|
FieldFilter_All | |
FieldFilter_NestedKeyOnly | |
FieldFilter_KeyOnly |
Definition at line 1070 of file dds_generator.h.
enum WrapDirection |
Enumerator | |
---|---|
WD_OUTPUT | |
WD_INPUT |
Definition at line 477 of file dds_generator.h.
|
inline |
Definition at line 1221 of file dds_generator.h.
Referenced by container_element_limit(), marshal_generator::gen_enum(), metaclass_generator::gen_typedef(), and generate_anon_fields().
|
inline |
Definition at line 694 of file dds_generator.h.
References AstTypeClassification::CL_SEQUENCE, AstTypeClassification::CL_STRING, AstTypeClassification::classify(), name, and type_to_default().
Referenced by marshal_generator::gen_enum(), marshal_generator::gen_typedef(), and generateCaseBody().
|
inline |
Definition at line 119 of file dds_generator.h.
References EscapeContext_StripEscapes, and dds_generator::scoped_helper().
Referenced by canonical_name(), marshal_generator::gen_enum(), value_reader_generator::gen_enum(), value_writer_generator::gen_enum(), metaclass_generator::gen_enum(), marshal_generator::gen_field_getValueFromSerialized(), value_writer_generator::gen_struct(), value_reader_generator::gen_struct(), typeobject_generator::generate_alias_type_identifier(), typeobject_generator::generate_array_type_identifier(), typeobject_generator::generate_enum_type_identifier(), typeobject_generator::generate_struct_type_identifier(), typeobject_generator::generate_union_type_identifier(), invalid_option(), TopicKeys::Iterator::path_i(), and typeobject_generator::strong_connect().
|
inline |
Definition at line 125 of file dds_generator.h.
References EscapeContext_StripEscapes, and dds_generator::to_string().
|
inline |
|
inline |
Definition at line 1245 of file dds_generator.h.
References AstTypeClassification::resolveActualType().
Referenced by FieldInfo::EleLen::EleLen().
|
inline |
Definition at line 1231 of file dds_generator.h.
References array_element_count(), and AstTypeClassification::resolveActualType().
AST_Type* deepest_named_type | ( | AST_Type * | type | ) |
For the some situations, like a tag name, the type name we need is the deepest named type, not the actual type. This will be the name of the deepest typedef if it's an array or sequence, otherwise the name of the type.
Definition at line 442 of file dds_generator.cpp.
Referenced by field_type_name(), marshal_generator::gen_enum(), marshal_generator::gen_field_getValueFromSerialized(), metaclass_generator::gen_typedef(), gen_union_branch(), generate_anon_fields(), Intro::insert(), and type_to_default_array().
std::string field_type_name | ( | AST_Field * | field, |
AST_Type * | field_type = 0 |
||
) |
Definition at line 425 of file dds_generator.cpp.
References FieldInfo::as_base_, AstTypeClassification::CL_STRING, AstTypeClassification::classify(), deepest_named_type(), name, scoped(), FieldInfo::scoped_type_, string_type(), and FieldInfo::type_.
Referenced by marshal_generator::gen_field_getValueFromSerialized(), marshal_generator::gen_typedef(), gen_union_branch(), generateCaseBody(), and Intro::insert().
|
inline |
Definition at line 713 of file dds_generator.h.
References be_global, and getEnumLabel().
Referenced by generateSwitchBody().
|
inline |
Definition at line 806 of file dds_generator.h.
References be_global, bounded_arg(), AstTypeClassification::CL_ARRAY, AstTypeClassification::CL_BOUNDED, AstTypeClassification::CL_SEQUENCE, AstTypeClassification::CL_STRING, AstTypeClassification::CL_WIDE, AstTypeClassification::classify(), field_type_name(), dds_generator::get_tag_name(), getWrapper(), Intro::join(), name, AstTypeClassification::resolveActualType(), tryconstructfailaction_trim, tryconstructfailaction_use_default, type_to_default(), and WD_INPUT.
Referenced by generateSwitchBody(), and generateSwitchForUnion().
|
inline |
Definition at line 934 of file dds_generator.h.
References be_global, generateBranchLabels(), generateCaseBody(), and needSyntheticDefault().
Referenced by marshal_generator::gen_field_getValueFromSerialized(), and generateSwitchForUnion().
|
inline |
returns true if a default: branch was generated (no default: label in IDL)
Definition at line 975 of file dds_generator.h.
References be_global, generateCaseBody(), generateSwitchBody(), and AstTypeClassification::resolveActualType().
Referenced by marshal_generator::gen_field_getValueFromSerialized(), marshal_generator::gen_union(), value_writer_generator::gen_union(), value_reader_generator::gen_union(), metaclass_generator::gen_union(), GeneratorBase::gen_union(), and Cxx11Generator::gen_union().
|
inline |
|
inline |
Definition at line 1077 of file dds_generator.h.
Referenced by marshal_generator::gen_typedef(), Fields::Iterator::operator*(), and struct_has_explicit_keys().
|
inline |
Definition at line 618 of file dds_generator.h.
References be_global, and scoped().
Referenced by generateBranchLabels(), GeneratorBase::GenerateUnionAccessors::operator()(), and Cxx11Generator::union_accessors().
|
inline |
Definition at line 603 of file dds_generator.h.
References be_global, AstTypeClassification::CL_BOUNDED, AstTypeClassification::CL_STRING, AstTypeClassification::CL_WIDE, AstTypeClassification::classify(), WD_OUTPUT, and wrapPrefix().
Referenced by marshal_generator::gen_enum(), marshal_generator::gen_field_getValueFromSerialized(), marshal_generator::gen_typedef(), marshal_generator::gen_union(), metaclass_generator::gen_union(), marshal_generator::gen_union_default(), and generateCaseBody().
|
inline |
Definition at line 1043 of file dds_generator.h.
References be_global.
Referenced by keys_generator::gen_struct(), and marshal_generator::gen_typedef().
|
inline |
Definition at line 367 of file dds_generator.h.
References dds_generator::module_scope_helper().
Referenced by value_writer_generator::gen_enum().
|
inline |
Definition at line 1324 of file dds_generator.h.
References be_global, AstTypeClassification::CL_ARRAY, AstTypeClassification::CL_SEQUENCE, AstTypeClassification::classify(), and AstTypeClassification::resolveActualType().
Referenced by RefWrapper::done().
|
inline |
Definition at line 1316 of file dds_generator.h.
References be_global, AstTypeClassification::CL_ARRAY, AstTypeClassification::classify(), and AstTypeClassification::resolveActualType().
Referenced by RefWrapper::done().
|
inline |
Returns true for a type if nested key serialization is different from normal serialization.
Definition at line 1262 of file dds_generator.h.
References be_global, Fields::begin(), AstTypeClassification::CL_ARRAY, AstTypeClassification::CL_SEQUENCE, AstTypeClassification::CL_STRUCTURE, AstTypeClassification::CL_UNION, AstTypeClassification::classify(), Fields::end(), name, AstTypeClassification::resolveActualType(), scoped(), and struct_has_explicit_keys().
Referenced by RefWrapper::done(), and marshal_generator::gen_enum().
|
inline |
Definition at line 733 of file dds_generator.h.
References ACE_OCTET_MAX, ACE_UINT16_MAX, and ACE_UINT32_MAX.
Referenced by generateSwitchBody(), and GeneratorBase::needsDefault().
|
inline |
Definition at line 633 of file dds_generator.h.
References ACE_INT32_MIN, ACE_INT64_MIN, OpenDDS::DCPS::hex_value(), ACE_CDR::Fixed::MAX_STRING_SIZE, and be_util::misc_error_and_abort().
|
inline |
Definition at line 358 of file dds_generator.h.
References dds_generator::scoped_helper().
Referenced by field_type_name(), GeneratorBase::gen_array_traits(), langmap_generator::gen_const(), marshal_generator::gen_enum(), value_writer_generator::gen_enum(), value_reader_generator::gen_enum(), metaclass_generator::gen_enum(), marshal_generator::gen_field_getValueFromSerialized(), marshal_generator::gen_struct(), value_writer_generator::gen_struct(), value_reader_generator::gen_struct(), metaclass_generator::gen_struct(), dynamic_data_adapter_generator::gen_typedef(), marshal_generator::gen_typedef(), metaclass_generator::gen_typedef(), marshal_generator::gen_union(), value_writer_generator::gen_union(), value_reader_generator::gen_union(), metaclass_generator::gen_union(), GeneratorBase::gen_union(), marshal_generator::gen_union_default(), java_ts_generator::generate(), face_ts_generator::generate(), generate_anon_fields(), ts_generator::generate_ts(), GeneratorBase::generateDefaultValue(), getEnumLabel(), GeneratorBase::map_type(), needs_nested_key_only(), FieldInfo::scoped_type(), to_cxx_type(), type_to_default(), type_to_default_array(), and FieldInfo::underscore().
|
inline |
Definition at line 521 of file dds_generator.h.
References be_global, and AstTypeClassification::CL_WIDE.
Referenced by field_type_name(), metaclass_generator::gen_enum(), and to_cxx_type().
|
inline |
Definition at line 1335 of file dds_generator.h.
References shift_in, and shift_out.
|
inline |
Definition at line 1088 of file dds_generator.h.
References be_global, and get_struct_field().
Referenced by Fields::explicit_keys_only(), OpenDDS::XTypes::DynamicDataXcdrReadImpl::get_item_count(), OpenDDS::XTypes::DynamicDataXcdrReadImpl::get_member_id_at_index(), needs_nested_key_only(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_structure_xcdr2(), and OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialized_size_structure_xcdr2().
|
inline |
Definition at line 528 of file dds_generator.h.
References AstTypeClassification::CL_ENUM, AstTypeClassification::CL_PRIMITIVE, AstTypeClassification::CL_STRING, AstTypeClassification::classify(), be_util::misc_error_and_abort(), AstTypeClassification::resolveActualType(), scoped(), and string_type().
Referenced by marshal_generator::gen_field_getValueFromSerialized(), metaclass_generator::gen_typedef(), gen_union_branch(), and generate_anon_fields().
std::string type_to_default | ( | const std::string & | indent, |
AST_Type * | type, | ||
const std::string & | name, | ||
bool | is_anonymous = false , |
||
bool | is_union = false |
||
) |
Definition at line 359 of file dds_generator.cpp.
References be_global, AstTypeClassification::CL_ARRAY, AstTypeClassification::CL_ENUM, AstTypeClassification::CL_FIXED, AstTypeClassification::CL_PRIMITIVE, AstTypeClassification::CL_SEQUENCE, AstTypeClassification::CL_STRING, AstTypeClassification::CL_STRUCTURE, AstTypeClassification::CL_UNION, AstTypeClassification::CL_WIDE, AstTypeClassification::classify(), AstTypeClassification::resolveActualType(), scoped(), and type_to_default_array().
Referenced by bounded_arg(), marshal_generator::gen_enum(), marshal_generator::gen_struct(), marshal_generator::gen_typedef(), marshal_generator::gen_union(), marshal_generator::gen_union_default(), and generateCaseBody().
|
inline |
Definition at line 480 of file dds_generator.h.
References WD_OUTPUT.
Referenced by getWrapper().
const char* const shift_in = ">> " |
Definition at line 1333 of file dds_generator.h.
Referenced by RefWrapper::done(), get_shift_op(), and strip_shift_op().
const char* const shift_out = "<< " |
Definition at line 1332 of file dds_generator.h.
Referenced by get_shift_op(), and strip_shift_op().