Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ...

pantheios/inserters/processid.hpp

Go to the documentation of this file.
00001 /* /////////////////////////////////////////////////////////////////////////
00002  * File:        pantheios/inserters/processid.hpp
00003  *
00004  * Purpose:     String inserter for process identity.
00005  *
00006  * Created:     16th October 2006
00007  * Updated:     14th February 2010
00008  *
00009  * Home:        http://www.pantheios.org/
00010  *
00011  * Copyright (c) 2006-2010, Matthew Wilson and Synesis Software
00012  * All rights reserved.
00013  *
00014  * Redistribution and use in source and binary forms, with or without
00015  * modification, are permitted provided that the following conditions are
00016  * met:
00017  *
00018  * - Redistributions of source code must retain the above copyright notice,
00019  *   this list of conditions and the following disclaimer.
00020  * - Redistributions in binary form must reproduce the above copyright
00021  *   notice, this list of conditions and the following disclaimer in the
00022  *   documentation and/or other materials provided with the distribution.
00023  * - Neither the name(s) of Matthew Wilson and Synesis Software nor the
00024  *   names of any contributors may be used to endorse or promote products
00025  *   derived from this software without specific prior written permission.
00026  *
00027  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
00028  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00029  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00030  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00031  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00032  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00033  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00034  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00035  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00036  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00037  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038  *
00039  * ////////////////////////////////////////////////////////////////////// */
00040 
00041 
00047 #ifndef PANTHEIOS_INCL_PANTHEIOS_INSERTERS_HPP_PROCESSID
00048 #define PANTHEIOS_INCL_PANTHEIOS_INSERTERS_HPP_PROCESSID
00049 
00050 /* /////////////////////////////////////////////////////////////////////////
00051  * Version information
00052  */
00053 
00054 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00055 # define PANTHEIOS_VER_PANTHEIOS_INSERTERS_HPP_PROCESSID_MAJOR      2
00056 # define PANTHEIOS_VER_PANTHEIOS_INSERTERS_HPP_PROCESSID_MINOR      2
00057 # define PANTHEIOS_VER_PANTHEIOS_INSERTERS_HPP_PROCESSID_REVISION   3
00058 # define PANTHEIOS_VER_PANTHEIOS_INSERTERS_HPP_PROCESSID_EDIT       19
00059 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00060 
00061 /* /////////////////////////////////////////////////////////////////////////
00062  * Includes
00063  */
00064 
00065 #ifndef PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS
00066 # include <pantheios/pantheios.h>
00067 #endif /* !PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS */
00068 #ifndef PANTHEIOS_INCL_PANTHEIOS_INSERTERS_HPP_FMT
00069 # include <pantheios/inserters/fmt.hpp>
00070 #endif /* !PANTHEIOS_INCL_PANTHEIOS_INSERTERS_HPP_FMT */
00071 
00072 #ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_H_FWD
00073 # include <stlsoft/shims/access/string/fwd.h>
00074 #endif /* !STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_STRING_H_FWD */
00075 
00076 /* /////////////////////////////////////////////////////////////////////////
00077  * Namespace
00078  */
00079 
00080 #if !defined(PANTHEIOS_NO_NAMESPACE)
00081 namespace pantheios
00082 {
00083 
00084 #endif /* !PANTHEIOS_NO_NAMESPACE */
00085 
00086 /* /////////////////////////////////////////////////////////////////////////
00087  * Typedefs
00088  */
00089 
00105 extern struct processId_t const* processId;
00106 
00107 /* /////////////////////////////////////////////////////////////////////////
00108  * Worker functions
00109  */
00110 
00111 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00112 
00113 PANTHEIOS_CALL(pan_char_t const*) pantheios_getCurrentProcessIdString(void);
00114 PANTHEIOS_CALL(size_t)      pantheios_getCurrentProcessIdStringLength(void);
00115 
00116 PANTHEIOS_CALL_DEPRECATED(pan_char_t const*, pantheios_processId, pantheios_getCurrentProcessIdString) pantheios_processId(void);
00117 PANTHEIOS_CALL_DEPRECATED(size_t, pantheios_processIdLength, pantheios_getCurrentProcessIdStringLength) pantheios_processIdLength(void);
00118 
00119 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00120 
00121 /* /////////////////////////////////////////////////////////////////////////
00122  * String Access Shims
00123  */
00124 
00125 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00126 
00127 # if !defined(PANTHEIOS_NO_NAMESPACE)
00128 namespace shims
00129 {
00130 # endif /* !PANTHEIOS_NO_NAMESPACE */
00131 
00132 # ifdef PANTHEIOS_USE_WIDE_STRINGS
00133 inline wchar_t const* c_str_data_w(struct processId_t const*)
00134 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
00135 inline char const* c_str_data_a(struct processId_t const*)
00136 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
00137 {
00138     return pantheios_getCurrentProcessIdString();
00139 }
00140 inline pan_char_t const* c_str_data(struct processId_t const*)
00141 {
00142     return pantheios_getCurrentProcessIdString();
00143 }
00144 
00145 # ifdef PANTHEIOS_USE_WIDE_STRINGS
00146 inline size_t c_str_len_w(struct processId_t const*)
00147 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
00148 inline size_t c_str_len_a(struct processId_t const*)
00149 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
00150 {
00151     return pantheios_getCurrentProcessIdStringLength();
00152 }
00153 inline size_t c_str_len(struct processId_t const*)
00154 {
00155     return pantheios_getCurrentProcessIdStringLength();
00156 }
00157 
00158 # ifdef PANTHEIOS_USE_WIDE_STRINGS
00159 inline wchar_t const* c_str_ptr_w(struct processId_t const*)
00160 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
00161 inline char const* c_str_ptr_a(struct processId_t const*)
00162 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
00163 {
00164     return pantheios_getCurrentProcessIdString();
00165 }
00166 inline pan_char_t const* c_str_ptr(struct processId_t const*)
00167 {
00168     return pantheios_getCurrentProcessIdString();
00169 }
00170 
00171 # if !defined(PANTHEIOS_NO_NAMESPACE)
00172 } /* namespace shims */
00173 
00174 #  if defined(STLSOFT_COMPILER_IS_GCC)
00175     /* GCC does not seem to correctly handle the phases of
00176      * processing of C++ templates, so we need to 'use' the
00177      * shims into the same namespace as the inserter class
00178      * in order that ADL can suffice instead.
00179      */
00180 #   ifdef PANTHEIOS_USE_WIDE_STRINGS
00181     using ::pantheios::shims::c_str_data_w;
00182     using ::pantheios::shims::c_str_len_w;
00183     using ::pantheios::shims::c_str_ptr_w;
00184 #   else /* ? PANTHEIOS_USE_WIDE_STRINGS */
00185     using ::pantheios::shims::c_str_data_a;
00186     using ::pantheios::shims::c_str_len_a;
00187     using ::pantheios::shims::c_str_ptr_a;
00188 #   endif /* PANTHEIOS_USE_WIDE_STRINGS */
00189     using ::pantheios::shims::c_str_data;
00190     using ::pantheios::shims::c_str_len;
00191     using ::pantheios::shims::c_str_ptr;
00192 #  endif /* compiler */
00193 
00194 # endif /* !PANTHEIOS_NO_NAMESPACE */
00195 
00196 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00197 
00198 /* /////////////////////////////////////////////////////////////////////////
00199  * Namespace
00200  */
00201 
00202 #if !defined(PANTHEIOS_NO_NAMESPACE)
00203 } /* namespace pantheios */
00204 
00205 namespace stlsoft
00206 {
00207     // 'Export' the string access shims into the STLSoft namespace
00208     //
00209     // c_str_ptr(_a) is not necessary for version 1.0 of Pantheios, but it's
00210     // defined and exported in order to allow for the case where someone
00211     // may find a legitimate use for the conversion classes additional to
00212     // the type-tunneling of the Pantheios API.
00213 
00214 #ifdef PANTHEIOS_USE_WIDE_STRINGS
00215     using ::pantheios::shims::c_str_data_w;
00216     using ::pantheios::shims::c_str_len_w;
00217     using ::pantheios::shims::c_str_ptr_w;
00218 #else /* ? PANTHEIOS_USE_WIDE_STRINGS */
00219     using ::pantheios::shims::c_str_data_a;
00220     using ::pantheios::shims::c_str_len_a;
00221     using ::pantheios::shims::c_str_ptr_a;
00222 #endif /* PANTHEIOS_USE_WIDE_STRINGS */
00223     using ::pantheios::shims::c_str_data;
00224     using ::pantheios::shims::c_str_len;
00225     using ::pantheios::shims::c_str_ptr;
00226 
00227 }
00228 
00229 #endif /* !PANTHEIOS_NO_NAMESPACE */
00230 
00231 /* /////////////////////////////////////////////////////////////////////////
00232  * Inclusion
00233  */
00234 
00235 #ifdef STLSOFT_PPF_pragma_once_SUPPORT
00236 # pragma once
00237 #endif /* STLSOFT_PPF_pragma_once_SUPPORT */
00238 
00239 /* ////////////////////////////////////////////////////////////////////// */
00240 
00241 #endif /* !PANTHEIOS_INCL_PANTHEIOS_INSERTERS_HPP_PROCESSID */
00242 
00243 /* ///////////////////////////// end of file //////////////////////////// */

pantheios Library documentation Matthew Wilson & Synesis Software, 2006-2011 SourceForge.net Logo