00001 00002 /****************************************************************** 00003 * CAVERNsoft 00004 * Copyright (C) 1994-2000 Electronic Visualization Laboratory, 00005 * all rights reserved 00006 * By Jason Leigh, Yong-joo Cho, Naveen Krishnaprasad, Chris Scharver, 00007 * Stuart Bailey, Atul Nayak, Shalini Venkataraman 00008 * University of Illinois at Chicago 00009 * 00010 * This publication and its text and code may not be copied for commercial 00011 * use without the express written permission of the University of Illinois 00012 * at Chicago 00013 * The contributors disclaim any representation of warranty: use this 00014 * code at your own risk. 00015 * Direct questions, comments etc to cavern@evl.uic.edu 00016 ******************************************************************/ 00017 #ifndef _CAVERNDB_SHAREDSTATE_C_HXX 00018 #define _CAVERNDB_SHAREDSTATE_C_HXX 00019 00020 #include <CAVERN.hxx> 00021 00046 class CAVERNdb_sharedState_c : public CAVERNmisc_observer_c 00047 { 00048 public: 00050 CAVERNdb_sharedState_c(); 00051 00062 CAVERNdb_sharedState_c( CAVERNdb_client_c *dbclient, char *path, char *key ); 00064 virtual ~CAVERNdb_sharedState_c(); 00066 inline bool isSharingEnabled() { return _sharingEnabled; } 00068 inline void enableSharing() { _sharingEnabled = true; } 00070 inline void disableSharing() { _sharingEnabled = false; } 00075 int refresh(); 00076 virtual void update( CAVERNmisc_subject_c *subj ); 00077 00078 protected: 00086 virtual int packAndSendState() = 0; 00096 virtual int unpackState( char *data ) = 0; 00097 00098 protected: 00100 CAVERNnet_datapack_c _packer; 00102 CAVERNdb_client_c *_dbclient; 00104 bool _sharingEnabled; 00106 char *_path; 00108 char *_key; 00109 }; 00110 00111 #endif