summaryrefslogtreecommitdiff
path: root/ace/Active_Map_Manager.i
blob: 8980a49002f1e5bf463230d5ca63d0735f999800 (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
// $Id$

ACE_INLINE 
ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (void)
  : index_ (~0),
    generation_ (0)
{
  // If you change ~0, please change ACE_Map_Manager::free_list_id()
  // accordingly.
}

ACE_INLINE 
ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (u_long index, 
                                                        u_long generation)
  : index_ (index),
    generation_ (generation)
{
}

ACE_INLINE u_long 
ACE_Active_Map_Manager_Key::index (void) const
{
  return this->index_;
}
  
ACE_INLINE u_long 
ACE_Active_Map_Manager_Key::generation (void) const
{
  return this->generation_;
}

ACE_INLINE int 
ACE_Active_Map_Manager_Key::operator== (const ACE_Active_Map_Manager_Key &rhs) const
{
  return 
    this->index_ == rhs.index_ &&
    this->generation_ == rhs.generation_;
}

ACE_INLINE int 
ACE_Active_Map_Manager_Key::operator!= (const ACE_Active_Map_Manager_Key &rhs) const
{
  return !this->operator== (rhs);
}

ACE_INLINE void 
ACE_Active_Map_Manager_Key::index (u_long i)
{
  this->index_ = i;
}
  
ACE_INLINE void 
ACE_Active_Map_Manager_Key::generation (u_long g)
{
  this->generation_ = g;
}

ACE_INLINE void 
ACE_Active_Map_Manager_Key::increment_generation_count (void)
{
  ++this->generation_;
}

/* static */
ACE_INLINE size_t
ACE_Active_Map_Manager_Key::size (void)
{
  return sizeof (u_long) + sizeof (u_long);
}

ACE_INLINE void 
ACE_Active_Map_Manager_Key::decode (const void *d)
{
  // Cast so that we can do pointer arithmetic.
  const char *data = (const char *) d;

  // Grab the index first.
  ACE_OS::memcpy (&this->index_,
                  data,
                  sizeof this->index_);

  // Move along...
  data += sizeof this->index_;

  // Grab the generation second.
  ACE_OS::memcpy (&this->generation_,
                  data,
                  sizeof this->generation_);
}

ACE_INLINE void 
ACE_Active_Map_Manager_Key::encode (void *d) const
{
  // Cast so that we can do pointer arithmetic.
  char *data = (char *) d;

  // Grab the index first.
  ACE_OS::memcpy (data,
                  &this->index_,
                  sizeof this->index_);

  // Move along...
  data += sizeof this->index_;

  // Grab the generation second.
  ACE_OS::memcpy (data,
                  &this->generation_,
                  sizeof this->generation_);
}