00001 /*******************************************************************\ 00002 00003 SESAME project software license 00004 00005 Copyright (C) 2002, 2003 University of Amsterdam 00006 00007 This program is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License 00009 as published by the Free Software Foundation; either version 2 00010 of the License, or (at your option) any later version. 00011 00012 This program 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 this program; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00020 02111-1307, USA. 00021 00022 For information regarding the SESAME software project see 00023 http://sesamesim.sourceforge.net or email 00024 jcofflan@users.sourceforge.net 00025 00026 \*******************************************************************/ 00027 00037 #ifndef MAPPING_H 00038 #define MAPPING_H 00039 00040 #include "mappingsaxhandler.h" 00041 00042 class MappingFactory; 00043 class TraceContext; 00044 00045 class Mapping { 00046 char *filename; 00047 side_t side; 00048 bool loaded; 00049 bool _isOpen; 00050 MappingSAXHandler handler; 00051 00052 public: 00053 Mapping(MappingFactory *factory, const char *filename, side_t side); 00054 virtual ~Mapping(); 00055 00056 side_t getSide() {return side;} 00057 00063 virtual bool isLoaded() {return loaded;} 00064 virtual TraceContext *getTraceContext(); 00065 00071 virtual bool isOpen() {return _isOpen;} 00072 virtual bool open(); 00073 virtual void close(); 00074 00075 protected: 00076 00084 virtual bool openChannel(ChannelMapping *channel) = 0; 00085 00091 virtual void closeChannel(ChannelMapping *channel) = 0; 00092 00093 virtual void load(); 00094 bool openChannels(channelList_t &list, channelList_t::iterator &it); 00095 }; 00096 #endif