MAK Data Logger API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
largeFileFunctions.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
9 #ifndef largeFileFunctions_H_
10 #define largeFileFunctions_H_
11 
12 #include "lgrUtil.h"
13 
14 #include <stddef.h>
15 #include <vlutil/vlMachineTypes.h>
16 
17 class DtFilename;
18 
19 namespace MAKLogger
20 {
21  typedef int DtFileDesc;
22 
28  {
29  public:
30 
34  static DtFileDesc openForReading(const DtFilename& filename, bool randomAccess /*= true*/);
35 
39  static DtFileDesc openForWriting(const DtFilename& filename, bool truncate = true);
40 
44  static DtFileDesc openForReadingAndWriting(DtFilename filename,
45  bool truncate = false, bool randomAccess = true);
46 
50  static bool close(DtFileDesc);
51 
53  static DtInt64 size(DtFileDesc);
54 
56  static DtInt64 tell(DtFileDesc);
57 
60  static DtInt64 seekCurrent(DtFileDesc,DtInt64);
61 
64  static DtInt64 seekEnd(DtFileDesc,DtInt64);
65 
68  static DtInt64 seekSet(DtFileDesc,DtInt64);
69 
75  static size_t read(DtFileDesc,void* buffer,size_t bytesToRead);
76 
83  template <typename T>
84  static bool readStruct(DtFileDesc fd,T& structObject)
85  {
86  size_t desiredSize = sizeof(T);
87  size_t readSize = DtLargeFileFunctions::read(fd,&structObject,desiredSize);
88  return readSize == desiredSize;
89  }
90 
97  static char* readBytes(DtFileDesc,size_t bytesToRead,size_t& totalBytesRead);
98 
103  static size_t write(DtFileDesc,const void* buffer,size_t bytesToWrite);
104 
111  template <typename T>
112  static bool writeStruct(DtFileDesc fd,const T& structObject)
113  {
114  size_t desiredSize = sizeof(T);
115  size_t writeSize = DtLargeFileFunctions::write(fd,&structObject,desiredSize);
116  return writeSize == desiredSize;
117  }
118 
119  };
120 
121 }
122 
123 #endif

Document ID: Generated on Thu Apr 7 20:50:59 EDT 2016 from SVN revision 163818
Copyright © 2005-2012 VT MÄK. All Rights Reserved (www.mak.com)