diff options
author | Abdullah Sowayan <sowayan@users.noreply.github.com> | 2007-03-18 22:23:37 +0000 |
---|---|---|
committer | Abdullah Sowayan <sowayan@users.noreply.github.com> | 2007-03-18 22:23:37 +0000 |
commit | 06a34455bd98b1379cc69bbc5b2cf085e0fc0d9b (patch) | |
tree | 8815ce3b3a85c3c4285429295f338e00ea4497f4 /CIAO/DAnCE/NodeManager/NAM_Map.cpp | |
parent | d66fcc9b4aaec8e88eeb83fc578fdf8a3cc963de (diff) | |
download | ATCD-Static_RT_DAnCE.tar.gz |
Diffstat (limited to 'CIAO/DAnCE/NodeManager/NAM_Map.cpp')
-rw-r--r-- | CIAO/DAnCE/NodeManager/NAM_Map.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/CIAO/DAnCE/NodeManager/NAM_Map.cpp b/CIAO/DAnCE/NodeManager/NAM_Map.cpp new file mode 100644 index 00000000000..f3aebb307a2 --- /dev/null +++ b/CIAO/DAnCE/NodeManager/NAM_Map.cpp @@ -0,0 +1,52 @@ +// $Id$ +#include "NAM_Map.h" +#include "ciao/CIAO_Config.h" +#include "ciao/CIAO_common.h" + +namespace CIAO +{ + NAM_Map::NAM_Map (void) + : map_ (CIAO_DEFAULT_MAP_SIZE) + { + } + + bool + NAM_Map::is_available (const ACE_CString &str) const + { + if (this->map_.find (str) == 0) + return true; + + return false; + } + + bool + NAM_Map::insert_nam (const ACE_CString &str, + const PortableServer::ObjectId &oid) + { + return (this->map_.bind (str, oid) == 0); + } + + ::PortableServer::ObjectId + NAM_Map::get_nam (const ACE_CString &str) + { + MAP::ENTRY *entry = 0; + + if (this->map_.find (str, entry) != 0) + return ::PortableServer::ObjectId (); + + return entry->int_id_.in (); + } + + bool + NAM_Map::remove_nam (const PortableServer::ObjectId &oid) + { + for (Iterator i = this->map_.begin (); + i != this->map_.end (); + ++i) + { + if ((*i).int_id_.in() == oid) + return this->map_.unbind ((*i).ext_id_) == 0; + } + return false; + } +} |