OpenDDS  Snapshot(2023/04/07-19:43)
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 435 of file annotations.cpp.

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

◆ module()

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

Reimplemented from Annotation.

Definition at line 496 of file annotations.cpp.

References OPENDDS_END_VERSIONED_NAMESPACE_DECL.

497  {
498  return "::OpenDDS::";
499  }

◆ name()

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

Implements Annotation.

Definition at line 451 of file annotations.cpp.

452  {
453  return "data_representation";
454  }

◆ node_value_exists()

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

Definition at line 456 of file annotations.cpp.

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

Referenced by invalid_option().

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

◆ value_from_appl()

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

Reimplemented from AnnotationWithValue< DataRepresentation >.

Definition at line 474 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.

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

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