00001 //===========================================================================// 00002 // 00003 // Description: interface for user defined event handling classes 00004 // Filename: colcows/ColCOWS_WorkspaceDesc.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_WORKSPACE_DESC_HH__ 00028 #define __COLCOWS_WORKSPACE_DESC_HH__ 00029 00030 //---------------------------------------------------------------------------// 00031 #include "ColCOWS_Include.hh" 00032 #include "ColCOWS_Debug.hh" 00033 #include "ColCOWS_NodeDesc.hh" 00034 //---------------------------------------------------------------------------// 00035 00036 namespace ColCOWS { 00037 struct IdlWorkspaceDesc; 00038 class NodeInterface; 00039 }; 00040 00041 __COLCOWS_BEGIN__ 00042 00043 //! Workspace Description 00044 /** 00045 * 00046 */ 00047 class WorkspaceDesc : public std::vector<NodeDesc> 00048 { 00049 00050 //================================================// 00051 //=========== class standard interface ===========// 00052 public: 00053 //! standard constructor 00054 WorkspaceDesc() {} 00055 00056 //! idl constructor 00057 WorkspaceDesc( const IdlWorkspaceDesc & idl_ws_desc ) { convertFromIdl(idl_ws_desc); } 00058 00059 //! destructor 00060 virtual ~WorkspaceDesc() {} 00061 00062 //! print self 00063 virtual void printself(std::ostream & stream, int indent = 0) const; 00064 00065 //=========================================// 00066 //=========== public interface ===========// 00067 public: 00068 00069 //! get a vector of references on the workspace 00070 void getObjectDescVec( ExtObjectDescVec & object_desc_vec, 00071 std::string node_kind = "", 00072 std::string obj_id = "", 00073 std::string obj_kind = "" ) const ; 00074 00075 //! idl import 00076 void convertFromIdl( const IdlWorkspaceDesc & idl_ws_desc); 00077 00078 //=========== Accessors ===========// 00079 public: 00080 00081 //! get/set Workspace Id 00082 inline std::string getId() const { return _ws_id; } 00083 //! get/set Workspace Id 00084 inline void setId(std::string ws_id) { _ws_id = ws_id; } 00085 00086 //! get/set Workspace Kind 00087 inline std::string getKind() const { return _ws_kind; } 00088 //! get/set Workspace Kind 00089 inline void setKind(std::string ws_kind) { _ws_kind = ws_kind; } 00090 00091 //! get/set Workspace Activated 00092 inline bool getActivated() const { return _activated; } 00093 //! get/set Workspace Activated 00094 inline void setActivated(bool activated) { _activated = activated; } 00095 00096 //! get/set Number of nodes in the workspace 00097 inline unsigned long getNbNodes() const { return _nb_nodes; } 00098 //! get/set Number of nodes in the workspace 00099 inline void setNbNodes(unsigned long nb_nodes ) { _nb_nodes = nb_nodes; } 00100 00101 //! get/set the connection number 00102 inline unsigned long getNumConnection() const { return _num_connection; } 00103 //! get/set the connection number 00104 inline void setNumConnection(unsigned long num_connection ) { _num_connection = num_connection; } 00105 00106 // //! get/set the enter node interface 00107 // inline NodeInterface * getEnterNodeInterface() const { return _enter_node_ref; } 00108 // //! get/set the enter node interface 00109 // inline void setEnterNodeInterface(NodeInterface * enter_node_ref ) { _enter_node_ref = enter_node_ref; } 00110 00111 00112 //=========== Complex Accessors ===========// 00113 public: 00114 00115 //! get number of nodes in the workspace with a certain kind 00116 unsigned long getNbNodes( std::string node_kind ) const; 00117 00118 protected: 00119 00120 //! Workspace Id 00121 std::string _ws_id; 00122 00123 //! Workspace Kind 00124 std::string _ws_kind; 00125 00126 //! Number of nodes in the workspace 00127 unsigned long _nb_nodes; 00128 00129 //! Is the workspace activated 00130 bool _activated; 00131 00132 //! Local number of connection 00133 unsigned long _num_connection; 00134 00135 // //! Reference on the root ColCOWS Node 00136 // NodeInterface * _enter_node_ref; 00137 00138 }; 00139 00140 //------------------------------------------------------------------------// 00141 00142 //! standard output stream operator 00143 inline std::ostream & operator <<(std::ostream & stream, const WorkspaceDesc & _this) 00144 { 00145 stream << "WorkspaceDesc { " << std::endl; 00146 _this.printself(stream); 00147 stream << "}" << std::flush; 00148 return stream; 00149 } 00150 00151 __COLCOWS_END__ 00152 00153 #endif // __COLCOWS_WORKSPACE_DESC_HH__ 00154 00155 // EOF 00156