DataLinkSet.cpp

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #include "DCPS/DdsDcps_pch.h" //Only the _pch include should start with DCPS/
00009 #include "DataLinkSet.h"
00010 #include "DataLinkSet_rch.h"
00011 
00012 #include "dds/DCPS/GuidConverter.h"
00013 #include "dds/DCPS/Util.h"
00014 #include "TransportImpl.h"
00015 #include "TransportSendListener.h"
00016 
00017 #include "EntryExit.h"
00018 
00019 #if !defined (__ACE_INLINE__)
00020 #include "DataLinkSet.inl"
00021 #endif /* __ACE_INLINE__ */
00022 
00023 //TBD: The number of chunks in send control cached allocator and map
00024 //     entry allocator are hard coded for now. These values will be
00025 //     configured when we implement the dds configurations.
00026 
00027 /// The number of chuncks in send control cached allocator per pub/sub.
00028 #define NUM_SEND_CONTROL_ELEMENT_CHUNKS 20
00029 
00030 OpenDDS::DCPS::DataLinkSet::DataLinkSet()
00031   : send_response_listener_("DataLinkSet")
00032 {
00033   DBG_ENTRY_LVL("DataLinkSet","DataLinkSet",6);
00034 }
00035 
00036 OpenDDS::DCPS::DataLinkSet::~DataLinkSet()
00037 {
00038   DBG_ENTRY_LVL("DataLinkSet","~DataLinkSet",6);
00039 }
00040 
00041 int
00042 OpenDDS::DCPS::DataLinkSet::insert_link(const DataLink_rch& link)
00043 {
00044   DBG_ENTRY_LVL("DataLinkSet","insert_link",6);
00045   GuardType guard(this->lock_);
00046   return OpenDDS::DCPS::bind(map_, link->id(), link);
00047 }
00048 
00049 void
00050 OpenDDS::DCPS::DataLinkSet::remove_link(const DataLink_rch& link)
00051 {
00052   DBG_ENTRY_LVL("DataLinkSet", "remove_link", 6);
00053   GuardType guard1(this->lock_);
00054   if (unbind(map_, link->id()) != 0) {
00055     // Just report to the log that we tried.
00056     VDBG((LM_DEBUG,
00057           ACE_TEXT("(%P|%t) DataLinkSet::remove_links: ")
00058           ACE_TEXT("link_id %d not found in map.\n"),
00059           link->id()));
00060   }
00061 }
00062 
00063 OpenDDS::DCPS::DataLinkSet_rch
00064 OpenDDS::DCPS::DataLinkSet::select_links(const RepoId* remoteIds,
00065                                          const CORBA::ULong num_targets)
00066 {
00067   DBG_ENTRY_LVL("DataLinkSet","select_links",6);
00068 
00069   DataLinkSet_rch selected_links ( make_rch<DataLinkSet>() );
00070   GuardType guard(this->lock_);
00071   for (MapType::iterator itr = map_.begin();
00072        itr != map_.end();
00073        ++itr) {
00074     for (CORBA::ULong i = 0; i < num_targets; ++i) {
00075       if (itr->second->is_target(remoteIds[i])) {
00076         OpenDDS::DCPS::bind(selected_links->map_,
00077              itr->second->id(), itr->second);
00078         break;
00079       }
00080     }
00081   }
00082 
00083   return selected_links;
00084 }
00085 
00086 bool
00087 OpenDDS::DCPS::DataLinkSet::empty()
00088 {
00089   GuardType guard(this->lock_);
00090 
00091   return map_.empty();
00092 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1