client.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: client.h,v 1.1.4.1 2007/03/25 21:23:37 oliver Exp $
00005 //
00006 
00007 #ifndef BALL_CONCEPT_CLIENT_H
00008 #define BALL_CONCEPT_CLIENT_H
00009 
00010 #ifndef BALL_COMMON_H
00011 # include <BALL/common.h>
00012 #endif
00013 
00014 #ifndef BALL_CONCEPT_COMPOSITE_H
00015 # include <BALL/CONCEPT/composite.h>
00016 #endif
00017 
00018 #ifndef BALL_SYSTEM_NETWORKING_H
00019 # include <BALL/SYSTEM/networking.h>
00020 #endif
00021 
00022 #ifndef BALL_CONCEPT_PERSISTENTOBJECT_H       
00023 # include <BALL/CONCEPT/persistentObject.h>
00024 #endif
00025 
00026 #ifndef BALL_CONCET_TEXTPERSISTENCEMANAGER_H
00027 # include <BALL/CONCEPT/textPersistenceManager.h>
00028 #endif
00029 
00030 #define DEFAULT_PORT 20000
00031 
00032 namespace BALL
00033 {
00049   class BALL_EXPORT Client
00050   {
00051     public:
00052 
00059     enum Command
00060     {
00062       COMMAND__UNKOWN              = 0,
00063 
00065       COMMAND__SEND_OBJECT         = 1,
00066 
00068       NUMBER_OF_COMMANDS
00069     };  
00070 
00074     
00080     class BALL_EXPORT InvalidClient: public Exception::GeneralException
00081     {
00082       public:
00083 
00084       InvalidClient(const char* file, int line)
00085         ;
00086     };
00087 
00094     class BALL_EXPORT NoPersistentObject: public Exception::GeneralException
00095     {
00096       public:
00097 
00098       NoPersistentObject(const char* file, int line)
00099         ;
00100     };
00101 
00103 
00106 
00113     Client()
00114       ;
00115 
00127     Client(const String& host, int port = 20000)
00128       ;
00129 
00131 
00133 
00136     virtual ~Client()
00137       ;
00138 
00142     virtual void clear()
00143       ;
00144 
00146 
00149 
00156     void connect(const String& host, int port = 20000)
00157       ;
00158 
00173     void insert(Composite &composite)
00174       throw(InvalidClient, NoPersistentObject);
00176 
00179 
00188     virtual bool isValid() const
00189       ;
00190 
00197     virtual void dump(std::ostream& s = std::cout, Size depth = 0) const
00198       ;
00199 
00201     
00202     private:
00203 
00204     String  host_;
00205     int     port_;
00206 
00207     TextPersistenceManager pm_;
00208   };
00209   
00210 } // namespace BALL
00211 
00212 #endif // BALL_CONCEPT_CLIENT_H