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

sgarchst.cpp

Go to the documentation of this file.
00001 // $Id$
00002 
00003 //**********************************************************************
00004 //                                                                     *
00005 //    Description:   Concrete derived class for storing and retrieving *
00006 //                   signalman objects to and from a stream archive.   *
00007 //                                                                     *
00008 //    Author:        Chris White (whitecf@bcs.org.uk)                  *
00009 //                                                                     *
00010 //    Copyright (C) 2003  Monitor Computing Services Ltd.              *
00011 //                                                                     *
00012 //    This program is free software; you can redistribute it and/or    *
00013 //    modify it under the terms of the GNU General Public License      *
00014 //    as published by the Free Software Foundation; either version 2   *
00015 //    of the License, or any later version.                            *
00016 //                                                                     *
00017 //    This program is distributed in the hope that it will be useful,  *
00018 //    but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00019 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00020 //    GNU General Public License for more details.                     *
00021 //                                                                     *
00022 //    You should have received a copy of the GNU General Public        *
00023 //    License (http://www.gnu.org/copyleft/gpl.html) along with this   *
00024 //    program; if not, write to:                                       *
00025 //       The Free Software Foundation Inc.,                            *
00026 //       59 Temple Place - Suite 330,                                  *
00027 //       Boston, MA  02111-1307,                                       *
00028 //       USA.                                                          *
00029 //                                                                     *
00030 //**********************************************************************
00031 //                                                                     *
00032 //    Notes:                                                           *
00033 //                                                                     *
00034 //**********************************************************************
00035 
00036 #include <cstring.h>
00037 #include <iostream.h>
00038 #include <strstrea.h>
00039 
00040 #include "mytrace.h"
00041 
00042 #include "sgarchst.h"
00043 
00044 
00045 using namespace Monitor::BellMaster;
00046 
00047 
00048 
00049 SignalmanArchiveStream::SignalmanArchiveStream(iostream&    newStream) :
00050     SignalmanArchive(), archiveStream(newStream)
00051 {
00052     _USEMYTRACE_("SignalmanArchiveStream::SignalmanArchiveStream()")
00053 }
00054 
00055 
00056 
00057 void
00058 SignalmanArchiveStream::storeName(const string&    name)
00059 {
00060     _USEMYTRACE_("SignalmanArchive::storeName()")
00061 
00062     archiveStream << name.c_str() << endl;
00063 }
00064 
00065 
00066 
00067 void
00068 SignalmanArchiveStream::storeBeatInterval(const unsigned&    interval)
00069 {
00070     _USEMYTRACE_("SignalmanArchive::storeBeatInterval()")
00071 
00072     archiveStream << interval << endl;
00073 }
00074 
00075 
00076 
00077 void
00078 SignalmanArchiveStream::storeSetInterval(const unsigned&    interval)
00079 {
00080     _USEMYTRACE_("SignalmanArchive::storeSetInterval()")
00081 
00082     archiveStream << interval << endl;
00083 }
00084 
00085 
00086 
00087 int
00088 SignalmanArchiveStream::retrieveName(string&    name)
00089 {
00090     _USEMYTRACE_("SignalmanArchive::retrieveName()")
00091 
00092     int    retrieved = !0;
00093 
00094     if (EOF == archiveStream.peek())
00095     {
00096         retrieved = 0;
00097     }
00098     else
00099     {
00100         name.read_line(archiveStream);
00101     }
00102 
00103     return retrieved;
00104 }
00105 
00106 
00107 
00108 int
00109 SignalmanArchiveStream::retrieveBeatInterval(unsigned&    interval)
00110 {
00111     _USEMYTRACE_("SignalmanArchive::retrieveBeatInterval()")
00112 
00113     int    retrieved = !0;
00114 
00115     if (EOF == archiveStream.peek())
00116     {
00117         retrieved = 0;
00118     }
00119     else
00120     {
00121         archiveStream >> interval;
00122     }
00123 
00124     return retrieved;
00125 }
00126 
00127 
00128 
00129 int
00130 SignalmanArchiveStream::retrieveSetInterval(unsigned&    interval)
00131 {
00132     _USEMYTRACE_("SignalmanArchive::retrieveSetInterval()")
00133 
00134     int    retrieved = !0;
00135 
00136     if (EOF == archiveStream.peek())
00137     {
00138         retrieved = 0;
00139     }
00140     else
00141     {
00142         archiveStream >> interval;
00143     }
00144 
00145     return retrieved;
00146 }
00147 

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