LCOV - code coverage report
Current view: top level - DCPS/XTypes - DynamicTypeImpl.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 28 44 63.6 %
Date: 2023-04-30 01:32:43 Functions: 12 17 70.6 %

          Line data    Source code
       1             : #ifndef OPENDDS_DCPS_XTYPES_DYNAMIC_TYPE_IMPL_H
       2             : #define OPENDDS_DCPS_XTYPES_DYNAMIC_TYPE_IMPL_H
       3             : 
       4             : #ifndef OPENDDS_SAFETY_PROFILE
       5             : 
       6             : #include "TypeDescriptorImpl.h"
       7             : #include "MemberDescriptorImpl.h"
       8             : 
       9             : #include <dds/DCPS/RcHandle_T.h>
      10             : #include <dds/DCPS/RcObject.h>
      11             : #include <dds/DdsDynamicDataC.h>
      12             : 
      13             : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
      14             : 
      15             : namespace OpenDDS {
      16             : namespace XTypes {
      17             : 
      18             : // This will eventually be replaced by a map.
      19             : class DynamicTypeMembersByNameImpl : public DDS::DynamicTypeMembersByName  {
      20             : private:
      21             :   typedef OPENDDS_MAP(OpenDDS::DCPS::String, DDS::DynamicTypeMember_var) MapType;
      22             : public:
      23             :   typedef MapType::const_iterator const_iterator;
      24             : 
      25          28 :   const_iterator find(const OpenDDS::DCPS::String& key) const
      26             :   {
      27          28 :     return map_.find(key);
      28             :   }
      29             : 
      30          42 :   const_iterator begin() const
      31             :   {
      32          42 :     return map_.begin();
      33             :   }
      34             : 
      35          95 :   const_iterator end() const
      36             :   {
      37          95 :     return map_.end();
      38             :   }
      39             : 
      40        2339 :   void insert(const MapType::value_type& value)
      41             :   {
      42        2339 :     map_.insert(value);
      43        2339 :   }
      44             : 
      45          84 :   size_t size() const
      46             :   {
      47          84 :     return map_.size();
      48             :   }
      49             : 
      50        1791 :   void clear()
      51             :   {
      52        1791 :     map_.clear();
      53        1791 :   }
      54             : 
      55             : private:
      56             :   MapType map_;
      57             : };
      58             : 
      59             : // This will eventually be replaced by a map.
      60             : class DynamicTypeMembersByIdImpl : public DDS::DynamicTypeMembersById {
      61             : private:
      62             :   typedef OPENDDS_MAP(MemberId, DDS::DynamicTypeMember_var) MapType;
      63             : public:
      64             :   typedef MapType::const_iterator const_iterator;
      65             : 
      66        7071 :   const_iterator find(MemberId key) const
      67             :   {
      68        7071 :     return map_.find(key);
      69             :   }
      70             : 
      71         360 :   const_iterator begin() const
      72             :   {
      73         360 :     return map_.begin();
      74             :   }
      75             : 
      76       10044 :   const_iterator end() const
      77             :   {
      78       10044 :     return map_.end();
      79             :   }
      80             : 
      81        2339 :   void insert(const MapType::value_type& value)
      82             :   {
      83        2339 :     map_.insert(value);
      84        2339 :   }
      85             : 
      86          84 :   size_t size() const
      87             :   {
      88          84 :     return map_.size();
      89             :   }
      90             : 
      91        1791 :   void clear()
      92             :   {
      93        1791 :     map_.clear();
      94        1791 :   }
      95             : 
      96             : private:
      97             :   MapType map_;
      98             : };
      99             : 
     100             : class OpenDDS_Dcps_Export DynamicTypeImpl : public DDS::DynamicType {
     101             : public:
     102             :   DynamicTypeImpl();
     103             :   ~DynamicTypeImpl();
     104             : 
     105             :   void set_descriptor(DDS::TypeDescriptor* descriptor);
     106             :   DDS::ReturnCode_t get_descriptor(DDS::TypeDescriptor*& descriptor);
     107             :   char* get_name();
     108             :   TypeKind get_kind();
     109             :   DDS::ReturnCode_t get_member_by_name(DDS::DynamicTypeMember_ptr& member, const char* name);
     110             :   DDS::ReturnCode_t get_all_members_by_name(DDS::DynamicTypeMembersByName_ptr& member);
     111             :   DDS::ReturnCode_t get_member(DDS::DynamicTypeMember_ptr& member, MemberId id);
     112             :   DDS::ReturnCode_t get_all_members(DDS::DynamicTypeMembersById_ptr& member);
     113             :   ACE_CDR::ULong get_member_count();
     114             :   DDS::ReturnCode_t get_member_by_index(DDS::DynamicTypeMember_ptr& member, ACE_CDR::ULong index);
     115             :   CORBA::ULong get_annotation_count();
     116             :   DDS::ReturnCode_t get_annotation(DDS::AnnotationDescriptor*& descriptor, CORBA::ULong idx);
     117             :   CORBA::ULong get_verbatim_text_count();
     118             :   DDS::ReturnCode_t get_verbatim_text(DDS::VerbatimTextDescriptor*& descriptor, CORBA::ULong idx);
     119             :   bool equals(DDS::DynamicType_ptr other);
     120             :   void insert_dynamic_member(DDS::DynamicTypeMember_ptr dtm);
     121             :   void clear();
     122             : 
     123           0 :   void set_minimal_type_identifier(const TypeIdentifier& ti)
     124             :   {
     125           0 :     minimal_ti_ = ti;
     126           0 :   }
     127             : 
     128             :   const TypeIdentifier& get_minimal_type_identifier() const
     129             :   {
     130             :     return minimal_ti_;
     131             :   }
     132             : 
     133           0 :   void set_minimal_type_map(const TypeMap& tm)
     134             :   {
     135           0 :     minimal_tm_ = tm;
     136           0 :   }
     137             : 
     138             :   const TypeMap& get_minimal_type_map() const
     139             :   {
     140             :     return minimal_tm_;
     141             :   }
     142             : 
     143           0 :   void set_complete_type_identifier(const TypeIdentifier& ti)
     144             :   {
     145           0 :     complete_ti_ = ti;
     146           0 :   }
     147             : 
     148             :   const TypeIdentifier& get_complete_type_identifier() const
     149             :   {
     150             :     return complete_ti_;
     151             :   }
     152             : 
     153           0 :   void set_complete_type_map(const TypeMap& tm)
     154             :   {
     155           0 :     complete_tm_ = tm;
     156           0 :   }
     157             : 
     158             :   const TypeMap& get_complete_type_map() const
     159             :   {
     160             :     return complete_tm_;
     161             :   }
     162             : 
     163           0 :   void set_preset_type_info(const TypeInformation& type_info)
     164             :   {
     165           0 :     preset_type_info_ = type_info;
     166           0 :     preset_type_info_set_ = true;
     167           0 :   }
     168             : 
     169             :   const TypeInformation* get_preset_type_info() const
     170             :   {
     171             :     return preset_type_info_set_ ? &preset_type_info_ : 0;
     172             :   }
     173             : 
     174             : private:
     175             :   DynamicTypeMembersByNameImpl member_by_name_;
     176             :   DynamicTypeMembersByIdImpl member_by_id_;
     177             :   typedef OPENDDS_VECTOR(DDS::DynamicTypeMember_var) DynamicTypeMembersByIndex;
     178             :   DynamicTypeMembersByIndex member_by_index_;
     179             :   DDS::TypeDescriptor_var descriptor_;
     180             : 
     181             :   TypeIdentifier minimal_ti_;
     182             :   TypeMap minimal_tm_;
     183             :   TypeIdentifier complete_ti_;
     184             :   TypeMap complete_tm_;
     185             :   bool preset_type_info_set_;
     186             :   TypeInformation preset_type_info_;
     187             : };
     188             : 
     189             : OpenDDS_Dcps_Export DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type);
     190             : bool test_equality(DDS::DynamicType_ptr lhs, DDS::DynamicType_ptr rhs, DynamicTypePtrPairSeen& dt_ptr_pair);
     191             : bool test_equality(DynamicTypeMembersByNameImpl* lhs, DynamicTypeMembersByNameImpl* rhs, DynamicTypePtrPairSeen& dt_ptr_pair);
     192             : bool test_equality(DynamicTypeMembersByIdImpl* lhs, DynamicTypeMembersByIdImpl* rhs, DynamicTypePtrPairSeen& dt_ptr_pair);
     193             : 
     194             : } // namespace XTypes
     195             : } // namespace OpenDDS
     196             : 
     197             : OPENDDS_END_VERSIONED_NAMESPACE_DECL
     198             : 
     199             : #endif // OPENDDS_SAFETY_PROFILE
     200             : 
     201             : #endif  /* OPENDDS_DCPS_XTYPES_DYNAMIC_TYPE_IMPL_H */

Generated by: LCOV version 1.16