rc_delta_sync_object.cpp

Go to the documentation of this file.
00001 // vim:set et sts=4 ts=4 tw=75 sw=4 ai ci cin cino=g0,t0:
00002 /*
00003  * Copyright (C) 2007, Technical Computer Science Group,
00004  *                     University of Bonn
00005  *
00006  * This file is part of the ReChannel library.
00007  *
00008  * The ReChannel library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License as
00010  * published by the Free Software Foundation; either version 2 of the
00011  * License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be
00014  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this library; see the file COPYING. If not, write to the
00020  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
00021  * Boston, MA 02110-1301, USA.
00022  *
00023  * Authors: Andreas Raabe and Armin Felke. Implementation by Armin Felke.
00024  *          {raabe, felke}@cs.uni-bonn.de
00025  */
00037 #include "rc_delta_sync_object.h"
00038 
00039 namespace ReChannel {
00040 
00041 rc_delta_sync_object::rc_delta_sync_object(
00042     delta_sync_callback_type callback, bool enabled)
00043     : sc_prim_channel(sc_gen_unique_name("_rc_delta_sync_object")),
00044       p_enabled(enabled), p_callback(callback)
00045 { }
00046 
00047 rc_delta_sync_object::rc_delta_sync_object()
00048     : sc_prim_channel(sc_gen_unique_name("_rc_delta_sync_object")),
00049       p_enabled(false)
00050 { }
00051 
00052 void rc_delta_sync_object::request_update()
00053 {
00054     if (p_enabled) {
00055         sc_prim_channel::request_update();
00056     }
00057 }
00058 
00059 void rc_delta_sync_object::set_callback(
00060     delta_sync_callback_type callback)
00061 {
00062     p_callback = callback;
00063 }
00064 
00065 void rc_delta_sync_object::update()
00066 {
00067     // is enabled?
00068     if (p_enabled == true) {
00069         // call the callback (if not empty)
00070         if (!p_callback.empty()) {
00071             p_callback(*this); // supply this object as reference
00072         }
00073     }
00074 }
00075 
00076 } // namespace ReChannel
00077 
00078 //
00079 // $Id: rc_delta_sync_object.cpp,v 1.4 2007/10/09 00:22:26 felke Exp $
00080 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/util/rc_delta_sync_object.cpp,v $
00081 //
00082 

Generated on Tue Jan 1 23:13:31 2008 for ReChannel by  doxygen 1.5.3