Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages | Examples

ColCOWS_RemoteWorkspaceManager.cc

00001 //===========================================================================//
00002 //    
00003 //    Description: interface for user defined event handling classes
00004 //    Filename: colcows/ColCOWS_RemoteWorkspaceManager.cc
00005 //    Authors: Michael Dussere and Aurélien Esnard
00006 //    
00007 //===========================================================================//
00008 //    
00009 //    Copyright (C) 2003 INRIA and CNRS
00010 //    
00011 //    This library is free software; you can redistribute it and/or
00012 //    modify it under the terms of the GNU Lesser General Public
00013 //    License as published by the Free Software Foundation; either
00014 //    version 2.1 of the License, or (at your option) any later version.
00015 //    
00016 //    This library is distributed in the hope that it will be useful,
00017 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 //    Lesser General Public License for more details.
00020 //    
00021 //    You should have received a copy of the GNU Lesser General Public
00022 //    License along with this library; if not, write to the Free Software
00023 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024 //    
00025 //===========================================================================//
00026 
00027 #include "ColCOWS_RemoteWorkspaceManager.hh" 
00028 #include "ColCOWS_WorkspaceDesc.hh" 
00029 #include "ColCOWS_Corba.hh" 
00030 
00031 using namespace std;
00032 
00033 __COLCOWS_BEGIN__
00034 
00035 //===========================================================================//
00036 
00037 void RemoteWorkspaceManager::printself( std::ostream & stream , int indent ) const
00038 { 
00039   std::string space; 
00040   for(int i = 0; i < indent; i++, space += COLCOWS_TAB);
00041 
00042   stream << space << "nb connected workspaces : " << size() << std::endl;
00043   
00044   for( const_iterator it = begin(); it != end() ; ++it ){
00045     stream << "*" ;
00046     it->second->printself(stream, indent+1);
00047     stream << endl;
00048   }    
00049 }
00050 
00051 //===========================================================================//
00052 
00053 void RemoteWorkspaceManager::addRemoteWorkspace( WorkspaceDesc * workspace_desc )
00054 { 
00055   COLCOWS_IN_DEBUG( );
00056   
00057   iterator it = find(workspace_desc->getNumConnection());  
00058   COLCOWS_ASSERT( (it == end()) , "Remote workspace " << workspace_desc->getNumConnection() << " is already in the manager.");
00059   
00060   insert( make_pair(workspace_desc->getNumConnection(), workspace_desc ));
00061     
00062   COLCOWS_OUT_DEBUG( );
00063   return;
00064 }
00065 
00066 //===========================================================================//
00067 
00068 void RemoteWorkspaceManager::removeRemoteWorkspace( unsigned long num_connection )
00069 { 
00070   COLCOWS_IN_DEBUG( );
00071 
00072   iterator it = find( num_connection );  
00073   COLCOWS_ASSERT( (it != end()) , "Remote workspace " << num_connection << " is not in the manager.");
00074   
00075   delete it->second;
00076 
00077   erase(it);
00078     
00079   COLCOWS_OUT_DEBUG( );
00080   return;
00081 }
00082 
00083 //===========================================================================//
00084 
00085 __COLCOWS_END__
00086 
00087 // EOF
00088 

Generated on Tue Jun 21 12:55:56 2005 for ColCOWS by  doxygen 1.4.1