src/biu/util/Util.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #if !defined(IT_UTIL_H__INCLUDED)
00013 #define IT_UTIL_H__INCLUDED
00014
00015 #include <iostream>
00016 #include <sstream>
00017 #include <ostream>
00018 #include <string>
00019 #include <vector>
00020 #include <set>
00021 #include <map>
00022 #include <functional>
00023
00024 #ifdef WIN32
00025 #pragma warning( disable : 4172 )
00026 #endif
00027
00028 namespace biu {
00029 namespace util {
00030
00032
00034
00035
00036 typedef std::vector<int> vecInt;
00037 typedef std::set<int> setInt;
00038 typedef std::map<int, int> mapInt;
00039 typedef std::vector<vecInt> vecVecInt;
00040 typedef std::vector<setInt> vecSetInt;
00041 typedef std::map<int, vecInt> mapIntVecInt;
00042 typedef std::vector<double> vecDbl;
00043 typedef std::vector<std::string> vecStr;
00044 typedef std::pair<int,int> pairII;
00045
00047
00049
00050 std::ostream& operator<< (std::ostream& os ,const mapInt& c);
00051 std::ostream& operator<< (std::ostream& os ,const vecInt& c);
00052 std::ostream& operator<< (std::ostream& os ,const setInt& c);
00053
00054 std::ostream& operator<< (std::ostream& os ,const vecSetInt& c);
00055
00056
00061 class CPrintable {
00062 public:
00063 virtual ~CPrintable();
00065 virtual std::string toString() const =0;
00066 };
00067
00069
00071 std::ostream& operator<< (std::ostream& os, const CPrintable &p);
00072
00073
00077 class CException : public CPrintable {
00078 private:
00080 std::string outString;
00081 public:
00082
00083 CException() : outString("\nException raised\n"), retValue(-1) { errorCount++; };
00084 CException(const std::string &outString) : outString(outString), retValue(-1) { errorCount++; }
00085 CException(const std::string &outString, const int retValue) : outString(outString), retValue(retValue) { errorCount++; }
00086
00088 virtual ~CException() {}
00089
00091 std::string toString() const { return outString; }
00092
00094 int retValue;
00096 static int errorCount;
00097 };
00098
00099 }
00100 }
00101
00102 #endif // !defined(IT_UTIL_H__INCLUDED)