User Manual, Developers Guide and API Documentation

Context.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2007
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 16, D-52074 Aachen, Germany
00008  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the 
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 
00028 #ifndef WNS_PROBE_BUS_CONTEXT_HPP
00029 #define WNS_PROBE_BUS_CONTEXT_HPP
00030 
00031 
00032 #include <WNS/Assure.hpp>
00033 #include <WNS/NonCopyable.hpp>
00034 #include <WNS/IOutputStreamable.hpp>
00035 #include <WNS/pyconfig/Object.hpp>
00036 
00037 #include <iostream>
00038 
00039 namespace wns { namespace probe { namespace bus {
00040 
00041     namespace context {
00046         class NotFound :
00047             public wns::Exception
00048         {
00049         public:
00050             ~NotFound() throw() {};
00051         };
00052 
00053 
00058         class DuplicateKey :
00059             public wns::Exception
00060          {
00061          public:
00062              ~DuplicateKey() throw() {};
00063          };
00064 
00069         class TypeError :
00070             public wns::Exception
00071         {
00072         public:
00073             ~TypeError() throw () {};
00074         };
00075     }
00076 
00083     class IContext :
00084         public wns::IOutputStreamable
00085     {
00086     public:
00087         virtual ~IContext(){}
00088 
00093         virtual bool
00094         knows(const std::string& key) const = 0;
00095 
00096         virtual void
00097         insert(const std::string& key, int value) = 0;
00098 
00099         virtual void
00100         insert(const std::string& key, const std::string&) = 0;
00101 
00106         virtual void
00107         insertInt(const std::string& key, int value) = 0;
00108 
00113         virtual void
00114         insertString(const std::string& key, const std::string& value) = 0;
00115 
00119         virtual bool
00120         isInt(const std::string& key) const = 0;
00121 
00125         virtual int
00126         getInt(const std::string& key) const = 0;
00127 
00131         virtual bool
00132         isString(const std::string& key) const = 0;
00133 
00137         virtual std::string
00138         getString(const std::string& key) const = 0;
00139     };
00140 
00141     class Context :
00142         virtual public IContext,
00143         private NonCopyable
00144     {
00145         friend class PythonProbeBus;
00146     public:
00147         Context();
00148 
00149         ~Context();
00150 
00151         virtual bool
00152         knows(const std::string& key) const;
00153 
00154         virtual void
00155         insert(const std::string& key, int value);
00156 
00157         virtual void
00158         insert(const std::string& key, const std::string&);
00159 
00160         virtual void
00161         insertInt(const std::string& key, int value);
00162 
00163         virtual void
00164         insertString(const std::string& key, const std::string& value);
00165 
00166         virtual bool
00167         isInt(const std::string& key) const;
00168 
00169         virtual int
00170         getInt(const std::string& key) const;
00171 
00172         virtual bool
00173         isString(const std::string& key) const;
00174 
00175         virtual std::string
00176         getString(const std::string& key) const;
00177 
00178     private:
00179         virtual std::string
00180         doToString() const;
00181 
00182         wns::pyconfig::Object pyDict_;
00183     };
00184 
00185 } // bus
00186 } // probe
00187 } // wns
00188 
00189 #endif // WNS_PROBE_BUS_CONTEXT_HPP

Generated on Tue May 22 03:31:46 2012 for openWNS by  doxygen 1.5.5