blob: 6fbdcdbfe44569d0a9ee27302e2b23261ae52399 (
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
// -*- C++ -*-
//=============================================================================
/**
* @file PG_Group_List_Store.h
*
* $Id$
*
* @author Byron Harris <harrisb@ociweb.com>
*/
//=============================================================================
#ifndef PG_GROUP_LIST_STORE_H
#define PG_GROUP_LIST_STORE_H
#include /**/ "ace/pre.h"
#include "orbsvcs/PortableGroup/portablegroup_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "orbsvcs/PortableGroupC.h"
#include <set>
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
namespace TAO
{
class Storable_Base;
class Storable_Factory;
}
namespace TAO
{
/**
* @class PG_Group_List_Store
* Persists a list of object groups that are themselves persisted.
* All creation and deletion of persistent object groups should
* result in the list store being updated.
* This is done to support multiple group factories using the same
* persistent object groups.
* @see PG_Object_Group_Storable
*/
class TAO_PortableGroup_Export PG_Group_List_Store
{
public:
PG_Group_List_Store (Storable_Factory & storable_factory);
~PG_Group_List_Store ();
/**
* Return a group ID that can be used for creating a new object group.
*/
PortableGroup::ObjectGroupId get_next_group_id ();
int add (PortableGroup::ObjectGroupId id);
int remove (PortableGroup::ObjectGroupId id);
typedef std::set<PortableGroup::ObjectGroupId> Group_Ids;
typedef std::set<PortableGroup::ObjectGroupId>::iterator Group_Id_Iterator;
typedef std::set<PortableGroup::ObjectGroupId>::reverse_iterator Group_Id_Revers_Iterator;
typedef std::set<PortableGroup::ObjectGroupId>::const_iterator Group_Id_Const_Iterator;
Group_Ids & get_group_ids ();
/**
* Make explicit that state is stale instead of relying only
* on persistent file time stamp.
*/
void stale (bool is_stale);
bool stale ();
/**
* Answer if the list is obsolete because the persistent store has been updated.
* Used by PG_Group_Factory to avoid having to compare IDs in group_map_ with
* the list contained here.
*/
bool list_obsolete ();
private:
Group_Ids group_ids_;
/// Ensure ID is monotonically increasing even when groups gets
/// removed.
PortableGroup::ObjectGroupId next_group_id_;
TAO::Storable_Base * create_stream (const char * mode);
Storable_Factory & storable_factory_;
bool loaded_from_stream_;
time_t last_changed_;
bool stale_;
void read (TAO::Storable_Base & stream);
void write (TAO::Storable_Base & stream);
bool is_obsolete (time_t stored_time);
friend class PG_Group_List_Store_File_Guard;
};
}
TAO_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif /* PG_GROUP_LIST_STORE_H */
|