blob: eaa37bdee4512eca201d834764d3ab66721dc575 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
// -*- C++ -*-
//=============================================================================
/**
* @file PG_Group_Guard.h
*
* @author Ossama Othman <ossama@uci.edu>
*/
//=============================================================================
#ifndef TAO_PG_GROUP_GUARD_H
#define TAO_PG_GROUP_GUARD_H
#include /**/ "ace/pre.h"
#include "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "orbsvcs/PortableGroup/PG_Factory_Set.h"
#include "tao/PortableServer/PortableServerC.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
/// Forward declarations.
class TAO_PG_GenericFactory;
class TAO_PG_ObjectGroupManager;
/**
* @class TAO_PG_Group_Guard
*
* @brief Guard implementation used to make object group cleanup
* exception-safe.
*
* This guard's destructor performs cleanup of object group
* resources. Thus, cleanup is performed when this guard goes out of
* scope unless explicitly released from that responsibility.
*
* This guard is meant to be used internally by the
* TAO_PG_GenericFactory class.
*/
class TAO_PG_Group_Guard
{
public:
/// Constructor.
TAO_PG_Group_Guard (TAO_PG_GenericFactory & generic_factory,
TAO_PG_Factory_Set & factory_set,
TAO_PG_ObjectGroupManager & group_manager,
const PortableServer::ObjectId & oid);
/// Destructor.
~TAO_PG_Group_Guard (void);
/// Relinquish cleanup responsibility.
void release (void);
private:
/// Reference to the infrastructure TAO_PG_GenericFactory that
/// created the below TAO_PG_Factory_Set.
TAO_PG_GenericFactory & generic_factory_;
/// Reference to the TAO_PG_Factory_Set that contains all
/// application-specific GenericFactory object references.
TAO_PG_Factory_Set & factory_set_;
/// Reference to the TAO_PG_ObjectGroupManager that maintains the
/// object group map.
TAO_PG_ObjectGroupManager & group_manager_;
/// Reference to the ObjectId that is the map key necessary to
/// unbind the corresponding object group map entry from the map
/// upon destruction.
const PortableServer::ObjectId & oid_;
/// Flag that dictates whether or not the destructor will perform
/// cleanup.
bool released_;
};
TAO_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif /* TAO_PG_GROUP_GUARD_H */
|