summaryrefslogtreecommitdiff
path: root/CIAO/DAnCE/NodeManager/NAM_Map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CIAO/DAnCE/NodeManager/NAM_Map.cpp')
-rw-r--r--CIAO/DAnCE/NodeManager/NAM_Map.cpp52
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;
+ }
+}