OpenDDS  Snapshot(2023/04/28-20:55)
Public Member Functions | Protected Member Functions | List of all members
OpenDDS::DataRepresentationAnnotation Class Reference

#include <annotations.h>

Inheritance diagram for OpenDDS::DataRepresentationAnnotation:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DataRepresentationAnnotation:
Collaboration graph
[legend]

Public Member Functions

std::string definition () const
 
std::string name () const
 
std::string module () const
 
bool node_value_exists (AST_Decl *node, DataRepresentation &value) const
 
- Public Member Functions inherited from AnnotationWithValue< DataRepresentation >
virtual bool node_value_exists (AST_Decl *node, DataRepresentation &value) const
 
- Public Member Functions inherited from Annotation
 Annotation ()
 
virtual ~Annotation ()
 
virtual std::string fullname () const
 
AST_Annotation_Decl * declaration () const
 
AST_Annotation_Appl * find_on (AST_Decl *node) const
 
void cache ()
 

Protected Member Functions

DataRepresentation value_from_appl (AST_Annotation_Appl *appl) const
 

Detailed Description

Used to specify the allowed RTPS data representations in XTypes. Replacement for ::data_representation which requires bitmask.

Definition at line 406 of file annotations.h.

Member Function Documentation

◆ definition()

std::string OpenDDS::DataRepresentationAnnotation::definition ( ) const
virtual

Implements Annotation.

Definition at line 437 of file annotations.cpp.

438  {
439  return
440  "module OpenDDS {\n"
441  " @annotation data_representation {\n"
442  " enum Kind_t {\n"
443  " XCDR1,\n"
444  " XML,\n"
445  " XCDR2,\n"
446  " UNALIGNED_CDR\n"
447  " };\n"
448  " Kind_t kind;\n"
449  " };\n"
450  "};\n";
451  }

◆ module()

std::string OpenDDS::DataRepresentationAnnotation::module ( void  ) const
virtual

Reimplemented from Annotation.

Definition at line 498 of file annotations.cpp.

References OPENDDS_END_VERSIONED_NAMESPACE_DECL.

499  {
500  return "::OpenDDS::";
501  }

◆ name()

std::string OpenDDS::DataRepresentationAnnotation::name ( void  ) const
virtual

Implements Annotation.

Definition at line 453 of file annotations.cpp.

454  {
455  return "data_representation";
456  }

◆ node_value_exists()

bool OpenDDS::DataRepresentationAnnotation::node_value_exists ( AST_Decl *  node,
DataRepresentation value 
) const

Definition at line 458 of file annotations.cpp.

References OpenDDS::DataRepresentation::add(), and Annotation::declaration().

Referenced by invalid_option().

460  {
461  value = DataRepresentation();
462  bool found = false;
463  if (node) {
464  for (AST_Annotation_Appls::iterator i = node->annotations().begin();
465  i != node->annotations().end(); ++i) {
466  AST_Annotation_Appl* appl = i->get();
467  if (appl && appl->annotation_decl() == declaration()) {
468  found = true;
469  value.add(value_from_appl(appl));
470  }
471  }
472  }
473  return found;
474  }
const LogLevel::Value value
Definition: debug.cpp:61
AST_Annotation_Decl * declaration() const
Definition: annotations.cpp:75
DataRepresentation value_from_appl(AST_Annotation_Appl *appl) const

◆ value_from_appl()

DataRepresentation OpenDDS::DataRepresentationAnnotation::value_from_appl ( AST_Annotation_Appl *  appl) const
protectedvirtual

Reimplemented from AnnotationWithValue< DataRepresentation >.

Definition at line 476 of file annotations.cpp.

References Annotation::declaration(), get_u32_annotation_member_value(), OpenDDS::DataRepresentation::unaligned, value, OpenDDS::DataRepresentation::xcdr1, OpenDDS::DataRepresentation::xcdr2, and OpenDDS::DataRepresentation::xml.

477  {
478  DataRepresentation value;
479  if (appl && appl->annotation_decl() == declaration()) {
480  switch (get_u32_annotation_member_value(appl, "kind")) {
481  case 0: // Kind_t::XCDR1
482  value.xcdr1 = true;
483  break;
484  case 1: // Kind_t::XML
485  value.xml = true;
486  break;
487  case 2: // Kind_t::XCDR2
488  value.xcdr2 = true;
489  break;
490  case 3: // Kind_t::UNALIGNED_CDR
491  value.unaligned = true;
492  break;
493  }
494  }
495  return value;
496  }
const LogLevel::Value value
Definition: debug.cpp:61
AST_Annotation_Decl * declaration() const
Definition: annotations.cpp:75
ACE_UINT32 get_u32_annotation_member_value(AST_Annotation_Appl *appl, const char *member_name)

The documentation for this class was generated from the following files: