Easy Simple Network Library  0.3.7
All Classes Functions Modules
CommonData.h
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of "esnetwork" library.
4 It is licensed under the terms of the BSD license.
5 For the latest info, see http://esnetwork.sourceforge.net
6 
7 Copyright (c) 2012-2013 Lin Jia Jun (Joe Lam)
8 All rights reserved.
9 
10 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions are met:
12 
13 1. Redistributions of source code must retain the above copyright notice, this
14  list of conditions and the following disclaimer.
15 2. Redistributions in binary form must reproduce the above copyright notice,
16  this list of conditions and the following disclaimer in the documentation
17  and/or other materials provided with the distribution.
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
23 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 -----------------------------------------------------------------------------
30 */
31 
32 #ifndef _ESN_COMMONDATA_H_
33 #define _ESN_COMMONDATA_H_
34 
35 #include <map>
36 #include <string>
37 
38 #include <boost/shared_ptr.hpp>
39 
40 namespace esnlib
41 {
42 
43 class IoBuffer;
44 class Business;
45 
48 {
49 public:
50  CommonData();
51  virtual ~CommonData();
52 
58  virtual int PutInt(int key, int value) = 0;
59 
65  virtual int PutInt(const std::string& key, int value) = 0;
66 
71  virtual int GetInt(int key) = 0;
72 
77  virtual int GetInt(const std::string& key) = 0;
78 
82  virtual std::map<int, int> & GetIntIntMap() = 0;
83 
87  virtual std::map<std::string, int> & GetStrIntMap() = 0;
88 
94  virtual int PutStr(const std::string& key, const std::string& value) = 0;
95 
101  virtual int PutStr(int key, const std::string& value) = 0;
102 
107  virtual std::string GetStr(const std::string& key) = 0;
108 
113  virtual std::string GetStr(int key) = 0;
114 
118  virtual std::map<int, std::string> & GetIntStrMap() = 0;
119 
123  virtual std::map<std::string, std::string> & GetStrStrMap() = 0;
124 
125 
131  virtual int PutBuf(int key, boost::shared_ptr<IoBuffer> value) = 0;
132 
138  virtual int PutBuf(const std::string& key, boost::shared_ptr<IoBuffer> value) = 0;
139 
144  virtual boost::shared_ptr<IoBuffer> GetBuf(int key) = 0;
145 
150  virtual boost::shared_ptr<IoBuffer> GetBuf(const std::string& key) = 0;
151 
155  virtual std::map< int, boost::shared_ptr<IoBuffer> > & GetIntBufMap() = 0;
156 
160  virtual std::map< std::string, boost::shared_ptr<IoBuffer> > & GetStrBufMap() = 0;
161 
162 
168  virtual int PutObj(int key, boost::shared_ptr<Business> value) = 0;
169 
175  virtual int PutObj(const std::string& key, boost::shared_ptr<Business> value) = 0;
176 
181  virtual boost::shared_ptr<Business> GetObj(int key) = 0;
182 
187  virtual boost::shared_ptr<Business> GetObj(const std::string& key) = 0;
188 
192  virtual std::map< int, boost::shared_ptr<Business> > & GetIntObjMap() = 0;
193 
197  virtual std::map< std::string, boost::shared_ptr<Business> > & GetStrObjMap() = 0;
198 
199 
200 
201 protected:
202 
203 private:
204 
205 };
206 
207 typedef boost::shared_ptr<CommonData> CommonDataPtr;
208 
209 }
210 
211 #endif // COMMONDATA_H
212 
virtual int PutInt(int key, int value)=0
virtual std::string GetStr(const std::string &key)=0
virtual boost::shared_ptr< Business > GetObj(int key)=0
virtual std::map< int, std::string > & GetIntStrMap()=0
virtual std::map< int, boost::shared_ptr< IoBuffer > > & GetIntBufMap()=0
virtual std::map< std::string, std::string > & GetStrStrMap()=0
virtual std::map< std::string, boost::shared_ptr< Business > > & GetStrObjMap()=0
virtual std::map< int, int > & GetIntIntMap()=0
virtual std::map< std::string, boost::shared_ptr< IoBuffer > > & GetStrBufMap()=0
virtual int PutBuf(int key, boost::shared_ptr< IoBuffer > value)=0
virtual int PutStr(const std::string &key, const std::string &value)=0
Definition: Buffer.h:37
virtual int PutObj(int key, boost::shared_ptr< Business > value)=0
virtual int GetInt(int key)=0
virtual std::map< int, boost::shared_ptr< Business > > & GetIntObjMap()=0
virtual boost::shared_ptr< IoBuffer > GetBuf(int key)=0
Common Data class.
Definition: CommonData.h:47
virtual std::map< std::string, int > & GetStrIntMap()=0