Document return values
[ACE_TAO.git] / ACE / ace / FILE.h
blob0396afad974b8d12767696aecba7a38daf0ca805
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file FILE.h
7 * @author Gerhard Lenzer
8 */
9 //=============================================================================
11 #ifndef ACE_FILE_H
12 #define ACE_FILE_H
13 #include /**/ "ace/pre.h"
15 #include "ace/IO_SAP.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "ace/FILE_Addr.h"
23 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
25 /**
26 * @class ACE_FILE_Info
28 * @brief Abstracts basic OS FILE information.
30 class ACE_Export ACE_FILE_Info
32 public:
33 /// Mode of file
34 mode_t mode_;
36 /// No of links
37 nlink_t nlink_;
39 /// Size of file
40 ACE_OFF_T size_;
43 /**
44 * @class ACE_FILE
46 * @brief Defines the core methods of the ACE_FILE abstraction.
48 class ACE_Export ACE_FILE : public ACE_IO_SAP
50 public:
51 /// Close the ACE_FILE handle without removing the ACE_FILE from
52 /// the file system.
53 int close ();
55 /// Close and remove the ACE_FILE from the file system.
56 int remove ();
58 /// Remove the ACE_FILE from the file system without closing the
59 /// ACE_FILE handle.
60 int unlink ();
62 /// Get information on this ACE_FILE.
63 int get_info (ACE_FILE_Info *finfo);
65 /// Get information on this ACE_FILE.
66 int get_info (ACE_FILE_Info &finfo);
68 /// Set filesize to length byte.
69 int truncate (ACE_OFF_T length);
71 /**
72 * Sets the file pointer as follows:
73 * o If @ whence is @c SEEK_SET, the pointer is set to @a offset
74 * bytes.
76 * o If @a whence> is @c SEEK_CUR, the pointer is set to its
77 * current location plus @a offset.
79 * o If @a whence is @c SEEK_END, the pointer is set to the size
80 * of the file plus offset.
82 ACE_OFF_T seek (ACE_OFF_T offset,
83 int whence = SEEK_CUR);
85 /// Return an offset for the file handle.
86 ACE_OFF_T tell ();
88 /**
89 * Disable signal @a signum
90 * This is here to prevent Win32 from
91 * disabling SPIPE using socket calls
93 int disable (int signum) const ;
95 /// Return the local endpoint address in the referenced ACE_Addr.
96 /// Returns 0 if successful, else -1.
97 int get_local_addr (ACE_Addr &) const;
99 /// Return the same thing as get_local_addr().
100 int get_remote_addr (ACE_Addr &) const;
102 /// Dump the state of an object.
103 void dump () const;
105 /// Declare the dynamic allocation hooks.
106 ACE_ALLOC_HOOK_DECLARE;
108 protected:
109 /// Ensure that this class is only created by the
110 /// ACE_FILE_Connector.
111 ACE_FILE ();
113 /// File we are "connected" with...
114 ACE_FILE_Addr addr_;
117 ACE_END_VERSIONED_NAMESPACE_DECL
119 #if defined (__ACE_INLINE__)
120 #include "ace/FILE.inl"
121 #endif /* __ACE_INLINE__ */
123 #include /**/ "ace/post.h"
124 #endif /* ACE_FILE_H */