$Header: /home/jason/software/mine/bkup/libjmmcg/docs/index.html,v 1.15 2008-08-09 00:41:02 jmmcg Exp $
JMMcG's Core C++ Libraries.
Introduction.
These files are a header-only implementation, no object files need be linked.
In core there are files that implement a number of useful features:
-
A whole library called Parallel Pixie Dust (PPD). PPD is a "prototype, experimental" C++ library (headers & source files) for assisting a non-beginner programmer in making use of multi-core or multi-chip SMP parallelism within their code for both general-purpose parallelism and certain HPC situations. Technically it implements data-flow parallelism. Practically this consists of an implementation of thread pools, futures & *some* parallel algorithms. It is similar, in some senses to the boost.thread, Intel Thread Building Blocks & STAPL libraries, but diverges in the details of the DSEL it expresses, for technical reasons. Various presentations have been given in the past (at the ACCU Conference & various BCS or IET sessions) regarding my thoughts on threading & PPD:
Usage examples are provided in the test suite.
-
A suite of hashing algorithms and a simple perfoemance measurement of them, including boost.hash & faster algorithms.
-
Various functions for raising numbers to integer powers, including techniques using template meta programming.
-
A generic factory-wrapper & a generic, multi-threaded, read-only cache (that uses PPD). The cache optinally implements statistics, and optionally implements an LRU algorithm.
-
Arguably the world's worst sorting technique: bogo-sort. This should never be used in production code!
-
Trace output. Use the macro "JMMCG_TRACE(...)" with a string argument to output to "std::cerr" (or the debug window under MSDevStudio) the file and line (amongst other thigs) prefixed string argument. A handy "got here!" dump. "JMMCG_TRACE(...)" compiles to nothing if "DEBUG" is not "#define"d.
-
Exceptions that have the file, line, revision, function and argument details. Also puts out a "JMMCG_TRACE" message on construction and copy, so you can see from where an exception was throw. Caught exceptions are useless for debugging. This makes exceptions much more powerful. These are also wide/narrow-character compliant. Now all I need to do is get it into the STL...
-
A "#define" for "dynamic_cast< ... & >(...)". This throws "std::bad_alloc". From where... Nobody knows. Useless, unless you use the "JMMCG_CHK_DYN_CAST" macro instead. It converts the "std::bad_alloc" into a "jmmcg::exception" that therefore includes location information. Much more useful at run-time!
-
CRT exceptions that include the CRT errno in them.
-
A few string utilities, convert anything to a string and extract anything from a string if "operator<<(...)" and "operator>>(...)" are defined.
-
Some macros to wrap using "wchar_t" and "char" so that you can ignore them, and just "#define" "_JMMCG_WIDE_CHARS" for getting "wchar_t" otherwise you get "char".
-
Logging to a log file, with exceptions thrown if the logging failed. Log output includes internationalized date & time, user, process & pid plus the message. The level of logging can be set by the user in the log object, so logging can be filtered.
-
Simple command line processing to set program data. This includes by default log-level setting, help & version. Arbitrary paramters may be supported with help output and simple parsing.
-
XML-format configuration file processing. This will make use of an XDR schema to validate the configuration file.
-
A function to get the local time & date in the current locale as a string.
-
A meter class that allows you to obtain the arithmetic mean of a value and the average deviation of that mean.
-
Functions for convering narrow strings to wide strings and vica-versa.
-
A class for creating peano curves.
Experimental Code.
In experimental there are files that I have been occasionally mucking with from my past.
Stuff that actually worked & I use/used:
NT-based:
There are files that are from my NT-based developer days. It contains some quite snazzy stuff, amongst other things:
-
Win32 system-registry key wrapping.
-
Win32 NT Event Log wrapping.
-
Asserting to the Win32 NT Event Log if "DEBUG" is defined, c.f. "assert(...)", but with an NT-Service you've no U.I. to debug them, so this was well handy, as you can view the NT Event-Log of one machine from another, if you are remotely debugging the service you are creating.
-
Various wrappers for Win32 Security objects, most importantly an "Everyone" permission object for setting up the permissions on named mutexes for intra-process use (otherwise you'll get permissions problems on Win32).
-
Various C++ class-wrappers for Win32 events, mutexes & critical sections, for both anonymous & named ones (for intra-process use).
-
Functions for loading and saving BMPs.
-
A very simple wrapper class and helper functions for MSXML4, which includes converting things to and from XML.
-
A very simple wrapper class and helper functions for COM.
-
Functions for getting GUIDs, checking if you're running on NT, converting Windows error numbers to strings, etc, etc.
-
An exception class (that derives from the core exception class) that can automatically add the "GetLastError()" number and string to it.
-
Network stuff:
-
A class for connecting to a remote machine's Service Control Manager.
-
A class for connecting to a remote machine's Task Scheduler.
-
A class for creating network file shares (on both local & remote machines).
-
Various other bits & bobs like local system time, a class for loading and freeing DLLs, blah blah.
Stuff that I never finished, so never compiled, or is buggy:
These files are in here.
-
The real reason I started mucking around with this shared-memory junk is I wanted to have a C++ wrapper to the NT Performance Monitor, PerfMon, counters. But now-a-days I use the ATL PerfMon addin instead. It's easy to use and works.
Documentation.
Browseable HTML is here: HTML docs. Or as a single PDF file.
Example Code.
This is included in the examples sub-directory.
Building.
Clearly this would be included as part of another project. But it does have certain requirements (on *nix & NT):
-
libstdc++ (for *nix, the STL as installed by MSDevStudio, or equivalent for Win*): The C++ Standard Library, usually installed as part of your G++ installation.
-
libboost: The Boost library, v1.40 or greater.
-
libxml2 (for parts of the *nix stuff, the NT-bits use MSXML4): The 'C' XML library, v2.5.1 or greater.
-
libxml++ (for parts of the *nix stuff, the NT-bits use MSXML4): The 'C++' wrapper to the above, v0.21 or greater. See "http://sourceforge.net/projects/libxmlplusplus".) Ensure that if you use the Sourceforge download of libxml++ that you modify your "/etc/ld.so.conf" file to include "/usr/local/lib" and run "ldconfig" to update the dynamic-linker path-cache correctly.
-
Others I haven't thought of yet.
Build platforms tested:
-
Gentoo GNU/Linux & Ubuntu v10.04LTS: with G++ >=v4.4.3, cmake-based build with a Kdevelop project wrapper.
License & Warranty.
This library is released under the LGPL, with absolutely no warranty, express or implied. Please see the files "COPYING" and "WARRANTY" in the release distribution for more details.
More details.
Credits.
This code was developed by J.M.McGuiness.