degate 0.1.1
RemoteObject.h
Go to the documentation of this file.
00001 /* -*-c++-*-
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 #ifndef __REMOTEOBJECT_H__
00023 #define __REMOTEOBJECT_H__
00024 
00025 
00026 #include <cstdlib>
00027 #include <string>
00028 #include <iostream>
00029 #include <assert.h>
00030 
00031 namespace degate {
00032 
00033   class RemoteObject {
00034 
00035   private:
00036 
00037     object_id_t remote_oid;
00038 
00039   protected:
00040 
00041     virtual object_id_t push_object_to_server(std::string const& server_url) = 0;
00042 
00043   public:
00044 
00045     RemoteObject() : remote_oid(0) {
00046     }
00047 
00048     virtual ~RemoteObject() {
00049     }
00050 
00051 
00052     virtual bool has_remote_object_id() const {
00053       return remote_oid != 0;
00054     }
00055 
00056     virtual object_id_t get_remote_object_id() const {
00057       return remote_oid;
00058     }
00059 
00060     virtual void set_remote_object_id(object_id_t oid) {
00061       remote_oid = oid;
00062     }
00063 
00064 
00065     virtual object_id_t push(std::string const& server_url) {
00066       if(remote_oid == 0) {
00067         debug(TM, "RemoteObject::push(): push object to server.");
00068         return push_object_to_server(server_url);
00069       }
00070       else {
00071         debug(TM, "RemoteObject::push(): object is already pushed to server.");
00072         return 0;
00073       }
00074     }
00075 
00076   };
00077 
00078 
00079 }
00080 
00081 #endif