summaryrefslogtreecommitdiff
path: root/TAO/tao/PortableServer/Creation_Time.inl
blob: 7308e632c6feb048072aa94378651fa475428870 (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
114
115
116
117
118
119
120
121
122
123
// -*- C++ -*-
#include "tao/orbconf.h"        /* For POA_NO_TIMESTAMP definition. */
#include "ace/OS_NS_string.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  namespace Portable_Server
  {
    ACE_INLINE CORBA::ULong
    Creation_Time::creation_time_length (void)
    {
      return 2 * sizeof (CORBA::ULong);
    }

    ACE_INLINE
    Creation_Time::Creation_Time (const ACE_Time_Value &creation_time)
    {
      this->time_stamp_[Creation_Time::SEC_FIELD]  = (CORBA::ULong) creation_time.sec ();
      this->time_stamp_[Creation_Time::USEC_FIELD] = (CORBA::ULong) creation_time.usec ();
    }

    ACE_INLINE
    Creation_Time::Creation_Time (void)
    {
      this->time_stamp_[Creation_Time::SEC_FIELD]  = 0;
      this->time_stamp_[Creation_Time::USEC_FIELD] = 0;
    }

    ACE_INLINE void
    Creation_Time::creation_time (const void *creation_time)
    {
      ACE_OS::memcpy (&this->time_stamp_,
                      creation_time,
                      Creation_Time::creation_time_length ());
    }

    ACE_INLINE const void *
    Creation_Time::creation_time () const
    {
      return &this->time_stamp_;
    }

    ACE_INLINE bool
    Creation_Time::operator== (const Creation_Time &rhs) const
    {
    #if (POA_NO_TIMESTAMP == 1)
      ACE_UNUSED_ARG (rhs);
      return true;
    #else
      return ACE_OS::memcmp (&this->time_stamp_,
                             &rhs.time_stamp_,
                             Creation_Time::creation_time_length ()) == 0;
    #endif /* POA_NO_TIMESTAMP */
    }

    ACE_INLINE bool
    Creation_Time::operator!= (const Creation_Time &rhs) const
    {
    #if (POA_NO_TIMESTAMP == 1)
      ACE_UNUSED_ARG (rhs);
      return false;
    #else
      return ACE_OS::memcmp (&this->time_stamp_,
                             &rhs.time_stamp_,
                             Creation_Time::creation_time_length ()) != 0;
    #endif /* POA_NO_TIMESTAMP */
    }

    ACE_INLINE bool
    Temporary_Creation_Time::operator== (const Creation_Time &rhs) const
    {
    #if (POA_NO_TIMESTAMP == 1)
      ACE_UNUSED_ARG (rhs);
      return true;
    #else
      return ACE_OS::memcmp (this->time_stamp_,
                             rhs.creation_time (),
                             Creation_Time::creation_time_length ()) == 0;
    #endif /* POA_NO_TIMESTAMP */
    }

    ACE_INLINE bool
    Temporary_Creation_Time::operator!= (const Creation_Time &rhs) const
    {
    #if (POA_NO_TIMESTAMP == 1)
      ACE_UNUSED_ARG (rhs);
      return false;
    #else
      return ACE_OS::memcmp (this->time_stamp_,
                             rhs.creation_time (),
                             Creation_Time::creation_time_length ()) != 0;
    #endif /* POA_NO_TIMESTAMP */
    }

    ACE_INLINE bool
    Creation_Time::operator== (const Temporary_Creation_Time &rhs) const
    {
      return rhs == *this;
    }

    ACE_INLINE bool
    Creation_Time::operator!= (const Temporary_Creation_Time &rhs) const
    {
      return rhs != *this;
    }

    ACE_INLINE
    Temporary_Creation_Time::Temporary_Creation_Time (void)
      : time_stamp_ (0)
    {
    }

    ACE_INLINE void
    Temporary_Creation_Time::creation_time (const void *creation_time)
    {
      this->time_stamp_ = (void *) creation_time;
    }
  }
}

TAO_END_VERSIONED_NAMESPACE_DECL