Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Storable / Savable.h
blob39f3c573bdcc7a657611e781febe3a9c5c4fea94
1 #include "tao/Storable_Base.h"
2 #include "tao/Storable_Factory.h"
4 #include "tao/orbconf.h"
5 #include /**/ "tao/Version.h"
6 #include /**/ "tao/Versioned_Namespace.h"
8 #include "ace/SString.h"
10 class Savable_Exception
14 /// A simple class to use for testing whose contents
15 /// are to be persisted. It has attributes for each basic
16 /// type that can be saved.
17 /// There are two attributes for each type so that
18 /// one process can write one attribute of the same
19 /// type while another process reads another attribute
20 /// of the same type.
21 class Savable
23 public:
24 Savable (TAO::Storable_Factory & storable_factory);
26 ~Savable ();
28 void string_set (int index, const ACE_CString &s);
29 const ACE_CString & string_get (int index);
31 void int_set (int index, int i);
32 int int_get (int index);
34 void unsigned_int_set (int index, unsigned int ui);
35 unsigned int unsigned_int_get (int index);
37 void bytes_set (int index, int size, char * bytes);
38 int bytes_get (int index, char * bytes);
40 bool is_loaded_from_stream ();
42 private:
43 TAO::Storable_Factory & storable_factory_;
44 bool loaded_from_stream_;
45 time_t last_changed_;
46 void read (TAO::Storable_Base & stream);
47 void write (TAO::Storable_Base & stream);
49 ACE_CString string_[2];
50 int i_[2];
51 unsigned int ui_[2];
53 static const int bytes_size_max;
54 int bytes_size_[2];
55 char * bytes_[2];
57 friend class Savable_File_Guard;