Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

sgarch.cpp

Go to the documentation of this file.
00001 //**********************************************************************
00002 //                                                                     *
00003 //    Filename:      sgarch.cpp                                        *
00004 //    Date:          05 Jun 2002                                       *
00005 //    File Version:  1                                                 *
00006 //                                                                     *
00007 //    Description:   Abstract base class defining interface used to    *
00008 //                   store and retrieve instances of Signalman to and  *
00009 //                   from archive.                                     *
00010 //                                                                     *
00011 //    Author:        Chris White (whitecf@bcs.org.uk)                  *
00012 //    Company:       Monitor Computing Services Ltd.                   *
00013 //                                                                     *
00014 //**********************************************************************
00015 //                                                                     *
00016 //    Copyright (C) 2002  Monitor Computing Services Ltd.              *
00017 //                                                                     *
00018 //    This program is free software; you can redistribute it and/or    *
00019 //    modify it under the terms of the GNU General Public License      *
00020 //    as published by the Free Software Foundation; either version 2   *
00021 //    of the License, or any later version.                            *
00022 //                                                                     *
00023 //    This program is distributed in the hope that it will be useful,  *
00024 //    but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00025 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00026 //    GNU General Public License for more details.                     *
00027 //                                                                     *
00028 //    You should have received a copy of the GNU General Public        *
00029 //    License (http://www.gnu.org/copyleft/gpl.html) along with this   *
00030 //    program; if not, write to:                                       *
00031 //       The Free Software Foundation Inc.,                            *
00032 //       59 Temple Place - Suite 330,                                  *
00033 //       Boston, MA  02111-1307,                                       *
00034 //       USA.                                                          *
00035 //                                                                     *
00036 //**********************************************************************
00037 //                                                                     *
00038 //    Notes:                                                           *
00039 //                                                                     *
00040 //**********************************************************************
00041 
00042 #include <cstring.h>
00043 
00044 #include "sgnlman.h"
00045 #include "mytrace.h"
00046 
00047 #include "sgarch.h"
00048 
00049 
00050 using namespace Monitor::BellMaster;
00051 
00052 
00053 
00054 SignalmanArchive::SignalmanArchive()
00055 {
00056     _USEMYTRACE_("SignalmanArchive::SignalmanArchive()")
00057 }
00058 
00059 
00060 
00061 void
00062 SignalmanArchive::store(const Signalman&    target)
00063 {
00064     _USEMYTRACE_("SignalmanArchive::store()")
00065 
00066     storeName(target.getName());
00067     storeBeatInterval(target.getBeatInterval());
00068     storeSetInterval(target.getSetInterval());
00069 }
00070 
00071 
00072 
00073 int
00074 SignalmanArchive::retrieve(Signalman&    target)
00075 {
00076     _USEMYTRACE_("SignalmanArchive::retrieve()")
00077 
00078     int    retrieved = !0;
00079 
00080     string    newName;
00081 
00082     retrieved &= retrieveName(newName);
00083 
00084     if (retrieved)
00085     {
00086         unsigned    newBeatInterval;
00087 
00088         retrieved &= retrieveBeatInterval(newBeatInterval);
00089 
00090         if (retrieved)
00091         {
00092             unsigned    newSetInterval;
00093 
00094             retrieved &= retrieveSetInterval(newSetInterval);
00095 
00096             if (retrieved)
00097             {
00098                 target = Signalman(newName, newBeatInterval, newSetInterval);
00099             }
00100         }
00101     }
00102 
00103     return retrieved;
00104 }

Generated on Wed Oct 29 20:54:52 2003 for Bellmaster BC Common by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002