mxm_generic_stuff.h

00001 //           ///          //                                  C++ Cross Platform
00002 //          /////        ////
00003 //         /// XXX     XXX ///            ///////////   /////////     ///   ///
00004 //        ///    XXX XXX    ///         ///             ///    ///   ///  ///
00005 //       ///       XXX       ///         /////////     ///      //  //////
00006 //      ///      XXX XXX      ///               ///   ///    ///   ///  ///
00007 //     ////    XXX     XXX    ////    ////////////  //////////    ///   ///
00008 //    ////                     ////
00009 //   ////  M  O  B  O  T  I  X  ////////////////////////////////////////////////
00010 //  //// Security Vision Systems //////////////////////////////////////////////
00011 //
00012 //  $Author: khe_admin $
00013 //  $LastChangedBy: khe_admin $
00014 //  $LastChangedDate: 2007-06-29 12:31:37 +0200 (Fri, 29 Jun 2007) $
00015 //  $HeadURL: http://svn.mobotix.net/svn/mxsdk/src/mxm/trunk/include/mxm/core/mxm_generic_stuff.h $
00016 //
00018      //
00019      //  MOBOTIX MxPEG SDK
00020      //
00021      //  This file belongs to the C++ library released as part of the MxPEG SDK.
00022      //
00023      //  This software is licenced under the BSD licence,
00024      //  http://www.opensource.org/licenses/bsd-license.php
00025      //
00026      //  Copyright (c) 2005 - 2007, MOBOTIX AG
00027      //  All rights reserved.
00028      //
00029      //  Redistribution and use in source and binary forms, with or without
00030      //  modification, are permitted provided that the following conditions are
00031      //  met:
00032      //
00033      //  - Redistributions of source code must retain the above copyright
00034      //    notice, this list of conditions and the following disclaimer.
00035      //
00036      //  - Redistributions in binary form must reproduce the above copyright
00037      //    notice, this list of conditions and the following disclaimer in the
00038      //    documentation and/or other materials provided with the distribution.
00039      //
00040      //  - Neither the name of MOBOTIX AG nor the names of its contributors may
00041      //    be used to endorse or promote products derived from this software
00042      //    without specific prior written permission.
00043      //
00044      //  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00045      //  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00046      //  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00047      //  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00048      //  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00049      //  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00050      //  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00051      //  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00052      //  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00053      //  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00054      //  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00055      //
00057 
00058 
00059 
00069 #ifndef __MXM_NAMESPACE_H__
00070 #define __MXM_NAMESPACE_H__
00071 
00072 
00073 
00074 #undef u8
00075    // steve, steve, steve...
00076 
00077 
00078 
00079 #include <mxm/core/mxmString.h>
00080 #include <mxm/core/mxm_types.h>
00081 
00082 
00083 
00084 class mxmPerlStyleHash;
00085 class mxmStringList;
00086 class mxmStatusMessageHandlerInterface;
00087 
00088 
00089 
00091 namespace mxm {
00092   
00093   const int DialogSpacing             = 10;
00094   const int StatusMessageHandlerSlots = 10;
00095   
00096   extern MXM_CORE_API const char *ValidFilenameCharacters;
00097   extern MXM_CORE_API const char *WhitespaceCharacters;
00098   
00099   extern MXM_CORE_API mxmStatusMessageHandlerInterface
00100                           *StatusMessageHandlers[StatusMessageHandlerSlots + 1];
00101   extern MXM_CORE_API StatusMessageType DefaultStatusMessageLevel;
00102   
00104   inline void clamp_s16(s16 *numba, s16 min, s16 max) {
00105     if(*numba < min) *numba = min;
00106     if(*numba > max) *numba = max;
00107   }
00109   inline void clamp_int(int *numba, int min, int max) {
00110     if(*numba < min) *numba = min;
00111     if(*numba > max) *numba = max;
00112   }
00114   inline void clamp_float(float *numba, float min, float max) {
00115     if(*numba < min) *numba = min;
00116     if(*numba > max) *numba = max;
00117   }
00118   
00120   int MXM_CORE_API randomNumber(int max);
00121   
00124   MXM_CORE_API void substituteArguments(mxmString &txt,
00125                                         const mxmStringList &args);
00126   
00128   MXM_CORE_API mxmString hex(void *mem_block, int block_size);
00129   
00131   MXM_CORE_API bool debugMode(void);
00132   
00135   MXM_CORE_API void sendStatusMessage(mxm::StatusMessageType msg_type,
00136                                       const mxmString &message,
00137                                       const mxmObject *sending_object = 0);
00139   MXM_CORE_API void addStatusMessageHandler(mxmStatusMessageHandlerInterface
00140                                              *msg_handler);
00143   MXM_CORE_API void removeStatusMessageHandler(mxmStatusMessageHandlerInterface
00144                                                *msg_handler);
00146   MXM_CORE_API void removeStatusMessageHandlers();
00149   MXM_CORE_API void setStatusMessageVerbosity(StatusMessageType msg_level);
00152   MXM_CORE_API bool statusMessageUseful(StatusMessageType msg_level);
00153   
00156   MXM_CORE_API mxmString rttiClassName(const mxmObject *sending_object);
00157   
00160   MXM_CORE_API void terminal(const mxmString &msg,
00161                              const mxmObject *sending_object = 0);
00162 };
00163 
00164 
00165 
00166 #endif   // __MXM_NAMESPACE_H__

Generated on Fri Jun 29 17:21:04 2007 for MxPEG SDK by  doxygen 1.4.6