interface.cpp

Go to the documentation of this file.
00001 
00003 /* FAU Discrete Event Systems Library (libfaudes)
00004 
00005    Copyright (C) 2008  Thomas Moor
00006    Exclusive copyright is granted to Klaus Schmidt
00007 
00008    This library is free software; you can redistribute it and/or
00009    modify it under the terms of the GNU Lesser General Public
00010    License as published by the Free Software Foundation; either
00011    version 2.1 of the License, or (at your option) any later version.
00012 
00013    This library is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE.  See the GNU
00016    Lesser General Public License for more details.
00017 
00018    You should have received a copy of the GNU Lesser General Public
00019    License along with this library; if not, write to the Free Software
00020    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00021 
00022 
00023 #include "interface.h"
00024 
00025 
00026 namespace faudes {
00027 
00028 /*
00029 ********************************************************************
00030 ********************************************************************
00031 ********************************************************************
00032 
00033 implemantation of faudes Type
00034 
00035 ********************************************************************
00036 ********************************************************************
00037 ********************************************************************
00038 */
00039 
00040 // constructor
00041 Type::Type(void)  {}
00042 
00043 // copy constructor
00044 Type::Type(const Type& rType)  {(void) rType;}
00045 
00046 // destructor
00047 Type::~Type(void) {}
00048 
00049 
00050 // Clear()
00051 void Type::Clear(void) {
00052   FD_DC("Type::Clear(): not re-implemented in " << typeid(*this).name());
00053 }
00054 
00055 // Write(context)
00056 void Type::Write(const Type* pContext) const {
00057   TokenWriter tw(TokenWriter::Stdout);
00058   DoWrite(tw,"",pContext);
00059 }
00060 
00061 // Write(rFileName, label, context, openmode)
00062 void Type::Write(const std::string& rFileName, const std::string& rLabel, 
00063   const Type* pContext, std::ios::openmode openmode) const {
00064   try {
00065     TokenWriter tw(rFileName, openmode);
00066     DoWrite(tw, rLabel, pContext);
00067   }
00068   catch (std::ios::failure&) {
00069     std::stringstream errstr;
00070     errstr << "Exception opening/writing file \"" << rFileName << "\"";
00071     throw Exception("Type::Write", errstr.str(), 2);
00072   }
00073 }
00074 
00075 // Write(rFileName, openmode)
00076 void Type::Write(const std::string& rFileName, std::ios::openmode openmode) const {
00077   Write(rFileName,"",0,openmode);
00078 }
00079 
00080 // Write(tw,label,context)
00081 void Type::Write(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const {
00082   DoWrite(rTw,rLabel,pContext);
00083 }
00084 
00085 // ToString(label, context)
00086 std::string Type::ToString(const std::string& rLabel, const Type* pContext) const {
00087   TokenWriter tw(TokenWriter::String);
00088   DoWrite(tw,rLabel,pContext);
00089   return tw.Str();
00090 }
00091 
00092 // DWrite(context)
00093 void Type::DWrite(const Type* pContext) const {
00094   TokenWriter tw(TokenWriter::Stdout);
00095   DoDWrite(tw,"",pContext);
00096 }
00097 
00098 // DWrite(rFileName, label, context, openmode)
00099 void Type::DWrite(const std::string& rFileName, const std::string& rLabel, 
00100   const Type* pContext, std::ios::openmode openmode) const {
00101   try {
00102     TokenWriter tw(rFileName, openmode);
00103     DoDWrite(tw, rLabel, pContext);
00104   }
00105   catch (std::ios::failure&) {
00106     std::stringstream errstr;
00107     errstr << "Exception opening/writing file \"" << rFileName << "\"";
00108     throw Exception("Type::DWrite", errstr.str(), 2);
00109   }
00110 }
00111 
00112 // DWrite(tw,label,context)
00113 void Type::DWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const {
00114   DoDWrite(rTw,rLabel,pContext);
00115 }
00116 
00117 // Read(rFilename, rLabel,context)
00118 void Type::Read(const std::string& rFilename, const std::string& rLabel, const Type* pContext) {
00119   Clear();
00120   TokenReader tr(rFilename);
00121   DoRead(tr,rLabel,pContext);
00122 }
00123 
00124 // Read(rTr, rLabel, context)
00125 void Type::Read(TokenReader& rTr, const std::string& rLabel, const Type* pContext) {
00126   Clear();
00127   DoRead(rTr,rLabel,pContext);
00128 }
00129 
00130 //DoWrite(rTr,rLabel,pContext)
00131 void Type::DoWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const {
00132   (void) rTw; (void) rLabel; (void) pContext;
00133   FD_DC("Type::DoWrite(): not re-implemented in " << typeid(*this).name());
00134 }
00135 
00136 //DoDWrite(rTr,rLabel,pContext)
00137 void Type::DoDWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const {
00138   FD_DC("Type::DoDWrite(): not re-implemented in " << typeid(*this).name() << ", using DoDWrite instead");
00139   DoWrite(rTw,rLabel,pContext);
00140 }
00141 
00142 //DoRead(rTr,rLabel,pContext)
00143 void Type::DoRead(TokenReader& rTr, const std::string& rLabel, const Type* pContext) {
00144   (void) rLabel; (void) pContext; (void) rTr;
00145   FD_DC("Type::DoRead(): not re-implemented in " << typeid(*this).name());
00146 }
00147 
00148 
00149 /*
00150 ********************************************************************
00151 ********************************************************************
00152 ********************************************************************
00153 
00154 implemantation of faudes Operation
00155 
00156 ********************************************************************
00157 ********************************************************************
00158 ********************************************************************
00159 */
00160 
00161 Operation::Operation(void) {}
00162 Operation::~Operation(void) {}
00163 
00164 
00165 } // namespace

Generated on Mon Nov 10 08:13:14 2008 for libFAUDES 2.11v by  doxygen 1.4.4