summaryrefslogtreecommitdiff
path: root/TAO/tao/Storable_Base.cpp
blob: 083199b8bf718a4fb690b361b77fdcb57a576fee (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
//=============================================================================
/**
 *  @file   Storable_Base.cpp
 *
 *  @author Bruce Trask <trask_b@ociweb.com>
 *  @author Chanaka Liyanaarachchi <chanaka@ociweb.com>
 *  @author Byron Harris <harrisb@ociweb.com>
 */
//=============================================================================

#include "tao/Storable_Base.h"

#if !defined (__ACE_INLINE__)
#include "tao/Storable_Base.inl"
#endif /* __ACE_INLINE__ */

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

bool TAO::Storable_Base::use_backup_default = false;
bool TAO::Storable_Base::retry_on_ebadf_default = false;

void
TAO::Storable_Base::remove (void)
{
  if (this->use_backup_)
    {
      this->remove_backup ();
    }
  this->do_remove ();
}

bool
TAO::Storable_Base::use_backup ()
{
  return this->use_backup_;
}

ACE_CString
TAO::Storable_Base::state_as_string (Storable_State state)
{
  ACE_CString state_string;
  if (state == goodbit)
    state_string = "goodbit";
  else
    {
      if (state & badbit)
        state_string = "badbit ";
      if (state & eofbit)
        state_string += "eofbit ";
      if (state & failbit)
        state_string += "failbit";
    }
  return state_string;
}

TAO::Storable_Exception::
Storable_Exception (const ACE_CString & file_name)
  : file_name_ (file_name)
{
}

TAO::Storable_Exception::
~Storable_Exception ()
{
}

const ACE_CString &
TAO::Storable_Exception::get_file_name () const
{
  return file_name_;
}

TAO::Storable_Read_Exception::
Storable_Read_Exception (Storable_Base::Storable_State state,
                         const ACE_CString & file_name)
  : Storable_Exception (file_name)
  , storable_state_ (state)
{
}

TAO::Storable_Base::Storable_State
TAO::Storable_Read_Exception::get_state () const
{
  return storable_state_;
}


TAO::Storable_Write_Exception::
Storable_Write_Exception (Storable_Base::Storable_State state,
                          const ACE_CString & file_name)
  : Storable_Exception (file_name)
  , storable_state_ (state)
{
}

TAO::Storable_Base::Storable_State
TAO::Storable_Write_Exception::get_state () const
{
  return storable_state_;
}


TAO_END_VERSIONED_NAMESPACE_DECL