3 //=============================================================================
5 * @file LifespanStrategy.h
7 * @author Johnny Willemsen <jwillemsen@remedy.nl>
9 //=============================================================================
11 #ifndef TAO_PORTABLESERVER_LIFESPANPOLICY_H
12 #define TAO_PORTABLESERVER_LIFESPANPOLICY_H
13 #include /**/ "ace/pre.h"
15 #include "tao/PortableServer/LifespanPolicyC.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "tao/Object_KeyC.h"
23 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
29 namespace Portable_Server
31 class Temporary_Creation_Time
;
33 class LifespanStrategy
36 LifespanStrategy () = default;
37 virtual ~LifespanStrategy () = default;
39 virtual void strategy_init (TAO_Root_POA
*poa
);
41 virtual void strategy_cleanup ();
43 void create (const char *name
, const TAO::ObjectKey
&key
);
45 virtual void notify_startup () = 0;
47 virtual void notify_shutdown () = 0;
50 * Validate the passed object key if it belongs to this POA.
52 bool validate (TAO::ObjectKey_var
& key
);
55 * Returns the length of the key type
57 virtual CORBA::ULong
key_length () const = 0;
59 CORBA::ULong
key_type_length () const;
61 /// Do we have set persistent or not,
62 virtual CORBA::Boolean
is_persistent () const = 0;
64 virtual void create_key (CORBA::Octet
*buffer
, CORBA::ULong
& starting_at
) = 0;
66 /// Validate whether this matches the set lifespan strategy
67 virtual bool validate (
68 CORBA::Boolean is_persistent
,
69 const TAO::Portable_Server::Temporary_Creation_Time
& creation_time
) const = 0;
71 /// Check the state of the POA.
72 virtual void check_state () = 0;
74 virtual bool use_imr () const = 0;
76 virtual CORBA::Object_ptr
imr_key_to_object (
77 const TAO::ObjectKey
&key
,
78 const char *type_id
) const = 0;
81 TAO_Root_POA
*poa_
{};
83 } /* namespace Portable_Server */
86 TAO_END_VERSIONED_NAMESPACE_DECL
88 #include /**/ "ace/post.h"
89 #endif /* TAO_PORTABLESERVER_LIFESPANPOLICY_H */