00001
00002
00003
00004
00005 #ifndef BALL_CONCEPT_CLIENT_H
00006 #define BALL_CONCEPT_CLIENT_H
00007
00008 #ifndef BALL_COMMON_H
00009 # include <BALL/common.h>
00010 #endif
00011
00012 #ifndef BALL_CONCEPT_COMPOSITE_H
00013 # include <BALL/CONCEPT/composite.h>
00014 #endif
00015
00016 #ifndef BALL_SYSTEM_NETWORKING_H
00017 # include <BALL/SYSTEM/networking.h>
00018 #endif
00019
00020 #ifndef BALL_CONCEPT_PERSISTENTOBJECT_H
00021 # include <BALL/CONCEPT/persistentObject.h>
00022 #endif
00023
00024 #ifndef BALL_CONCET_TEXTPERSISTENCEMANAGER_H
00025 # include <BALL/CONCEPT/textPersistenceManager.h>
00026 #endif
00027
00028 #define DEFAULT_PORT 20000
00029
00030 namespace BALL
00031 {
00047 class BALL_EXPORT Client
00048 {
00049 public:
00050
00057 enum Command
00058 {
00060 COMMAND__UNKOWN = 0,
00061
00063 COMMAND__SEND_OBJECT = 1,
00064
00066 NUMBER_OF_COMMANDS
00067 };
00068
00072
00078 class BALL_EXPORT InvalidClient
00079 : public Exception::GeneralException
00080 {
00081 public:
00082 InvalidClient(const char* file, int line);
00083 };
00084
00091 class BALL_EXPORT NoPersistentObject
00092 : public Exception::GeneralException
00093 {
00094 public:
00095 NoPersistentObject(const char* file, int line);
00096 };
00097
00099
00102
00109 Client();
00110
00122 Client(const String& host, int port = 20000);
00123
00125
00127
00130 virtual ~Client();
00131
00135 virtual void clear();
00136
00138
00141
00148 void connect(const String& host, int port = 20000);
00149
00164 void insert(Composite &composite);
00166
00169
00178 virtual bool isValid() const;
00179
00186 virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
00187
00189
00190 private:
00191
00192 String host_;
00193 int port_;
00194
00195 TextPersistenceManager pm_;
00196 };
00197
00198 }
00199
00200 #endif // BALL_CONCEPT_CLIENT_H