GNU Radio 3.2.2 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2006 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License along 00018 * with this program; if not, write to the Free Software Foundation, Inc., 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00020 */ 00021 00022 #ifndef INCLUDED_MB_CONNECTION_H 00023 #define INCLUDED_MB_CONNECTION_H 00024 00025 #include <mb_endpoint.h> 00026 #include <list> 00027 00028 /*! 00029 * \brief Representation of a connection 00030 */ 00031 struct mb_connection { 00032 mb_endpoint d_ep[2]; 00033 00034 mb_connection(const mb_endpoint &ep0, const mb_endpoint &ep1){ 00035 d_ep[0] = ep0; 00036 d_ep[1] = ep1; 00037 } 00038 }; 00039 00040 typedef std::list<mb_connection>::iterator mb_conn_iter; 00041 typedef std::list<mb_connection>::const_iterator mb_conn_const_iter; 00042 00043 /*! 00044 * \brief data structure that keeps track of connections 00045 */ 00046 class mb_conn_table { 00047 std::list<mb_connection> d_connections; 00048 00049 public: 00050 bool 00051 lookup_conn_by_name(const std::string &component_name, 00052 const std::string &port_name, 00053 mb_conn_iter *it, int *which_ep); 00054 00055 bool 00056 lookup_conn_by_port(const mb_port *port, 00057 mb_conn_iter *it, int *which_ep); 00058 00059 void 00060 create_conn(const mb_endpoint &ep0, const mb_endpoint &ep1); 00061 00062 00063 void 00064 disconnect(const std::string &comp_name1, const std::string &port_name1, 00065 const std::string &comp_name2, const std::string &port_name2); 00066 00067 void 00068 disconnect_component(const std::string component_name); 00069 00070 void 00071 disconnect_all(); 00072 00073 int 00074 nconnections() const; 00075 00076 }; 00077 00078 #endif /* INCLUDED_MB_CONNECTION_H */