-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlogFileSystemOld.html
More file actions
191 lines (167 loc) · 8.88 KB
/
BlogFileSystemOld.html
File metadata and controls
191 lines (167 loc) · 8.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!DOCTYPE html>
<html>
<head>
<!--
- BlogFileSystem.htm - Code Artist Thoughts
- ver 1.2 - 15 August 2013
- Jim Fawcett, Syracuse University
-->
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta name="description" content="Software Engineering course notes. Code Samples. Software Links" />
<meta name="keywords" content="Lecture, Notes, Code, Syracuse,University" />
<meta name="Author" content="Jim Fawcett" />
<meta name="Author" content="James Fawcett" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Blog.FileSystem</title>
<script src="js/ScriptsUtilities.js"></script>
<script src="js/ScriptsTemplate.js"></script>
<script src="js/ScriptsKeyboard.js"></script>
<script src="js/ScriptsMenu.js"></script>
<link rel="stylesheet" href="css/StylesTemplate.css" />
<link rel="stylesheet" href="css/StylesDefault.css" />
<link rel="stylesheet" href="css/StylesMenu.css" />
<link rel="stylesheet" href="css/StylesBrownTheme.css" />
<style>
#github header {
margin-left: 0px;
margin-right: 0px;
}
#github #pagetitle {
background-color: #e3dac9;
color: #800020;
border: 1px solid maroon;
}
#github #title {
background-color: #e3dac9;
color: #3f000f;
}
</style>
</head>
<body id="github" onload="initializeMenu()">
<navKeys-Container>
<nav-Key id="sKey" onclick="toggleSwipeEvents()">S</nav-Key>
<nav-Key id="rKey" onclick="location.reload()">R</nav-Key>
<nav-Key id="tKey" onclick="scrollPageTop()">T</nav-Key>
<nav-Key id="bKey" onclick="scrollPageBottom()">B</nav-Key>
<nav-Key id="hKey" onclick="helpWin()">H</nav-Key>
<nav-Key id="pKey" onclick="loadPrev()">P</nav-Key>
<nav-Key id="nKey" onclick="loadNext()">N</nav-Key>
</navKeys-Container>
<nav>
<div id="navbar"></div>
</nav>
<a id="Next" href="Blog.html">N</a>
<a id="Prev" href="BlogGraph.html">P</a>
<header>
<hgroup id="pagetitle">
<h1 id="title">Code Artistry - C++ File System Library</h1>
</hgroup>
</header>
<!-- page content -->
<h3>Initial Thoughts:</h3>
<t-b>
C++11 has a lot of useful features, many <a href="http://herbsutter.com/elements-of-modern-c-style/">new to the latest 2011 standard</a>, e.g.,
range-based for loop, uniform initialization, type inference with auto, new smart pointers, lambda functions, move constructors and assignments, etc.
One of the things that was discussed but not adopted was the addition of file and directory management facilities in the standard C++ library.
</t-b>
<t-b>
Projects for CSE687 - Object Oriented Design and CSE775 - Distributed Objects often require us to find, using C++ code, files on specific directory paths
that match a specified pattern. So not having file and directory management libraries means we get to write a lot of low-level code using
platform specific APIs or interoperate with code developed in languages that do provide that library support, like C#.
While that is not that difficult to do, it would be very convenient to have native C++ libraries that provide such support.
</t-b>
<h3>Background:</h3>
<t-b>
CSE775 - Distributed Objects is concerned with system programming for both Windows and Linux platforms. The first assigned project requires
development of components using the Microsoft Component Object Model (COM) on Windows and components on Linux that use the same model,
e.g., code accessed through interfaces and object factories and that uses reference counting management of object life-time.
</t-b>
<t-b>
For the second major project each student selects from a list of <a href="../CSE775/lectures/CSE775Projects.htm">suggestions</a>. Most of these projects
explore some interesting platfrom that will require student research to learn a new, for them, technology. They then propose development of
an application, they will develop, that illustrates how the technology works and will be technically interesting for the rest of the class.
Many of these projects
are expected to create applications that run on both Windows and Linux or that have components that interoperate across these platforms.
</t-b>
<h3>Core Idea:</h3>
<t-b>
In order to support cross-platform development we have been working on libraries that provide access to system artifacts: files, directories,
threads and locks<sup>1</sup>, process management, and socket-based communication. The idea is for the libraries to host the same interfaces on
both platforms while using the underlying platform APIs<sup>2</sup>. That way we can build applications out of code common to both platforms
that use these Windows or Linux libraries without change.
</t-b>
<t-b>Building common Graphical User Interfaces (GUI)s provide an interesting challenge which we will discuss in a future Blog page.</t-b>
<div style="width:calc(100vw - 9rem);">
<div class="right clear photo" style="margin: 10px; padding: 10px;">
<img name="filesys" width="600" onmouseover="filesys.width='900'" onmouseout="filesys.width='600'" src="Pictures/Blog.FileSystem.png" />
<div class="center">Figure 1 - File System Classes</div>
</div>
</div>
<h3>Design:</h3>
<t-b>
Here, we focus on our FileSystem library that supports operations on the file systems of either Windows or Linux
through the same set of interfaces.
</t-b>
<t-b>
The FileSystem library contains four main classes: Directory, Path, FileInfo, and File, with another public helper class Block and
private helper class FileSystemSearch.
The main classes are modeled after similar classes in the .Net System.IO namespace.
</t-b>
<t-b>
Directory is composed of static member functions for manipulating directories and files. For example, Directory::getFiles(...) returns a std::vector<string>
containing the names of files on a specified path that match a specified pattern.
</t-b>
<t-b>
Path supports parsing fully qualified file specifications into path, file name, and extension and composing those parts into a file specification.
Its function getFullFileSpec(...) supports converting a relative path into an absolute path.
</t-b>
<t-b>
The FileInfo class provides facilities for retrieving directory properties about a directory entry, like date of last modification, size, and whether
it is a file or directory. The class also supports comparing properties of two specified files.
</t-b>
<t-b>The File class supports opening, reading lines or blocks of bytes, writing lines or blocks of bytes, and testing FileStream state.</t-b>
<t-b>
Finally, the Block class wraps an array of bytes for read and write operations on instances of the File class. Blocks are most useful for file transfers with
chunking - breaking a file into pieces for transmission over a socket-based channel.
</t-b>
<div style="width:calc(100vw - 9rem);">
<div class="right clear photo" style="margin: 10px; padding: 10px;">
<img name="filesysOut" width="600" onmouseover="filesysOut.width='900'" onmouseout="filesysOut.width='600'" src="Pictures/Blog.FileSystemOutput.png" />
<div class="center">Figure 2 - File System Output</div>
</div>
</div>
<h3>Typical Output:</h3>
<t-b>Demo output is presented in Figure 2, which shows construction test output for some of the main classes.</t-b>
<h3>Source Code:</h3>
<t-b>
This FileSystem library is written in C++ using Visual Studio 2013 and compiles and runs using Visual Studio 2013 as well.
You will find the code here:
<div class="indent" style="margin: 10px;">
<a href="../CoreTechnologies/Cpp/code/FileSystem-Windows">FileSystem- Windows library</a>
</div>
</t-b>
<t-b>This code bears a copyright © that grants all rights to users except the right to publish and requires retention of the copyright notice.</t-b>
<h3>Conclusions:</h3>
<t-b>
The C++ FileSystem library has proven to be almost as easy to use as its .Net counterpart System.IO. The library has been used by several classes
to support their project work and found to be sufficient for most project needs.
</t-b>
<div class="footnote">
<hr />
<ol>
<li>
C++ now supports, under the C++11 standard, threads, locks, and atomics as part of the standard C++ library. Thus we no longer need to
maintain the thread and locks classes we've used before the new standard was implemented for the compilers we use, e.g., Visual Studio
and GCC.
</li>
<li>
That is, of course, exactly what the C++ standard library does. We are simply augmenting the standard library using the same approach.
</li>
</ol>
</div>
<t-b>
<div style="width:calc(100vw - 9rem);"><img class="photo" src="Pictures/QuadStrip.jpg" alt="Newhouse" style="width:100%;" /></div>
</t-b>
<info-bar></info-bar>
</body>
</html>