00001 // $Id$ 00002 00003 //********************************************************************** 00004 // * 00005 // Description: Abstract base class for storing and retrieving * 00006 // bell code objects to and from 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 00038 #include "bellcode.h" 00039 #include "mytrace.h" 00040 00041 #include "bcarch.h" 00042 00043 00044 using namespace Monitor::BellMaster; 00045 00046 00047 00048 BellCodeArchive::BellCodeArchive() 00049 { 00050 _USEMYTRACE_("BellCodeArchive::BellCodeArchive()") 00051 } 00052 00053 00054 00055 void 00056 BellCodeArchive::store(const BellCode& target) 00057 { 00058 _USEMYTRACE_("BellCodeArchive::store()") 00059 00060 storeDescription(target.getDescription()); 00061 storeSequence(target.getSequence()); 00062 } 00063 00064 00065 00066 int 00067 BellCodeArchive::retrieve(BellCode& target) 00068 { 00069 _USEMYTRACE_("BellCodeArchive::retrieve()") 00070 00071 int retrieved = !0; 00072 00073 string newDescription; 00074 00075 retrieved &= retrieveDescription(newDescription); 00076 00077 if (retrieved) 00078 { 00079 string newSequence; 00080 00081 retrieved &= retrieveSequence(newSequence); 00082 00083 if (retrieved) 00084 { 00085 target = BellCode(newSequence, newDescription); 00086 } 00087 } 00088 00089 return retrieved; 00090 }
1.2.14 written by Dimitri van Heesch,
© 1997-2002