AJA NTV2 SDK  17.1.1.1245
NTV2 SDK 17.1.1.1245
file_io.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
9 #include "ajabase/common/types.h"
10 #include "ajabase/system/file_io.h"
11 #include <sys/types.h>
12 #include <sys/stat.h>
13 #include <sstream>
14 
15 #if defined(AJA_WINDOWS)
16  // Windows includes
17  #include <direct.h>
18  #include <io.h>
19 #elif defined(AJA_BAREMETAL)
20  // TODO
21 #else
22  // Posix includes
23  #include <fcntl.h>
24  #include <dirent.h>
25  #include <fnmatch.h>
26  #include <limits.h>
27  #include <stdio.h>
28  #include <stdlib.h>
29  #include <string.h>
30  #include <unistd.h>
31 #endif
32 
33 #if defined(AJA_MAC)
34  #include <mach-o/dyld.h>
35 #endif
36 
37 using std::string;
38 using std::wstring;
39 using std::vector;
40 
41 #if defined(AJA_WINDOWS)
42  // Windows helper functions
43 
44  // found at: http://www.frenk.com/2009/12/convert-filetime-to-unix-timestamp/
45  int64_t FileTime_to_POSIX(FILETIME ft)
46  {
47  // takes the last modified date
48  LARGE_INTEGER date, adjust;
49  date.HighPart = ft.dwHighDateTime;
50  date.LowPart = ft.dwLowDateTime;
51 
52  // 100-nanoseconds = milliseconds * 10000
53  adjust.QuadPart = 11644473600000 * 10000;
54 
55  // removes the diff between 1970 and 1601
56  date.QuadPart -= adjust.QuadPart;
57 
58  // converts back from 100-nanoseconds to seconds
59  return (int64_t)(date.QuadPart / 10000000);
60  }
61 #elif defined(AJA_BAREMETAL)
62  // TODO
63 #else
64  // Posix helper functions
65  static string GetEnvVar(string const & key)
66  {
67  char * val = getenv( key.c_str() );
68  return val == NULL ? string("") : string(val);
69  }
70 #endif
71 
72 
74 {
75 #if defined(AJA_WINDOWS)
76  mFileDescriptor = INVALID_HANDLE_VALUE;
77 #else
78  mpFile = NULL;
79 #endif
80 
81 #if TARGET_CPU_ARM64
82  mIoModel = eAJAIoAlternate;
83 #else
84  mIoModel = eAJAIoDefault;
85 #endif
86 
87 }
88 
89 
91 {
92  Close();
93 }
94 
95 
96 bool
97 AJAFileIO::FileExists(const std::wstring& fileName)
98 {
99 #if defined(AJA_WINDOWS)
100  struct _stat dummy;
101  return _wstat(fileName.c_str(), &dummy) != -1;
102 #elif defined(AJA_BAREMETAL)
103  // TODO
104  return false;
105 #else
106  string aString;
107  aja::wstring_to_string(fileName, aString);
108  return FileExists(aString);
109 #endif
110 }
111 
112 
113 bool
114 AJAFileIO::FileExists(const std::string& fileName)
115 {
116 #if defined(AJA_WINDOWS)
117  struct _stat dummy;
118  return _stat(fileName.c_str(), &dummy) != -1;
119 #elif defined(AJA_BAREMETAL)
120  // TODO
121  return false;
122 #else
123  struct stat dummy;
124  bool bExists = stat(fileName.c_str(), &dummy) != -1;
125  return bExists;
126 #endif
127 }
128 
129 
130 AJAStatus
132  const std::wstring& fileName,
133  const int flags,
134  const int properties)
135 {
136 #if defined(AJA_WINDOWS)
137  DWORD desiredAccess = 0;
138  DWORD creationDisposition = 0;
139  DWORD flagsAndAttributes = 0;
140  DWORD shareMode = 0;
141  AJAStatus status = AJA_STATUS_FAIL;
142 
143  if ((INVALID_HANDLE_VALUE == mFileDescriptor) &&
144  (0 != fileName.length()))
145  {
146  // If the flags are not compatable, we will let
147  // Windows provide the error checking.
148  if ((eAJAReadOnly & flags) || (eAJAReadWrite & flags)) // O_RDONLY, O_RDWR
149  {
150  desiredAccess |= GENERIC_READ;
151  shareMode = FILE_SHARE_READ;
152  }
153  if ((eAJAWriteOnly & flags) || (eAJAReadWrite & flags)) // O_WRONLY
154  {
155  desiredAccess |= GENERIC_WRITE;
156  shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
157  }
158 
159  if (eAJACreateAlways & flags)
160  creationDisposition |= CREATE_ALWAYS; // O_CREAT
161  if (eAJACreateNew & flags)
162  creationDisposition |= CREATE_NEW; // (O_CREAT || O_EXCL)
163  if (eAJATruncateExisting & flags)
164  creationDisposition |= TRUNCATE_EXISTING; // O_TRUNC
165  if (eAJAReadOnly & flags)
166  creationDisposition |= OPEN_EXISTING;
167 
168  if (eAJAUnbuffered & properties)
169  flagsAndAttributes |= FILE_FLAG_NO_BUFFERING;
170 
171  mFileDescriptor = CreateFileW(
172  fileName.c_str(),
173  desiredAccess,
174  shareMode,
175  NULL,
176  creationDisposition,
177  flagsAndAttributes,
178  NULL);
179 
180 
181  if (INVALID_HANDLE_VALUE != mFileDescriptor)
182  {
183  status = AJA_STATUS_SUCCESS;
184  }
185  }
186  return status;
187 #elif defined(AJA_BAREMETAL)
188  // TODO
189  return AJA_STATUS_FAIL;
190 #else
191  string aString;
192  aja::wstring_to_string(fileName,aString);
193  AJAStatus status = Open(aString,flags,properties);
194 
195  return status;
196 #endif
197 }
198 
199 
200 AJAStatus
202  const std::string& fileName,
203  const int flags,
204  const int properties)
205 {
206 #if defined(AJA_WINDOWS)
207  wstring wString;
208  aja::string_to_wstring(fileName,wString);
209  AJAStatus status = Open(wString,flags,properties);
210 
211  return status;
212 #elif defined(AJA_BAREMETAL)
213  // TODO
214  return AJA_STATUS_FAIL;
215 #else
216  AJAStatus status = AJA_STATUS_FAIL;
217  string flagsAndAttributes;
218 
219  if ((mpFile == NULL) && (0 != fileName.length()))
220  {
221  // If the flags are not compatable, we will let
222  // Linux provide the error checking.
223  if (eAJAReadOnly & flags)
224  {
225  flagsAndAttributes = "r";
226  }
227  else if (eAJAWriteOnly & flags)
228  {
229  if (eAJATruncateExisting & flags)
230  flagsAndAttributes = "w";
231  else
232  flagsAndAttributes = "w+";
233  }
234  else if (eAJAReadWrite & flags)
235  {
236  if (eAJATruncateExisting & flags)
237  {
238  flagsAndAttributes = "w+";
239  }
240  else
241  {
242  if (eAJACreateAlways & flags)
243  flagsAndAttributes = "a+";
244 
245  if (eAJACreateNew & flags)
246  flagsAndAttributes = "w+";
247  }
248  }
249 
250  if (true == flagsAndAttributes.empty())
251  return AJA_STATUS_BAD_PARAM;
252 
253  // One can also change the buffering behavior via:
254  // setvbuf(FILE*, char* pBuffer, _IOFBF, size_t size);
255  mpFile = fopen(fileName.c_str(), flagsAndAttributes.c_str());
256  if (NULL != mpFile)
257  {
258  int fd = fileno(mpFile);
259 #if defined(AJA_MAC)
260  if (eAJANoCaching & properties)
261  {
262  fcntl(fd, F_NOCACHE, 1);
263  }
264 #endif
265  if (eAJAUnbuffered & properties)
266  {
267  if (-1 != fd)
268  status = AJA_STATUS_SUCCESS;
269  }
270  else
271  {
272  status = AJA_STATUS_SUCCESS;
273  }
274  }
275  }
276  return status;
277 #endif
278 }
279 
280 AJAStatus
282 {
283 #if defined(AJA_WINDOWS)
284  AJAStatus status = AJA_STATUS_FAIL;
285 
286  if (INVALID_HANDLE_VALUE != mFileDescriptor)
287  {
288  if (TRUE == CloseHandle(mFileDescriptor))
289  {
290  status = AJA_STATUS_SUCCESS;
291  }
292  mFileDescriptor = INVALID_HANDLE_VALUE;
293  }
294  return status;
295 #elif defined(AJA_BAREMETAL)
296  // TODO
297  return AJA_STATUS_FAIL;
298 #else
299  AJAStatus status = AJA_STATUS_FAIL;
300 
301  if (NULL != mpFile)
302  {
303  int retVal = 0;
304  retVal = fclose(mpFile);
305 
306  if (0 == retVal)
307  status = AJA_STATUS_SUCCESS;
308 
309  mpFile = NULL;
310  }
311  return status;
312 #endif
313 }
314 
315 
316 bool
318 {
319 #if defined(AJA_WINDOWS)
320  return (INVALID_HANDLE_VALUE != mFileDescriptor);
321 #else
322  return (NULL != mpFile);
323 #endif
324 }
325 
326 
327 uint32_t
328 AJAFileIO::Read(uint8_t* pBuffer, const uint32_t length)
329 {
330 #if defined(AJA_WINDOWS)
331  DWORD bytesRead = 0;
332 
333  if (INVALID_HANDLE_VALUE != mFileDescriptor)
334  {
335  ReadFile(mFileDescriptor, pBuffer, length, &bytesRead, NULL);
336  }
337  return bytesRead;
338 #elif defined(AJA_BAREMETAL)
339  // TODO
340  return 0;
341 #else
342  uint32_t retVal = 0;
343  if (NULL != mpFile)
344  {
345  size_t bytesRead;
346  if (mIoModel == eAJAIoAlternate)
347  bytesRead = read(fileno(mpFile), pBuffer, length);
348  else
349  bytesRead = fread(pBuffer, 1, length, mpFile);
350 
351  if (bytesRead > 0)
352  retVal = uint32_t(bytesRead);
353  }
354  return retVal;
355 #endif
356 }
357 
358 
359 uint32_t
360 AJAFileIO::Read(std::string& buffer, const uint32_t length)
361 {
362 #if defined(AJA_WINDOWS)
363  buffer.resize(length);
364  uint32_t actual_bytes = Read((uint8_t*) &buffer[0], length);
365  buffer.resize(actual_bytes);
366  return actual_bytes;
367 #elif defined(AJA_BAREMETAL)
368  // TODO
369  return 0;
370 #else
371  buffer.resize(length);
372  uint32_t actual_bytes = Read((uint8_t*) &buffer[0], length);
373  buffer.resize(actual_bytes);
374  return actual_bytes;
375 #endif
376 }
377 
378 
379 uint32_t
380 AJAFileIO::Write(const uint8_t* pBuffer, const uint32_t length) const
381 {
382 #if defined(AJA_WINDOWS)
383  DWORD bytesWritten = 0;
384 
385  if (INVALID_HANDLE_VALUE != mFileDescriptor)
386  {
387  WriteFile(mFileDescriptor, pBuffer, length, &bytesWritten, NULL);
388  }
389  return bytesWritten;
390 #elif defined(AJA_BAREMETAL)
391  // TODO
392  return 0;
393 #else
394  uint32_t retVal = 0;
395  if (NULL != mpFile)
396  {
397  size_t bytesWritten = 0;
398  if (mIoModel == eAJAIoAlternate)
399  {
400  if ((bytesWritten = write(fileno(mpFile), pBuffer, length)) > 0)
401  {
402  retVal = uint32_t(bytesWritten);
403  }
404  }
405  else
406  {
407  if ((bytesWritten = fwrite(pBuffer, 1, length, mpFile)) > 0)
408  {
409  retVal = uint32_t(bytesWritten);
410  }
411  }
412  }
413  return retVal;
414 #endif
415 }
416 
417 
418 uint32_t
419 AJAFileIO::Write(const std::string& buffer) const
420 {
421 #if defined(AJA_WINDOWS)
422  return Write((uint8_t*) buffer.c_str(), (uint32_t)buffer.length());
423 #else
424  return Write((uint8_t*) buffer.c_str(), (uint32_t)buffer.length());
425 #endif
426 }
427 
428 
429 AJAStatus
431 {
432 #if defined(AJA_WINDOWS)
433  AJAStatus status = AJA_STATUS_FAIL;
434  if (INVALID_HANDLE_VALUE != mFileDescriptor)
435  {
436  if (FlushFileBuffers(mFileDescriptor) != 0)
437  status = AJA_STATUS_SUCCESS;
438  }
439  return status;
440 #elif defined(AJA_BAREMETAL)
441  // TODO
442  return AJA_STATUS_FAIL;
443 #else
444  AJAStatus status = AJA_STATUS_FAIL;
445  if (IsOpen())
446  {
447  int fd = fileno(mpFile);
448  if (-1 != fd)
449  {
450  if (fsync(fd) == 0)
451  status = AJA_STATUS_SUCCESS;
452  }
453  }
454  return status;
455 #endif
456 }
457 
458 AJAStatus
459 AJAFileIO::Truncate(int32_t size)
460 {
461 #if defined(AJA_WINDOWS)
462  AJAStatus status = AJA_STATUS_FAIL;
463  if (INVALID_HANDLE_VALUE != mFileDescriptor)
464  {
465  // save off current offset
466  int64_t offset = Tell();
467  // move file pointer to size from start of file
468  status = Seek(size, eAJASeekSet);
469  if (status == AJA_STATUS_SUCCESS)
470  {
471  // truncates file at current file pointer
472  if (SetEndOfFile(mFileDescriptor) != 0)
473  {
474  status = AJA_STATUS_SUCCESS;
475  }
476  // set the offset back to original position (mimmic ftruncate)
477  status = Seek(offset, eAJASeekSet);
478  }
479  }
480  return status;
481 #elif defined(AJA_BAREMETAL)
482  // TODO
483  return AJA_STATUS_FAIL;
484 #else
485  AJAStatus status = AJA_STATUS_FAIL;
486  if (IsOpen())
487  {
488  int fd = fileno(mpFile);
489  if (-1 != fd)
490  {
491  int res = ftruncate(fd, size);
492  if (res == 0)
493  {
494  status = AJA_STATUS_SUCCESS;
495  }
496  }
497  }
498  return status;
499 #endif
500 }
501 
502 int64_t
504 {
505 #if defined(AJA_WINDOWS)
506  int64_t retVal = 0;
507  if (INVALID_HANDLE_VALUE != mFileDescriptor)
508  {
509  LARGE_INTEGER liDistanceToMove;
510  liDistanceToMove.HighPart = 0;
511  liDistanceToMove.LowPart = 0;
512 
513  LARGE_INTEGER liCurrentFilePointer;
514 
515  BOOL status = SetFilePointerEx(mFileDescriptor, liDistanceToMove, &liCurrentFilePointer, FILE_CURRENT);
516 
517  if (status == 0)
518  {
519  retVal = (int64_t)-1;
520  }
521  else
522  {
523  retVal = liCurrentFilePointer.QuadPart;
524  }
525  }
526  return retVal;
527 #elif defined(AJA_BAREMETAL)
528  // TODO
529  return 0;
530 #else
531  int64_t retVal = 0;
532  if (IsOpen())
533  {
534  if (mIoModel == eAJAIoAlternate)
535  retVal = lseek(fileno(mpFile), 0, SEEK_CUR);
536  else
537  retVal = (int64_t)ftello(mpFile);
538  }
539  return retVal;
540 #endif
541 }
542 
543 
544 AJAStatus
545 AJAFileIO::Seek(const int64_t distance, const AJAFileSetFlag flag) const
546 {
547 #if defined(AJA_WINDOWS)
548  DWORD moveMethod;
549  DWORD retVal;
550  AJAStatus status = AJA_STATUS_FAIL;
551 
552  if (INVALID_HANDLE_VALUE != mFileDescriptor)
553  {
554  switch (flag)
555  {
556  case eAJASeekSet:
557  moveMethod = FILE_BEGIN;
558  break;
559 
560  case eAJASeekCurrent:
561  moveMethod = FILE_CURRENT;
562  break;
563 
564  case eAJASeekEnd:
565  moveMethod = FILE_END;
566  break;
567 
568  default:
569  return (AJA_STATUS_BAD_PARAM);
570  }
571  LARGE_INTEGER liDistanceToMove;
572  liDistanceToMove.HighPart = (LONG)(distance>>32);
573  liDistanceToMove.LowPart = (DWORD)distance;
574 
575  retVal = SetFilePointerEx(mFileDescriptor, liDistanceToMove, NULL, moveMethod);
576  if ( retVal == TRUE )
577  {
578  status = AJA_STATUS_SUCCESS;
579  }
580 
581  }
582  return status;
583 #elif defined(AJA_BAREMETAL)
584  // TODO
585  return AJA_STATUS_FAIL;
586 #else
587  AJAStatus status = AJA_STATUS_FAIL;
588  int whence;
589  long int retVal;
590 
591  if (NULL != mpFile)
592  {
593  switch (flag)
594  {
595  case eAJASeekSet:
596  whence = SEEK_SET;
597  break;
598 
599  case eAJASeekCurrent:
600  whence = SEEK_CUR;
601  break;
602 
603  case eAJASeekEnd:
604  whence = SEEK_END;
605  break;
606 
607  default:
608  return (AJA_STATUS_BAD_PARAM);
609  }
610 
611  if (mIoModel == eAJAIoAlternate)
612  retVal = lseek(fileno(mpFile), (off_t)distance, whence);
613  else
614  retVal = fseeko(mpFile, (off_t)distance, whence);
615 
616  if (-1 != retVal)
617  {
618  status = AJA_STATUS_SUCCESS;
619  }
620  }
621  return status;
622 #endif
623 }
624 
625 
626 AJAStatus
627 AJAFileIO::FileInfo(int64_t& createTime, int64_t& modTime, int64_t& size)
628 {
629 #if defined(AJA_WINDOWS)
630  string filePath;
631  return FileInfo(createTime, modTime, size, filePath);
632 #else
633  string filePath;
634  return FileInfo(createTime, modTime, size, filePath);
635 #endif
636 }
637 
638 AJAStatus
639 AJAFileIO::FileInfo(int64_t& createTime, int64_t& modTime, int64_t& size, std::string& filePath)
640 {
641  createTime = modTime = size = 0;
642  filePath = "";
643 #if defined(AJA_WINDOWS)
644  AJAStatus status = AJA_STATUS_FAIL;
645 
646  createTime = modTime = size = 0;
647 
648  if(IsOpen())
649  {
650  FILETIME cTime;
651  FILETIME aTime;
652  FILETIME wTime;
653  if( GetFileTime(mFileDescriptor,&cTime,&aTime,&wTime) )
654  {
655  LARGE_INTEGER sizeInfo;
656  if(GetFileSizeEx(mFileDescriptor,&sizeInfo))
657  {
658  size = (int64_t)sizeInfo.QuadPart;
659  createTime = FileTime_to_POSIX(cTime);
660  modTime = FileTime_to_POSIX(wTime);
661 
662  const DWORD maxFilePathLen = 2048;
663  filePath.resize(maxFilePathLen);
664  DWORD retVal;
665  retVal = GetFinalPathNameByHandleA(mFileDescriptor, &filePath[0], maxFilePathLen, FILE_NAME_NORMALIZED);
666  if (retVal != 0)
667  {
668  status = AJA_STATUS_SUCCESS;
669  filePath.resize(retVal);
670  }
671  else
672  {
673  status = AJA_STATUS_NOT_FOUND;
674  }
675  }
676  }
677  }
678  return status;
679 #elif defined(AJA_BAREMETAL)
680  // TODO
681  return AJA_STATUS_FAIL;
682 #else
683  AJAStatus status = AJA_STATUS_FAIL;
684 
685  if (IsOpen())
686  {
687  struct stat fileStatus;
688  int fd = fileno(mpFile);
689  int fErr = fstat(fd, &fileStatus);
690 
691  if (fErr == 0)
692  {
693  size = fileStatus.st_size;
694  createTime = fileStatus.st_ctime;
695  modTime = fileStatus.st_mtime;
696 
697 #if defined(AJA_LINUX)
698  // Linux way to get path of file descriptor
699  ssize_t n = 0;
700  if (fd != -1)
701  {
702  string procPath = "/proc/self/fd/" + aja::to_string(fd);
703  filePath.resize(PATH_MAX);
704  n = readlink(procPath.c_str(), &filePath[0], PATH_MAX);
705  if (n < 0)
706  {
707  n = 0;
708  status = AJA_STATUS_NOT_FOUND;
709  }
710  else
711  {
712  status = AJA_STATUS_SUCCESS;
713  }
714  }
715  filePath.resize(n);
716 #elif defined(AJA_MAC)
717  // Mac way to get path of file descriptor
718  if (fd != -1)
719  {
720  filePath.resize(PATH_MAX);
721  if (fcntl(fd, F_GETPATH, &filePath[0]) != -1)
722  {
723  status = AJA_STATUS_SUCCESS;
724  filePath.resize(strlen(filePath.c_str()));
725  }
726  else
727  {
728  status = AJA_STATUS_NOT_FOUND;
729  }
730  }
731 #else
732  #warning "'AJAFileIO::FileInfo' does not support path retrieval."
733  filePath = "";
734  status = AJA_STATUS_SUCCESS;
735 #endif
736  }
737  }
738  return status;
739 #endif
740 }
741 
742 
743 AJAStatus
744 AJAFileIO::Delete(const string& fileName)
745 {
746 #if defined(AJA_WINDOWS)
747  AJAStatus status = AJA_STATUS_FAIL;
748 
749  if (0 != fileName.length())
750  {
751  if (DeleteFileA(fileName.c_str()))
752  {
753  status = AJA_STATUS_SUCCESS;
754  }
755  }
756  return status;
757 #elif defined(AJA_BAREMETAL)
758  // TODO
759  return AJA_STATUS_FAIL;
760 #else
761  AJAStatus status = AJA_STATUS_FAIL;
762 
763  if (0 != fileName.length())
764  {
765  if (0 == unlink(fileName.c_str()))
766  {
767  status = AJA_STATUS_SUCCESS;
768  }
769  }
770  return status;
771 #endif
772 }
773 
774 
775 AJAStatus
776 AJAFileIO::Delete(const wstring& fileName)
777 {
778 #if defined(AJA_WINDOWS)
779  AJAStatus status = AJA_STATUS_FAIL;
780 
781  if (0 != fileName.length())
782  {
783  if (DeleteFileW(fileName.c_str()))
784  {
785  status = AJA_STATUS_SUCCESS;
786  }
787  }
788  return status;
789 #elif defined(AJA_BAREMETAL)
790  // TODO
791  return AJA_STATUS_FAIL;
792 #else
793  AJAStatus status = AJA_STATUS_FAIL;
794 
795  string aString;
796  aja::wstring_to_string(fileName,aString);
797  status = Delete(aString);
798 
799  return status;
800 #endif
801 }
802 
803 
804 AJAStatus
806  const std::string& directory,
807  const std::string& filePattern,
808  std::vector<std::string>& fileContainer)
809 {
810 #if defined(AJA_WINDOWS)
811  WIN32_FIND_DATAA fileData;
812  HANDLE hSearch;
813  string qualifiedName;
814  AJAStatus status = AJA_STATUS_FAIL;
815 
816  fileContainer.clear();
817 
818  if ((0 != directory.length()) && (0 != filePattern.length()))
819  {
820  if (TRUE == SetCurrentDirectoryA(directory.c_str()))
821  {
822  if (INVALID_HANDLE_VALUE !=
823  (hSearch = FindFirstFileA(filePattern.c_str(), &fileData)))
824  {
825  qualifiedName = directory + "/" + fileData.cFileName;
826  fileContainer.push_back(qualifiedName);
827 
828  while (FindNextFileA(hSearch, &fileData) != 0)
829  {
830  qualifiedName = directory + "/" + fileData.cFileName;
831  fileContainer.push_back(qualifiedName);
832  }
833  FindClose(hSearch);
834 
835  if (0 != fileContainer.size())
836  {
837  status = AJA_STATUS_SUCCESS;
838  }
839  }
840  }
841  }
842  return status;
843 #elif defined(AJA_BAREMETAL)
844  // TODO
845  return AJA_STATUS_FAIL;
846 #else
847  AJAStatus status = AJA_STATUS_FAIL;
848  struct dirent** ppNamelist;
849  int nEntries;
850  string fileEntry;
851  string convertedPath;
852  string upperPattern;
853  char resolvedPath[PATH_MAX];
854 
855  if ((0 != directory.length()) && (0 != filePattern.length()))
856  {
857  // Convert any Windows path chars to Linux
858  convertedPath = directory;
859  for (string::iterator it = convertedPath.begin();
860  it < convertedPath.end();
861  ++it)
862  {
863  if( *it == '\\' )
864  *it = '/';
865  }
866 
867  // Force the pattern to upper case
868  upperPattern = filePattern;
869  aja::upper(upperPattern);
870 
871  // Make sure directory path is cleaned up
872  if (!realpath(convertedPath.c_str(), resolvedPath))
873  return status; // Path is bad
874 
875  nEntries = scandir(resolvedPath, &ppNamelist, 0, alphasort);
876 
877  if (nEntries > 0)
878  {
879  for (int ndx = 0; ndx < nEntries; ndx++)
880  {
881  char* pName = ppNamelist[ndx]->d_name;
882 
883  // Make an upper case copy of the file name
884  char upperName[PATH_MAX];
885  char* pChar = pName;
886  size_t length = strlen( pName );
887  size_t i;
888  for (i = 0; i < length; i++)
889  {
890  upperName[i] = toupper( *pChar++ );
891  }
892  upperName[i] = '\0';
893 
894  if (!fnmatch(upperPattern.c_str(), upperName, FNM_PERIOD))
895  {
896  fileEntry = (directory + "/");
897  fileEntry += pName;
898 
899  fileContainer.push_back(fileEntry);
900  }
901  }
902  free(ppNamelist);
903  status = AJA_STATUS_SUCCESS;
904  }
905  }
906  return status;
907 #endif
908 }
909 
910 
911 AJAStatus
913  const std::wstring& directory,
914  const std::wstring& filePattern,
915  std::vector<std::wstring>& fileContainer)
916 {
917 #if defined(AJA_WINDOWS)
918  WIN32_FIND_DATAW fileData;
919  HANDLE hSearch;
920  wstring qualifiedName;
921  AJAStatus status = AJA_STATUS_FAIL;
922 
923  fileContainer.clear();
924 
925  if ((0 != directory.length()) && (0 != filePattern.length()))
926  {
927  if (TRUE == SetCurrentDirectoryW(directory.c_str()))
928  {
929  if (INVALID_HANDLE_VALUE !=
930  (hSearch = FindFirstFileW(filePattern.c_str(), &fileData)))
931  {
932  qualifiedName = directory + L"/" + fileData.cFileName;
933  fileContainer.push_back(qualifiedName);
934 
935  while (FindNextFileW(hSearch, &fileData) != 0)
936  {
937  qualifiedName = directory + L"/" + fileData.cFileName;
938  fileContainer.push_back(qualifiedName);
939  }
940  FindClose(hSearch);
941 
942  if (0 != fileContainer.size())
943  {
944  status = AJA_STATUS_SUCCESS;
945  }
946  }
947  }
948  }
949  return status;
950 #elif defined(AJA_BAREMETAL)
951  // TODO
952  return AJA_STATUS_FAIL;
953 #else
954  AJAStatus status = AJA_STATUS_FAIL;
955 
956  string aDir,aPat;
957  aja::wstring_to_string(directory,aDir);
958  aja::wstring_to_string(filePattern,aPat);
959  vector<string> aContainer;
960  status = ReadDirectory(aDir,aPat,aContainer);
961  for(vector<string>::iterator i = aContainer.begin(); i != aContainer.end(); ++i)
962  {
963  wstring tmp;
964  aja::string_to_wstring(*i,tmp);
965  fileContainer.push_back(tmp);
966  }
967 
968  return status;
969 #endif
970 }
971 
972 
973 AJAStatus
975  const std::string& directory,
976  const std::string& filePattern)
977 {
978 #if defined(AJA_WINDOWS)
979  WIN32_FIND_DATAA fileData;
980  HANDLE hSearch;
981  char savePath[MAX_PATH+1];
982  AJAStatus status = AJA_STATUS_FAIL;
983 
984  if ((0 != directory.length()) && (0 != filePattern.length()))
985  {
986  if( !GetCurrentDirectoryA(MAX_PATH, savePath) )
987  return (status);
988 
989  if (TRUE == SetCurrentDirectoryA(directory.c_str()))
990  {
991  if (INVALID_HANDLE_VALUE !=
992  (hSearch = FindFirstFileA(filePattern.c_str(), &fileData)))
993  {
994  FindClose(hSearch);
995 
996  status = AJA_STATUS_SUCCESS;
997  }
998 
999  SetCurrentDirectoryA(savePath);
1000  }
1001  }
1002  return status;
1003 #elif defined(AJA_BAREMETAL)
1004  // TODO
1005  return AJA_STATUS_FAIL;
1006 #else
1007  AJAStatus status = AJA_STATUS_FAIL;
1008  vector<string> fileList;
1009 
1010  if ((0 != directory.length()) && (0 != filePattern.length()))
1011  {
1012  AJAStatus readStatus = ReadDirectory( directory, filePattern, fileList );
1013  if( readStatus == AJA_STATUS_SUCCESS )
1014  {
1015  if( fileList.size() >= 2 ) // Don't count "." and ".."
1016  status = AJA_STATUS_SUCCESS;
1017  }
1018  }
1019  return status;
1020 #endif
1021 }
1022 
1023 
1024 AJAStatus
1026  const std::wstring& directory,
1027  const std::wstring& filePattern)
1028 {
1029 #if defined(AJA_WINDOWS)
1030  WIN32_FIND_DATAW fileData;
1031  HANDLE hSearch;
1032  wchar_t savePath[MAX_PATH+1];
1033  AJAStatus status = AJA_STATUS_FAIL;
1034 
1035  if ((0 != directory.length()) && (0 != filePattern.length()))
1036  {
1037  if( !GetCurrentDirectoryW(MAX_PATH, savePath) )
1038  return (status);
1039 
1040  if (TRUE == SetCurrentDirectoryW(directory.c_str()))
1041  {
1042  if (INVALID_HANDLE_VALUE !=
1043  (hSearch = FindFirstFileW(filePattern.c_str(), &fileData)))
1044  {
1045  FindClose(hSearch);
1046 
1047  status = AJA_STATUS_SUCCESS;
1048  }
1049 
1050  SetCurrentDirectoryW(savePath);
1051  }
1052  }
1053  return (status);
1054 #elif defined(AJA_BAREMETAL)
1055  // TODO
1056  return AJA_STATUS_FAIL;
1057 #else
1058  AJAStatus status = AJA_STATUS_FAIL;
1059  string aDir,aPat;
1060  aja::wstring_to_string(directory,aDir);
1061  aja::wstring_to_string(filePattern,aPat);
1062  status = DoesDirectoryContain(aDir,aPat);
1063 
1064  return status;
1065 #endif
1066 }
1067 
1068 
1069 AJAStatus
1070 AJAFileIO::DoesDirectoryExist(const std::string& directory)
1071 {
1072 #if defined(AJA_WINDOWS)
1073  return( (::GetFileAttributesA(directory.c_str()) != INVALID_FILE_ATTRIBUTES) ? AJA_STATUS_SUCCESS : AJA_STATUS_FAIL);
1074 #elif defined(AJA_BAREMETAL)
1075  // TODO
1076  return AJA_STATUS_FAIL;
1077 #else
1078  AJAStatus status = AJA_STATUS_FAIL;
1079 
1080  if (0 != directory.length())
1081  {
1082  DIR* pDir = opendir( directory.c_str() );
1083  if( pDir )
1084  {
1085  closedir( pDir );
1086  status = AJA_STATUS_SUCCESS;
1087  }
1088  }
1089  return status;
1090 #endif
1091 }
1092 
1093 
1094 AJAStatus
1095 AJAFileIO::DoesDirectoryExist(const std::wstring& directory)
1096 {
1097 #if defined(AJA_WINDOWS)
1098  return( (::GetFileAttributesW(directory.c_str()) != INVALID_FILE_ATTRIBUTES) ? AJA_STATUS_SUCCESS : AJA_STATUS_FAIL);
1099 #elif defined(AJA_BAREMETAL)
1100  // TODO
1101  return AJA_STATUS_FAIL;
1102 #else
1103  AJAStatus status = AJA_STATUS_FAIL;
1104  string aDir;
1105  aja::wstring_to_string(directory,aDir);
1106  status = DoesDirectoryExist(aDir);
1107 
1108  return status;
1109 #endif
1110 }
1111 
1112 bool
1113 AJAFileIO::DirectoryExists(const std::string& directory)
1114 {
1115  return DoesDirectoryExist(directory) == AJA_STATUS_SUCCESS;
1116 }
1117 
1118 bool
1119 AJAFileIO::DirectoryExists(const std::wstring& directory)
1120 {
1121  return DoesDirectoryExist(directory) == AJA_STATUS_SUCCESS;
1122 }
1123 
1124 
1125 AJAStatus
1126 AJAFileIO::IsDirectoryEmpty(const std::string& directory)
1127 {
1128 #if defined(AJA_WINDOWS)
1129  AJAStatus status = AJA_STATUS_FAIL;
1130  if (DoesDirectoryContain(directory, "*") != AJA_STATUS_SUCCESS)
1131  status = AJA_STATUS_SUCCESS;
1132  return status;
1133 #elif defined(AJA_BAREMETAL)
1134  // TODO
1135  return AJA_STATUS_FAIL;
1136 #else
1137  AJAStatus status = AJA_STATUS_FAIL;
1138  if (DoesDirectoryContain(directory, "*") != AJA_STATUS_SUCCESS)
1139  status = AJA_STATUS_SUCCESS;
1140  return status;
1141 #endif
1142 }
1143 
1144 
1145 AJAStatus
1146 AJAFileIO::IsDirectoryEmpty(const std::wstring& directory)
1147 {
1148 #if defined(AJA_WINDOWS)
1149  AJAStatus status = AJA_STATUS_FAIL;
1150  if (DoesDirectoryContain(directory, L"*") != AJA_STATUS_SUCCESS)
1151  status = AJA_STATUS_SUCCESS;
1152  return status;
1153 #elif defined(AJA_BAREMETAL)
1154  // TODO
1155  return AJA_STATUS_FAIL;
1156 #else
1157  AJAStatus status = AJA_STATUS_FAIL;
1158  if (DoesDirectoryContain(directory, L"*") != AJA_STATUS_SUCCESS)
1159  status = AJA_STATUS_SUCCESS;
1160  return status;
1161 #endif
1162 }
1163 
1164 
1165 AJAStatus
1166 AJAFileIO::TempDirectory(std::string& directory)
1167 {
1168 #if defined(AJA_WINDOWS)
1169  AJAStatus status = AJA_STATUS_FAIL;
1170  directory = "";
1171  vector<char> temp;
1172  temp.resize(MAX_PATH);
1173  if (GetTempPathA(MAX_PATH, &temp[0]))
1174  {
1175  if (AJAFileIO::FileExists(&temp[0]))
1176  {
1177  directory = &temp[0];
1178  status = AJA_STATUS_SUCCESS;
1179  }
1180  else
1181  {
1182  status = AJA_STATUS_NOT_FOUND;
1183  }
1184  }
1185  return status;
1186 #elif defined(AJA_BAREMETAL)
1187  // TODO
1188  return AJA_STATUS_FAIL;
1189 #else
1190  AJAStatus status = AJA_STATUS_FAIL;
1191  directory = "";
1192  vector<string> environ_vars;
1193  environ_vars.push_back("TMPDIR");
1194  environ_vars.push_back("TMP");
1195  environ_vars.push_back("TEMP");
1196  environ_vars.push_back("TEMPDIR");
1197  vector<string>::iterator it;
1198  string temp;
1199  for(it=environ_vars.begin() ; it != environ_vars.end() ; ++it)
1200  {
1201  temp = GetEnvVar(*it);
1202  if (!temp.empty() && AJAFileIO::FileExists(temp))
1203  {
1204  directory = temp;
1205  status = AJA_STATUS_SUCCESS;
1206  break;
1207  }
1208  }
1209 
1210  // last ditch effort
1211  if (status != AJA_STATUS_SUCCESS)
1212  {
1213  temp = "/tmp";
1214  if (AJAFileIO::FileExists(temp))
1215  {
1216  directory = temp;
1217  status = AJA_STATUS_SUCCESS;
1218  }
1219  else
1220  {
1221  status = AJA_STATUS_NOT_FOUND;
1222  }
1223  }
1224  return status;
1225 #endif
1226 }
1227 
1228 
1229 AJAStatus
1230 AJAFileIO::TempDirectory(std::wstring& directory)
1231 {
1232 #if defined(AJA_WINDOWS)
1233  AJAStatus status = AJA_STATUS_FAIL;
1234  directory = L"";
1235  vector<wchar_t> temp;
1236  temp.resize(MAX_PATH);
1237  if (GetTempPathW(MAX_PATH, &temp[0]))
1238  {
1239  if (AJAFileIO::FileExists(&temp[0]))
1240  {
1241  directory = &temp[0];
1242  status = AJA_STATUS_SUCCESS;
1243  }
1244  else
1245  {
1246  status = AJA_STATUS_NOT_FOUND;
1247  }
1248  }
1249  return status;
1250 #elif defined(AJA_BAREMETAL)
1251  // TODO
1252  return AJA_STATUS_FAIL;
1253 #else
1254  string temp;
1255  AJAStatus status = AJAFileIO::TempDirectory(temp);
1256  if (status == AJA_STATUS_SUCCESS)
1257  {
1258  aja::string_to_wstring(temp, directory);
1259  }
1260  else
1261  {
1262  directory = L"";
1263  }
1264  return status;
1265 #endif
1266 }
1267 
1268 AJAStatus
1270 {
1271  char buf[AJA_MAX_PATH+1] = "";
1272 
1273 #if defined(AJA_WINDOWS)
1274  _getcwd(buf, AJA_MAX_PATH);
1275 #elif defined(AJA_BAREMETAL)
1276  // TODO
1277  return AJA_STATUS_FAIL;
1278 #else
1279  char* result = getcwd(buf, AJA_MAX_PATH);
1280  AJA_UNUSED(result);
1281 #endif
1282 
1283  cwd = std::string(buf);
1284  return AJA_STATUS_SUCCESS;
1285 }
1286 
1287 AJAStatus
1288 AJAFileIO::GetWorkingDirectory(std::wstring& directory)
1289 {
1290  bool ok = false;
1291  std::string buf;
1293  ok = aja::string_to_wstring(buf, directory);
1294  else
1295  directory = L"";
1296 
1297  return ok ? AJA_STATUS_SUCCESS : AJA_STATUS_FAIL;
1298 }
1299 
1300 AJAStatus
1301 AJAFileIO::GetDirectoryName(const std::string& path, std::string& directory)
1302 {
1303  const size_t lastSlashIndex = path.rfind(AJA_PATHSEP);
1304 
1305  directory = "";
1306 
1307  if (std::string::npos != lastSlashIndex) {
1308  directory = path.substr(0, lastSlashIndex);
1309  return AJA_STATUS_SUCCESS;
1310  }
1311 
1312  return AJA_STATUS_NOT_FOUND;
1313 }
1314 
1315 AJAStatus
1316 AJAFileIO::GetDirectoryName(const std::wstring& path, std::wstring& directory)
1317 {
1318  const size_t lastSlashIndex = path.rfind(AJA_PATHSEP_WIDE);
1319 
1320  directory = L"";
1321 
1322  if (std::wstring::npos != lastSlashIndex) {
1323  directory = path.substr(0, lastSlashIndex);
1324  return AJA_STATUS_SUCCESS;
1325  }
1326 
1327  return AJA_STATUS_NOT_FOUND;
1328 }
1329 
1330 AJAStatus
1331 AJAFileIO::GetFileName(const std::string& path, std::string& filename)
1332 {
1333  const size_t lastSlashIndex = path.rfind(AJA_PATHSEP);
1334 
1335  filename = "";
1336 
1337  if (std::string::npos != lastSlashIndex) {
1338  filename = path.substr(lastSlashIndex + 1, path.length() - lastSlashIndex);
1339  return AJA_STATUS_SUCCESS;
1340  }
1341 
1342  return AJA_STATUS_NOT_FOUND;
1343 }
1344 
1345 AJAStatus
1346 AJAFileIO::GetFileName(const std::wstring& path, std::wstring& filename)
1347 {
1348  const size_t lastSlashIndex = path.rfind(AJA_PATHSEP_WIDE);
1349 
1350  filename = L"";
1351 
1352  if (std::wstring::npos != lastSlashIndex) {
1353  filename = path.substr(lastSlashIndex + 1, path.length() - lastSlashIndex);
1354  return AJA_STATUS_SUCCESS;
1355  }
1356 
1357  return AJA_STATUS_NOT_FOUND;
1358 }
1359 
1360 AJAStatus
1362 {
1363 #if defined(AJA_BAREMETAL)
1364  // TODO
1365  return AJA_STATUS_FAIL;
1366 #else
1367  char buf[AJA_MAX_PATH];
1368  memset((void*)buf, 0, AJA_MAX_PATH);
1369  size_t bufSize = 0;
1370 #if defined(AJA_WINDOWS)
1371  bufSize = ::GetModuleFileNameA(NULL, &buf[0], AJA_MAX_PATH);
1372 #elif defined(AJA_LINUX)
1373  bufSize = readlink("/proc/self/exe", &buf[0], AJA_MAX_PATH);
1374 #elif defined(AJA_MAC)
1375  uint32_t pathLen = 0;
1376  char exe_path[AJA_MAX_PATH];
1377  _NSGetExecutablePath(NULL, &pathLen);
1378  if (_NSGetExecutablePath(&exe_path[0], &pathLen) == 0 && realpath(exe_path, buf)) {
1379  bufSize = (size_t)pathLen;
1380  }
1381 #endif
1382  if (bufSize > 0)
1383  path = std::string(buf, strlen(buf));
1384  else
1385  return AJA_STATUS_NOT_FOUND;
1386 
1387  return AJA_STATUS_SUCCESS;
1388 #endif
1389 }
1390 
1391 AJAStatus
1392 AJAFileIO::GetExecutablePath(std::wstring& path)
1393 {
1394 #if defined(AJA_WINDOWS)
1395  wchar_t buf[AJA_MAX_PATH];
1396  size_t bufSize = ::GetModuleFileNameW(NULL, &buf[0], AJA_MAX_PATH);
1397  if (bufSize > 0) {
1398  path = std::wstring(buf, wcslen(buf));
1399  return AJA_STATUS_SUCCESS;
1400  }
1401 #elif defined(AJA_BAREMETAL)
1402  // TODO
1403  return AJA_STATUS_FAIL;
1404 #else
1405  std::string pathStr;
1407  return aja::string_to_wstring(pathStr, path)
1409  }
1410 #endif
1411  return AJA_STATUS_NOT_FOUND;
1412 }
1413 
1414 void
1416 {
1417 #if defined(AJA_WINDOWS)
1418  mFileDescriptor = (HANDLE)_get_osfhandle(fileno(fp));
1419 #elif defined(AJA_BAREMETAL)
1420  // TODO
1421 #else
1422  mpFile = fp;
1423 #endif
1424 }
MAX_PATH
#define MAX_PATH
Definition: ajatypes.h:327
AJAFileIO::IsOpen
bool IsOpen()
Definition: file_io.cpp:317
AJAFileIO::Write
uint32_t Write(const uint8_t *pBuffer, const uint32_t length) const
Definition: file_io.cpp:380
HANDLE
short HANDLE
Definition: ajatypes.h:315
AJAFileIO::DirectoryExists
static bool DirectoryExists(const std::string &directory)
Definition: file_io.cpp:1113
eAJASeekEnd
@ eAJASeekEnd
Definition: file_io.h:49
eAJAIoDefault
@ eAJAIoDefault
Definition: file_io.h:55
AJAFileIO::GetFileName
static AJAStatus GetFileName(const std::string &path, std::string &filename)
Definition: file_io.cpp:1331
AJAFileIO::~AJAFileIO
~AJAFileIO()
Definition: file_io.cpp:90
types.h
Declares common types used in the ajabase library.
AJA_PATHSEP_WIDE
const wchar_t AJA_PATHSEP_WIDE
Definition: file_io.h:22
NULL
#define NULL
Definition: ntv2caption608types.h:19
eAJAWriteOnly
@ eAJAWriteOnly
Definition: file_io.h:32
eAJACreateAlways
@ eAJACreateAlways
Definition: file_io.h:27
AJA_PATHSEP
const char AJA_PATHSEP
Definition: file_io.h:21
AJA_STATUS_SUCCESS
@ AJA_STATUS_SUCCESS
Definition: types.h:381
AJA_STATUS_NOT_FOUND
@ AJA_STATUS_NOT_FOUND
Definition: types.h:402
aja::wstring_to_string
bool wstring_to_string(const std::wstring &wstr, std::string &str)
Definition: common.cpp:285
AJAFileIO::DoesDirectoryContain
static AJAStatus DoesDirectoryContain(const std::string &directory, const std::string &filePattern)
Definition: file_io.cpp:974
eAJAReadOnly
@ eAJAReadOnly
Definition: file_io.h:31
AJA_UNUSED
#define AJA_UNUSED(_x_)
Definition: types.h:424
eAJATruncateExisting
@ eAJATruncateExisting
Definition: file_io.h:29
AJAFileIO::Delete
static AJAStatus Delete(const std::string &fileName)
AJAFileIO::Open
AJAStatus Open(const std::string &fileName, const int flags, const int properties)
Definition: file_io.cpp:201
eAJANoCaching
@ eAJANoCaching
Definition: file_io.h:41
AJAFileIO::DoesDirectoryExist
static AJAStatus DoesDirectoryExist(const std::string &directory)
Definition: file_io.cpp:1070
eAJAIoAlternate
@ eAJAIoAlternate
Definition: file_io.h:56
AJAFileSetFlag
AJAFileSetFlag
Definition: file_io.h:45
AJAStatus
AJAStatus
Definition: types.h:378
AJAFileIO::Truncate
AJAStatus Truncate(int32_t offset)
Definition: file_io.cpp:459
AJAFileIO::GetExecutablePath
static AJAStatus GetExecutablePath(std::string &path)
Definition: file_io.cpp:1361
AJA_STATUS_FAIL
@ AJA_STATUS_FAIL
Definition: types.h:382
AJAFileIO::Seek
AJAStatus Seek(const int64_t distance, const AJAFileSetFlag flag) const
Definition: file_io.cpp:545
aja::upper
std::string & upper(std::string &str)
Definition: common.cpp:442
eAJAUnbuffered
@ eAJAUnbuffered
Definition: file_io.h:40
aja::string_to_wstring
bool string_to_wstring(const std::string &str, std::wstring &wstr)
Definition: common.cpp:248
GetEnvVar
static string GetEnvVar(string const &key)
Definition: file_io.cpp:65
AJAFileIO::IsDirectoryEmpty
static AJAStatus IsDirectoryEmpty(const std::string &directory)
Definition: file_io.cpp:1126
eAJASeekCurrent
@ eAJASeekCurrent
Definition: file_io.h:48
AJAFileIO::GetDirectoryName
static AJAStatus GetDirectoryName(const std::string &path, std::string &directory)
Definition: file_io.cpp:1301
AJAFileIO::TempDirectory
static AJAStatus TempDirectory(std::string &directory)
Definition: file_io.cpp:1166
AJAFileIO::Sync
AJAStatus Sync()
Definition: file_io.cpp:430
AJAFileIO::Read
uint32_t Read(uint8_t *pBuffer, const uint32_t length)
Definition: file_io.cpp:328
file_io.h
Declares the AJAFileIO class.
AJAFileIO::GetWorkingDirectory
static AJAStatus GetWorkingDirectory(std::string &directory)
Definition: file_io.cpp:1269
common.h
Private include file for all ajabase sources.
AJAFileIO::FileExists
static bool FileExists(const std::wstring &fileName)
Definition: file_io.cpp:97
AJA_STATUS_BAD_PARAM
@ AJA_STATUS_BAD_PARAM
Definition: types.h:392
AJAFileIO::Close
AJAStatus Close()
Definition: file_io.cpp:281
AJAFileIO::Tell
int64_t Tell()
Definition: file_io.cpp:503
eAJASeekSet
@ eAJASeekSet
Definition: file_io.h:47
eAJACreateNew
@ eAJACreateNew
Definition: file_io.h:28
aja::to_string
std::string to_string(bool val)
Definition: common.cpp:180
AJAFileIO::ReadDirectory
static AJAStatus ReadDirectory(const std::string &directory, const std::string &filePattern, std::vector< std::string > &fileContainer)
Definition: file_io.cpp:805
AJAFileIO::FileInfo
AJAStatus FileInfo(int64_t &createTime, int64_t &modTime, int64_t &size)
Definition: file_io.cpp:627
INVALID_HANDLE_VALUE
#define INVALID_HANDLE_VALUE
Definition: ajatypes.h:329
eAJAReadWrite
@ eAJAReadWrite
Definition: file_io.h:33
AJAFileIO::SetHandle
void SetHandle(FILE *fp)
Definition: file_io.cpp:1415
AJAFileIO::AJAFileIO
AJAFileIO()
Definition: file_io.cpp:73