Back to index

nordugrid-arc-nox  1.1.0~rc6
Message.cpp
Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 #include <config.h>
00003 #endif
00004 
00005 #include <iostream>
00006 #include <arc/message/Message.h>
00007 
00008 namespace Arc {
00009 
00010 MessageContext::MessageContext(void) {
00011 }
00012 
00013 MessageContext::~MessageContext(void) {
00014   std::map<std::string,MessageContextElement*>::iterator i;
00015   for(i=elements_.begin();i!=elements_.end();++i) {
00016     delete i->second;
00017   };
00018 }
00019 
00020 void MessageContext::Add(const std::string& name,MessageContextElement* element) {
00021   MessageContextElement* old = operator[](name);
00022   elements_[name]=element;
00023   if(old) delete old;
00024 }
00025 
00026 MessageContextElement* MessageContext::operator[](const std::string& id) {
00027   std::map<std::string,MessageContextElement*>::iterator i;
00028   i=elements_.find(id);
00029   if(i == elements_.end()) return NULL;
00030   return i->second;
00031 }
00032 
00033 Message::Message(long msg_ptr_addr) 
00034 {
00035     Message *msg = (Message *)msg_ptr_addr;
00036     auth_ = msg->auth_;         auth_created_=false;
00037     attr_ = msg->attr_;         attr_created_=false;
00038     ctx_ = msg->ctx_;           ctx_created_=false;
00039     auth_ctx_ = msg->auth_ctx_; auth_ctx_created_=false;
00040     payload_ = msg->payload_;
00041 }
00042 
00043 } // namespace Arc