root/ossiedev/branches/jsnyder/trunk/system/ossie/include/ossie/FileSystem_impl.h @ 11064

Revision 11064, 3.9 KB (checked in by Snyder.Jason, 2 years ago)

committing patches from opencpi

  • Property svn:eol-style set to native
Line 
1/****************************************************************************
2
3Copyright 2004, 2007, Virginia Polytechnic Institute and State University
4
5This file is part of the OSSIE Core Framework.
6
7OSSIE Core Framework is free software; you can redistribute it and/or modify
8it under the terms of the Lesser GNU General Public License as published by
9the Free Software Foundation; either version 2.1 of the License, or
10(at your option) any later version.
11
12OSSIE Core Framework is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15Lesser GNU General Public License for more details.
16
17You should have received a copy of the Lesser GNU General Public License
18along with OSSIE Core Framework; if not, write to the Free Software
19Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21****************************************************************************/
22
23/* SCA */
24#ifndef __FILESYSTEM_IMPL__
25#define __FILESYSTEM_IMPL__
26
27#include "ossie/cf.h"
28#include "ossie/ossieSupport.h"
29#ifdef USE_OPENCPI_FS
30
31#include "OcpiCFUtilVfsFileSystem.h"
32
33class FileSystem_impl : OCPI::CFUtil::VfsFileSystem, virtual public POA_CF::FileSystem {
34 public:
35  // The standalone constructor to create a file system based on a URL
36  FileSystem_impl(const char *url);
37  FileSystem_impl();
38  ~FileSystem_impl();
39  static bool isValidPath(const char *path);
40  static void joinPath(const char *base, const char *rel, std::string &result);
41};
42#else
43
44#include <vector>
45#include <string>
46
47#include <boost/filesystem/path.hpp>
48
49#include "ossie/ossiecf.h"
50#include "ossie/File_impl.h"
51#include "ossie/ossieSupport.h"
52
53class OSSIECF_API FileSystem_impl:public virtual POA_CF::FileSystem
54
55{
56public:
57    FileSystem_impl ();
58    FileSystem_impl (const char *_root);
59    ~ FileSystem_impl ();
60
61    static bool isValidPath(const char *path);
62
63    static void joinPath(const char *base, const char *rel, std::string &result);
64
65    void remove (const char *fileName)
66    throw (CF::InvalidFileName, CF::FileException, CORBA::SystemException);
67
68    void copy (const char *sourceFileName, const char *destinationFileName)
69    throw (CF::FileException, CF::InvalidFileName, CORBA::SystemException);
70
71    void mkdir (const char *directoryName)
72    throw (CF::InvalidFileName, CF::FileException, CORBA::SystemException);
73
74    void rmdir (const char *directoryName)
75    throw (CF::InvalidFileName, CF::FileException, CORBA::SystemException);
76
77    void query (CF::Properties & fileSysProperties)
78    throw (CF::FileSystem::UnknownFileSystemProperties, CORBA::SystemException);
79    CORBA::Boolean exists (const char *fileName)
80    throw (CF::InvalidFileName, CORBA::SystemException);
81
82    CF::File_ptr create (const char *fileName)
83    throw (CF::FileException, CF::InvalidFileName, CORBA::SystemException);
84
85    CF::File_ptr open (const char *fileName, CORBA::Boolean read_Only)
86    throw (CF::FileException, CF::InvalidFileName, CORBA::SystemException);
87
88    CF::FileSystem::FileInformationSequence *list (const char *pattern)
89    throw (CF::InvalidFileName, CF::FileException, CORBA::SystemException);
90
91private:
92    FileSystem_impl (const FileSystem_impl & _fsi);
93    FileSystem_impl operator= (FileSystem_impl _fsi);
94
95    void init ();
96    void removeDirectory(const boost::filesystem::path &dirPath, bool doRemove);
97    void recursiveList(const boost::filesystem::path& dirPath, const char* pattern, CF::FileSystem::FileInformationSequence_var& fis);
98
99    boost::filesystem::path root;
100
101    ossieSupport::ORB *orb;
102
103    class fileInfo
104    {
105    public:
106        std::string fileName;
107        CF::File_var servant;
108    };
109    std::vector<fileInfo> files;
110
111};                                                /* END CLASS DEFINITION FileSystem */
112#endif                                            /* end of else of ifdef USE_OPENCPI_FS */
113#endif                                            /* __FILESYSTEM__ */
Note: See TracBrowser for help on using the browser.