MrSID Decode SDK for LiDAR Reference Manual  1.1.2.4045
IO.h
Go to the documentation of this file.
1 /* //////////////////////////////////////////////////////////////////////////
2 // //
3 // This code is Copyright (c) 2008-2010 LizardTech, Inc, 1008 Western //
4 // Avenue, Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
5 // prohibited. Access to and use of this code is permitted only under //
6 // license from LizardTech, Inc. Portions of the code are protected by //
7 // US and foreign patents and other filings. All Rights Reserved. //
8 // //
10 /* PUBLIC */
11 
12 #ifndef __LIDAR_IO_H__
13 #define __LIDAR_IO_H__
14 
15 #include "lidar/Object.h"
16 #include "lidar/Mutex.h"
17 
18 LT_BEGIN_LIDAR_NAMESPACE
19 
30 class IO : public Object
31 {
32  ABSTRACT_OBJECT(IO);
33 public:
38 
45  void open(void);
52  void close(void);
53 
64  virtual size_t pread(offset_type offset,
65  void *buffer,
66  size_t nbytes) const = 0;
77  virtual size_t pwrite(offset_type offset,
78  const void *buffer,
79  size_t nbytes) const = 0;
80 
86  virtual offset_type size(void) const = 0;
87 
97  virtual void truncate(offset_type length) = 0;
98 
104  virtual void unlink(void) = 0;
105 
106 
111  struct Location
112  {
113  IO *io;
116 
117  ~Location(void);
118 
119  Location(IO *io = NULL, offset_type offset = 0, offset_type length = 0);
120  Location(const Location &rhs);
121  Location &operator=(const Location &rhs);
122 
125  };
126 
127 protected:
133  virtual void popen(void) = 0;
139  virtual void pclose(void) = 0;
140 
141 private:
142  size_t m_openCount;
143  Mutex m_mutex;
144 };
145 
146 LT_END_LIDAR_NAMESPACE
147 #endif // __LIDAR_IO_H__
Location(IO *io=NULL, offset_type offset=0, offset_type length=0)
Location & operator=(const Location &rhs)
virtual offset_type size(void) const =0
Get the size of the resource.
virtual size_t pread(offset_type offset, void *buffer, size_t nbytes) const =0
Read data.
void set(IO *io, offset_type offset, offset_type length)
Location is a helper structure for holding the location of data in a IO object.
Definition: IO.h:111
virtual size_t pwrite(offset_type offset, const void *buffer, size_t nbytes) const =0
Write data.
Object is the base class for implementing reference counting.
Definition: Object.h:34
virtual void pclose(void)=0
The Real Close.
Mutex is a cross platform wrapper for mutexes.
Definition: Mutex.h:29
OVERRIDE_NEW
Definition: IO.h:124
offset_type length
Definition: IO.h:115
void close(void)
Close the IO object.
virtual void truncate(offset_type length)=0
Set the size of the resource.
virtual void unlink(void)=0
Delete the resource when the IO object is deleted.
IO is the base class for binary input and output.
Definition: IO.h:30
virtual void popen(void)=0
The Real Open.
IO * io
Definition: IO.h:113
long long int lt_int64
signed 64-bit integer
Definition: Base.h:46
offset_type offset
Definition: IO.h:114
void open(void)
Open the IO object.
lt_int64 offset_type
Integer data type for file offsets and sizes.
Definition: IO.h:37

LizardTech