STLSoft
From Wikipedia, the free encyclopedia
This article or section is in the middle of an expansion or major revamping. You are welcome to assist in its construction by editing it as well. Please view the edit history should you wish to contact the person who placed this template. If this article has not been edited in several days please remove this template. Consider not tagging with a deletion tag unless the page hasn't been edited in several days. |
STLSoft Libraries | |
---|---|
Latest release | 1.9.44 / 1 June 2008 |
Written in | C/C++ |
OS | MS-Windows, Unix, partially Cross-platform |
Genre | STL extension, Facades |
License | BSD-form license |
Website | http://stlsoft.org/ |
STLSoft is a collection of open source C++ template libraries that extend the functionality of the Standard Template Library and provide facades that wrap operating-system and technology-specific APIs. STLSoft is licensed under a BSD-form license to allow it to be used with both open and closed source projects.
STLSoft can be characterized as being lightweight and having high portability, high performance, minimal coupling and high cohesion.[1]
STLSoft is not a framework. STLSoft components are meant to be used as building blocks for higher level components such as applications, classes, libraries and servers.
The libraries cover operating systems such as Microsoft Windows, Mac OS-X and Linux/Unix, several of which both in 32-bit and 64-bit versions and work with compilers such as Borland C++, CodePlay VectorC C/C++, Comeau C/C++, Digital Mars C/C++, GNU C, Intel C/C++, Metrowerks C/C++, SunPro C/C++, Visual C++ and Watcom C/C++.
Contents |
[edit] History
Over the last half a decade or so,[2][3] Matthew Wilson has been developing the STLSoft open source C++ template libraries to support the creation of both free and commercial software. Many parts of the libraries are derived from proprietary Synesis Software code.[4] In 2008 Wilson still is the main author of the STLSoft libraries.[5]
[edit] Implementation
STLSoft is written in C++, but it also contains parts that can be used with C. The libraries use templates and rely on compile-time polymorphism. The STLSoft libraries are header-only: the library code is included in and compiled with the user's code. This makes installation and usage of the libraries relatively easy.
[edit] Projects and Libraries
STLSoft is organized in two ways:
- as projects, for example: COMSTL, PlatformSTL, UnixSTL and WinSTL
- as libraries, for example: File System Library, Performance Library, Synchronisation[6] Library
There are 12 projects and 25 libraries.
The main project is also called STLSoft and it contains most platform- and technology-independent code and code that helps to take care of compiler and standard library differences.
The biggest projects are COMSTL, UnixSTL and WinSTL. COMSTL provides utilities to work with the Component Object Model (COM) and provides STL-compatible sequence adapters over the COM enumeration and COM collection concepts. UNIXSTL and WinSTL provide operating-system and technology-specific components for Unix and Windows operating systems. These two projects have a number of structural conformant components, such as environment_variable
, path
and thread_mutex
that are also placed in the PlatformSTL project that facilitates writing platform-agnostic code (see also subsection Techniques).
The other projects address additional technology-specific areas. ACESTL applies STL concepts to some components of the Adaptive Communication Environment (ACE) library. MFCSTL makes using the Microsoft Foundation Classes (MFC) more STL-like. RangeLib is the STLSoft implementation of the range concept. InetSTL, ATLSTL and WTLSTL are smaller projects that apply the STL concepts to Internet programming and to programming with the Active Template Library (ATL) and Windows Template Library (WTL).
[edit] Techniques
Many ideas and techniques that STLSoft uses are described in Imperfect C++[7] and in Extended STL, Volume 1.[8] One such technique is namespace aliasing. It is used to reduce the extent to which namespaces must be specified in the library code itself.[9][10] Other notable techniques are shims and type tunneling which are used to reduce coupling between and to increase cohesion within the library's coponents.[11][12]
With cross-platform libraries, common approaches to provide identical behavior across different platforms or technology areas are 1) to emulate functionality missing from some platforms and 2) to provide only functionality common to all platforms. STLSoft approaches cross-platform support as follows: where similar behavior across platforms is available, structural conformance is employed in its implementation, but where functionality is different structural conformance is avoided. Wilson names this the principle of intersecting conformance. Thus STLSoft provides a common interface for functionality that is available across platforms or technology areas and at the same time does not limit the functionality when programming for the native system only.[13][14]
(Note: address high performance here.)
[edit] Library contents
Projects:
- ACESTL
- ATLSTL
- COMSTL
- .netSTL
- InetSTL
- MFCSTL
- PlatformSTL
- RangeLib
- STLSoft
- UNIXSTL
- WinSTL
- WTLSTL
Libraries:
- Collections Library
- Containers Library
- Conversion Library
- DL Library
- Error Library
- File System Library
- Functional Library
- Iterators Library
- Memory Library
- Template Meta-programming Library
- Performance Library
- Properties Library
- Security Library
- Smart Pointers library
- String Library
- Synchronisation Library
- System Library
- Time Library
- Utility Library
- Windows Clipboard Library
- Windows Control Panel Library
- Windows Controls Library
- Windows Registry Library
- Windows Shell Library
- Windows ToolHelp Library
[edit] Examples
The following example is adapted from [15]. The program reads and displays the directories present in the root directory whether the program is compiled on Unix or compiled on Windows. It uses the class readdir_sequence
from STLSoft's cross-platform project PlatformSTL that adapts the Unix opendir/readdir
API and the FindFirstFile/FindNextFile
MS-Windows API to an iteratable sequence.
#include <platformstl/filesystem/readdir_sequence.hpp> #include <algorithm> // std::copy #include <iterator> // std::ostream_iterator #include <iostream> // std::cout, std::endl #include <string> // std::string using platformstl::readdir_sequence; int main() { readdir_sequence dir( "/", readdir_sequence::directories ); std::copy ( dir.begin() , dir.end() , std::ostream_iterator< std::string >( std::cout, "\n" ) ); }
Using the GNU C compiler, the executable program can be build as follows with both Unix and MS-Windows:
g++ -Wall -I../stlsoft-1.9.42/include program.cpp -o program
Here it is assumed that the STLSoft library (release 1.9.42) is installed in a sibling directory of the directory that contains the program.
[edit] Criticisms
The documentation accompanying the STLSoft libraries consists of Doxygen generated reference documentation that includes a partially completed overview of the library contents and of the concepts, patterns, principles and techniques that it uses. In addition to this, the documentation contains circa twenty example programs that show how to use various components of the library, but that do not contain an explanation of the component's usage.[16] There is no user documentation with a tutorial or a thematic approach (Getting Started guide). The necessity to improve the documentation is recognized though.[17]
[edit] Platforms supported
Architecture--OS--Compiler / 32-bit, 64-bit / Unix, Linux, FreeBSD, Mac OS-X, Sun Solaris?, MS-Windows.
The compilers supported by the STLSoft libraries are:[18]
- Borland C++ 5.5, 5.51, 5.6, 5.6.4 & 5.82
- CodePlay VectorC C/C++ 1
- Comeau 4.3.0.1 & 4.3.3
- Digital Mars C/C++ 8.26 and above
- GCC 2.95, 2.96, 3.2, 3.3, 3.4 & 4.0
- Intel C/C++ 6.0, 7.0, 7.1, 8.0, 9.0, 10.0
- Metrowerks 2.4, 3.0 & 3.2 (CodeWarrior 7.0, 8.0 & 9.0)
- SunPro C/C++ 5.9
- Visual C++ 4.2, 5.0, 6.0, 7.0 (.NET), 7.1 (.NET 2003), 8.0 & 9.0
- Watcom C/C++ 11.0, Open Watcom 1.0, 1.1, 1.2, 1.3, 1.4, 1.5
[edit] Projects that use STLSoft
- b64 Base-64 conversion
- FastFormat (Coming May '08)
- flecxx abstraction harmonizer library
- Open-RJ Record-Jar API
- Pantheios C++ logging API
- recls recursive file-system search
- shwild shell-compatible wildcards
- VOLE C++ COM/Automation driver
- xContract (Coming May '08)
- xTests Unit testing framework
[edit] See also
- STL - Standard Template Library
[edit] Notes
- ^ STLSoft Documentation.
- ^ Wilson 2007, p.xxxiv
- ^ This indicates that STLSoft started around the year 2002. HISTORY.txt and other files in the root directory of the STLSoft distribution contain the comment: Created: 29th March 2002, whereas the file stlsoft/stlsoft.h contains: Created: 15th January 2002.
- ^ Wilson 2005, p.565.
- ^ STLSoft Website.
- ^ British English spelling is used as in synchronisation, tokeniser and initialiser.
- ^ Wilson 2005.
- ^ Wilson 2007.
- ^ Wilson 2007, p.xxxv.
- ^ C/C++ User's Journal 2003a.
- ^ C/C++ User's Journal 2003b.
- ^ STLSoft Documentation.
- ^ Wilson 2007.
- ^ STLSoft Documentation.
- ^ The C++ Source 2004, Listing 2.
- ^ STLSoft Documentation.
- ^ STLSoft newsgroup.
- ^ File STLSoft.h.
[edit] References
- Wilson, Matthew (July 2003), “Open-source Flexibility via Namespace Aliasing”, C/C++ User's Journal 21 (7), <http://www.ddj.com/cpp/184401677>
- Wilson, Matthew (August 2003), “Generalised String Manipulation: Access Shims and Type-tunnelling”, C/C++ User's Journal 21 (8), <http://www.cuj.com/documents/s=8681/cuj0308wilson/>
- Wilson, Matthew (June 21, 2004), “Reading Unix-style Directories via STL-compliant Sequences”, The C++ Source, <http://www.artima.com/cppsource/directoriesviasequences.html>
- Documentation strategy ... opinions welcome (c++.stlsoft). www.digitalmars.com. Retrieved on 2008-05-20.
- Wilson, Matthew, STLSoft - Robust, Lightweight, Cross-platform, Template Software, <http://stlsoft.org/>. Retrieved on 22 May 2008
- Wilson, Matthew (17 May 2008), STLSoft Documentation, <http://stlsoft.org/doc-1.9/>. Retrieved on 18 May 2008
- Wilson, Matthew (17 May 2008), STLSoft Library 1.9.42, <http://stlsoft.org/downloads.html>. Retrieved on 18 May 2008
- Wilson, Matthew (2005). Imperfect C++: Practical Solutions for Real-Life Programming. Addison-Wesley. ISBN 0-321-22877-4.
- Wilson, Matthew (2007). Extended STL, Volume 1: Collections and Iterators. Addison-Wesley. ISBN 0-321-30550-7.
[edit] Further reading
- Articles by Matthew Wilson on Byte.com
- Articles by Matthew Wilson on Dr.Dobb's Portal
- Articles by Matthew Wilson on Synesis Software Website