Index  Source Files  Annotated Class List  Alphabetical Class List  Class Hierarchy  Graphical Class Hierarchy 

DatabaseConnectionID.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 /****************************************************************************
00004 ** Copyright (c) quickfixengine.org  All rights reserved.
00005 **
00006 ** This file is part of the QuickFIX FIX Engine
00007 **
00008 ** This file may be distributed under the terms of the quickfixengine.org
00009 ** license as defined by quickfixengine.org and appearing in the file
00010 ** LICENSE included in the packaging of this file.
00011 **
00012 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00013 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00014 **
00015 ** See http://www.quickfixengine.org/LICENSE for licensing information.
00016 **
00017 ** Contact ask@quickfixengine.org if any conditions of this licensing are
00018 ** not clear to you.
00019 **
00020 ****************************************************************************/
00021 
00022 #ifndef FIX_DATABASECONNECTIONID_H
00023 #define FIX_DATABASECONNECTIONID_H
00024 
00025 #ifdef _MSC_VER
00026 #pragma warning( disable : 4503 4355 4786 4290 )
00027 #endif
00028 
00029 #include <string>
00030 #include <map>
00031 
00032 namespace FIX
00033 {
00034 class DatabaseConnectionID
00035 {
00036 public:
00037   DatabaseConnectionID
00038   ( const std::string& database, const std::string& user,
00039     const std::string& password, const std::string& host, short port )
00040   : m_database( database ), m_user( user ), m_password( password ),
00041     m_host( host ), m_port( port ) {}
00042 
00043   friend bool operator<( const DatabaseConnectionID&, const DatabaseConnectionID& );
00044   friend bool operator==( const DatabaseConnectionID&, const DatabaseConnectionID& );
00045   friend bool operator!=( const DatabaseConnectionID&, const DatabaseConnectionID& );
00046 
00047   const std::string& getDatabase() const
00048     { return m_database; }
00049   const std::string& getUser() const
00050     { return m_user; }
00051   const std::string& getPassword() const
00052     { return m_password; }
00053   const std::string& getHost() const
00054     { return m_host; }
00055   short getPort() const
00056     { return m_port; }
00057 
00058 private:
00059   std::string m_database;
00060   std::string m_user;
00061   std::string m_password;
00062   std::string m_host;
00063   short m_port;
00064 };
00065 
00066 inline bool operator<( const DatabaseConnectionID& lhs, const DatabaseConnectionID& rhs )
00067 {
00068   if ( lhs.m_database < rhs.m_database )
00069     return true;
00070   else if ( rhs.m_database < lhs.m_database )
00071     return false;
00072   else if ( lhs.m_user < rhs.m_user )
00073     return true;
00074   else if ( rhs.m_user < lhs.m_user )
00075     return false;
00076   else if ( lhs.m_password < rhs.m_password )
00077     return true;
00078   else if ( rhs.m_password < lhs.m_password )
00079     return false;
00080   else if ( lhs.m_host < rhs.m_host )
00081     return true;
00082   else if ( rhs.m_host < lhs.m_host )
00083     return false;
00084   else if ( lhs.m_port < rhs.m_port )
00085     return true;
00086   else if ( rhs.m_port < lhs.m_port )
00087     return false;
00088   else
00089     return false;
00090 }
00091 inline bool operator==( const DatabaseConnectionID& lhs, const DatabaseConnectionID& rhs )
00092 {
00093   return ( ( lhs.m_database == rhs.m_database ) &&
00094            ( lhs.m_user == rhs.m_user ) &&
00095            ( lhs.m_password == rhs.m_password ) &&
00096            ( lhs.m_host == rhs.m_host ) &&
00097            ( lhs.m_port == rhs.m_port ));
00098 }
00099 inline bool operator!=( const DatabaseConnectionID& lhs, const DatabaseConnectionID& rhs )
00100 {
00101   return !( lhs == rhs );
00102 }
00103 }
00104 
00105 #endif

Generated on Mon Apr 5 20:59:50 2010 for QuickFIX by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2001