Baldwin Computer Science
I have developed a Utilities library primarily for my own use. This is a statically linked library right now, but could be made a dynamically linked library if that ever became an issue.
These primarily handle tasks both small and large that I either couldn't find a package to handle, or I didn't like the package I found.
This library is for use with C++, and uses as much abstraction as I can figure out.
This classes that make up this library are:
- This class will allow the user to check the Utilities library to see if the version supplied it the proper one. In the case of statically linked libraries this is not extremely important, but if the library is dynamically linked, it can be very important. This is derived from the Library class below.
- This class is used to collect any errors that might occur during the course of a program. Later the text of the error messages can be downloaded to be displayed to the user. This is a convenience class, so that each program does not need to create its own error handling system. In the case of the Internet, an "Error" class is provided which will display the errors on the browser.
- This is a class which will allow the version number to be check to ensure the library is compatible with the current program. Each library is assigned three numbers, a version number, a subversion number, and a sub-subversion number. If the version number differs from what is expected, then the library is rejected because it assumes there has been a major incompatible change to the library. If the subversion number is greater than or equal to the expected number, then it is assumed the library will work, since an increment in the subversion number is made only if the interface is extended. All existing programs should work with the new library, and it will be considered a bug in the library if it doesn't.
- This is a list of items of some sort. It is a template class, so I can have a list of, for example,
Strings as List. There are insert, delete, and access methods provided. Also, cursor object are supported so that the user can be at more than one place on the list at
One feature it the ease of use in a "for" statement: for (list.start(); list.end(); list.next()). This will step through the list one item at a time.
- This allows the user to maintain a log file easily. There can be as many logs as needed in a given program.
- This is a simple name table look-up. That is, items may be added which associate a given name with a string, then later the name can be supplied, and the associated string will be looked up.
- This is the heart of the system. An Object has a reference counter which can be used to keep track of the number of pointers pointing at this object (see Pointer below). In addition, each class has a class name which can be used for whatever purpose. There is also a method that can be called to see if a class derived from a particular type.
- This is the same as a list, except the objects are pointers to Objects. If an object is removed from the list, its reference count is decremented by one. If the reference count is zero, then the object is deleted.
- This is the same as a list, except the objects are general pointers. Objects removed from the list must be deleted explicitly.
- This is a pointer to an Object. The reference counts are handled properly if the pointer is changed. Initially the pointer is set to zero, so there is no need to clear the pointer.
- This is used to connect to a socket. It probably shouldn't be in this library, and may be moved to a library of its own later. It allows connecting to any HTTP socket on any port.
- There are several implementations of Strings. I wrote my own for two reasons. First, I wanted the experience, and second, the implementations I found were not acceptable because they allocated new strings too often. This class does not allocate a string when a portion of the string is used to make a new string. That is, both strings will point to the same buffer. The string supplies most of the usual methods. In addition, there are methods for most Internet translation, for example to and from URL encoding, etc. The strings are not zero terminated, so even binary values can be stored in the string.
- This is an encapsulation of the List class.
- This is an extension of the NameTable object. It adds the ability to store items in tables of tables, so a secondary indirection is provided.
©2008, Baldwin Computer Science
About us | Legal | Careers | Contact us |