2 //=============================================================================
4 * @file FT_TestReplica_i.h
6 * This file declares an implementation of CORBA interface TestReplica.
8 * @author Dale Wilson <wilson_d@ociweb.com>
10 //=============================================================================
12 #ifndef FT_TESTREPLICA_I_H_
13 #define FT_TESTREPLICA_I_H_
14 #include /**/ "ace/pre.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "ace/SString.h"
23 #include "FT_TestReplicaS.h"
27 class FT_ReplicaFactory_i
;
30 * Implement the TestReplica IDL interface.
32 * Persistent storage simulated by storing the counter
35 class FT_TestReplica_i
: public virtual POA_FT_TEST::TestReplica
38 FT_TestReplica_i (FT_ReplicaFactory_i
* factory
, const char * name
, unsigned long factory_id
);
39 virtual ~FT_TestReplica_i ();
42 * parse command line arguments.
43 * remove any that are recognized, adjusting argc accordingly.
44 * @param argc classic C argc
45 * @param argv classic C argv
46 * @return 0 if ok, otherwise process exit code.
48 int parse_args (int argc
, ACE_TCHAR
*argv
[]);
51 * provide information to appear in a "usage" display.
52 * caller will display:
53 * usage: [program] <usageMessage()> [other usage]
54 * @returns c-style string containing "bare" usage options.
56 const char * usage_options();
59 * Initialize this object.
60 * @param orbManager our ORB -- we keep var to it.
61 * @return zero for success; nonzero is process return code for failure.
63 int init (CORBA::ORB_var
& orb
, const ACE_TCHAR
*);
67 * @return zero for success; nonzero is process return code for failure.
73 * @param result [out] status code to return from process
74 * @returns 0 to continue; nonzero to quit
76 int idle(int &result
);
80 unsigned long factory_id()const;
82 static const char * repository_id();
84 ::FT_TEST::TestReplica_ptr
object_reference();
86 PortableServer::ObjectId
object_id()const;
88 //////////////////////////////////////////
89 // Override CORBA servant virtual methods
90 virtual PortableServer::POA_ptr
_default_POA ();
92 virtual void _remove_ref ();
95 ///////////////////////////
96 // override Replica methods
97 virtual void set (CORBA::Long value
);
99 virtual CORBA::Long
increment (CORBA::Long delta
);
101 virtual CORBA::Long
get ();
103 virtual CORBA::Long
counter ();
105 virtual void counter (CORBA::Long counter
);
107 virtual void die (FT_TEST::TestReplica::Bane when
);
109 virtual void shutdown ();
111 ///////////////////////////
112 // override PullMonitorable
114 virtual CORBA::Boolean
is_alive ();
116 ///////////////////////////
117 // override Updatable
119 virtual ::FT::State
* get_update ();
121 virtual void set_update (const FT::State
& s
);
123 virtual ::FT::State
* get_state ();
125 virtual void set_state (const FT::State
& s
);
128 // Implement TAO_UpdateObjectGroup
130 virtual void tao_update_object_group (
132 PortableGroup::ObjectGroupRefVersion version
,
133 CORBA::Boolean is_primary
);
139 * Load the persistent data.
140 * returns the data loaded.
144 * Store the persistent data.
145 * @param value the data to be stored.
147 void store(long value
);
149 void suicide(const char *);
155 * a bane code for when we should die.
157 FT_TEST::TestReplica::Bane death_pending_
;
160 * verbosity level, settable by client.
170 * The ID number assigned by the factory
172 unsigned long factory_id_
;
175 * The factory that created this replica
177 FT_ReplicaFactory_i
* factory_
;
185 * The POA used to activate this object.
187 PortableServer::POA_var poa_
;
190 * The CORBA object id assigned to this object.
192 PortableServer::ObjectId_var object_id_
;
195 * The CORBA object id assigned to this object.
198 const ACE_TCHAR
* name_persistent_storage
;
201 #include /**/ "ace/post.h"
203 #endif /* FT_TESTREPLICA_I_H_ */