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

ColCOWS_ObjectDesc.hh

00001 //===========================================================================//
00002 //    
00003 //    Description: interface for user defined event handling classes
00004 //    Filename: colcows/ColCOWS_ObjectDesc.hh
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 #ifndef __COLCOWS_OBJECT_DESC_HH__
00028 #define __COLCOWS_OBJECT_DESC_HH__
00029 
00030 //---------------------------------------------------------------------------//
00031 #include "ColCOWS_Include.hh"
00032 #include "ColCOWS_Debug.hh" 
00033 //---------------------------------------------------------------------------//
00034 
00035 namespace CORBA {
00036   class Object;
00037 }
00038 
00039 __COLCOWS_BEGIN__
00040 
00041 //! structure describing a remote object 
00042 /** \todo rename with ObjectDesc when the old one will disappear **/
00043 class ObjectDesc 
00044 {
00045 
00046 public:
00047   //! constructor
00048   ObjectDesc() {}
00049   
00050   //! constructor
00051   ObjectDesc(std::string id, std::string kind, CORBA::Object * ref) : 
00052     obj_id(id), obj_kind(kind), obj_ref(ref) {}
00053 
00054   //! destructor
00055   virtual ~ObjectDesc() {}
00056   
00057   //! print self
00058   inline virtual void printself(std::ostream & stream, int indent = 0) const 
00059   {
00060     std::string space; 
00061     for(int i = 0; i < indent; i++, space += COLCOWS_TAB);
00062     stream << space << std::flush;
00063     stream << " ID: " << obj_id << std::flush;
00064     stream << " kind: " << obj_kind << std::flush;
00065   }
00066 
00067 
00068 public:
00069 
00070   //! CORBA object Id
00071   std::string        obj_id;
00072 
00073   //! CORBA object kind
00074   std::string        obj_kind;
00075 
00076   //! CORBA object reference
00077   CORBA::Object * obj_ref;
00078 
00079 };
00080 
00081 //! Extended description of remote object
00082 class ExtObjectDesc : public ObjectDesc
00083 {
00084 
00085 public:
00086   //! constructor
00087   ExtObjectDesc() {}
00088 
00089   //! constructor
00090   ExtObjectDesc(ObjectDesc obj_desc) : ObjectDesc(obj_desc) {}
00091 
00092   //! destructor
00093   virtual ~ExtObjectDesc() {}  
00094 
00095   //! print self
00096   inline virtual void printself(std::ostream & stream, int indent = 0) const 
00097   {
00098     ObjectDesc::printself( stream, indent);
00099     stream << " Num Connection: " << num_connection << std::flush;
00100     stream << " Num Node: " << num_node << std::flush;
00101   }
00102 
00103 public:
00104 
00105   //! Number of connection of the remote workspace owning this object
00106   unsigned long      num_connection;
00107 
00108   //! Number of the remote node owning this object
00109   unsigned long      num_node;
00110 
00111 };
00112 
00113 typedef std::vector< ExtObjectDesc > ExtObjectDescVec;
00114   
00115 //------------------------------------------------------------------------// 
00116 
00117 //! standard output stream operator
00118 inline std::ostream & operator <<(std::ostream & stream, const ObjectDesc & _this)
00119 {
00120   stream << "ObjectDesc { " << std::flush;
00121   _this.printself(stream);
00122   stream << "}" << std::flush;
00123   return stream;
00124 }
00125 
00126 //------------------------------------------------------------------------// 
00127 
00128 //! standard output stream operator
00129 inline std::ostream & operator <<(std::ostream & stream, const ExtObjectDesc & _this)
00130 {
00131   stream << "ExtObjectDesc { " << std::flush;
00132   _this.printself(stream);
00133   stream << "}" << std::flush;
00134   return stream;
00135 }
00136 
00137 //------------------------------------------------------------------------// 
00138 
00139 __COLCOWS_END__
00140 
00141 #endif // __COLCOWS_NODE_DESC_HH__
00142 
00143 // EOF
00144 

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