|
degate 0.1.1
|
00001 /* 00002 00003 This file is part of the IC reverse engineering tool degate. 00004 00005 Copyright 2008, 2009, 2010 by Martin Schobert 00006 00007 Degate 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 of the License, or 00010 any later version. 00011 00012 Degate 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 00018 along with degate. If not, see <http://www.gnu.org/licenses/>. 00019 00020 */ 00021 00022 #include <globals.h> 00023 #include <LogicModelObjectBase.h> 00024 #include <Net.h> 00025 #include <Layer.h> 00026 #include <LogicModel.h> 00027 #include <ConnectedLogicModelObject.h> 00028 #include <degate_exceptions.h> 00029 #include <Wire.h> 00030 #include <XmlRpc.h> 00031 #include <exception> 00032 00033 using namespace degate; 00034 00035 Wire::Wire(int _from_x, int _from_y, int _to_x, int _to_y, unsigned int _diameter) : 00036 Line(_from_x, _from_y, _to_x, _to_y, _diameter) { 00037 } 00038 00039 const std::string Wire::get_descriptive_identifier() const { 00040 if(has_name()) { 00041 boost::format fmter("wire %1% (%2%)"); 00042 fmter % get_name() % get_object_id(); 00043 return fmter.str(); 00044 } 00045 else { 00046 boost::format fmter("wire (%1%)"); 00047 fmter % get_object_id(); 00048 return fmter.str(); 00049 } 00050 } 00051 00052 const std::string Wire::get_object_type_name() const { 00053 return std::string("Wire"); 00054 } 00055 00056 void Wire::print(std::ostream & os, int n_tabs) const { 00057 } 00058 00059 object_id_t Wire::push_object_to_server(std::string const& server_url) { 00060 00061 try { 00062 00063 xmlrpc_c::paramList params; 00064 params.add(xmlrpc_c::value_string("add")); 00065 params.add(xmlrpc_c::value_string("wire")); 00066 00067 Layer_shptr layer = get_layer(); 00068 assert(layer != NULL); 00069 params.add(xmlrpc_c::value_int(layer->get_layer_id())); 00070 00071 params.add(xmlrpc_c::value_int(get_from_x())); 00072 params.add(xmlrpc_c::value_int(get_from_y())); 00073 params.add(xmlrpc_c::value_int(get_to_x())); 00074 params.add(xmlrpc_c::value_int(get_to_y())); 00075 params.add(xmlrpc_c::value_int(get_diameter())); 00076 00077 int const transaction_id = 00078 xmlrpc_c::value_int(remote_method_call(server_url, "degate.push", params)); 00079 00080 set_remote_object_id(transaction_id); 00081 std::cout << "Pushed wire to server. remote id is: " << transaction_id << std::endl; 00082 return transaction_id; 00083 } 00084 catch(std::exception const& e) { 00085 std::cerr << "Client threw error: " << e.what() << std::endl; 00086 throw XMLRPCException(e.what()); 00087 } 00088 catch(...) { 00089 std::cerr << "Client threw unexpected error." << std::endl; 00090 throw XMLRPCException("Client threw unexpected error."); 00091 } 00092 00093 }
1.7.4