]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins_Config.h
Almost there...
[cpPlugins.git] / lib / cpPlugins_Config.h
index 7a228b10b10ee6de452118e7badb7e00330d685c..984f23b874119dd975e9f100a4e341af0f019edf 100644 (file)
@@ -1,6 +1,13 @@
 #ifndef __CPPLUGINS_CONFIG__H__
 #define __CPPLUGINS_CONFIG__H__
 
+/*
+ * =========================================================================
+ * Some global values
+ * =========================================================================
+ */
+#define cpPlugins_PATHS "cpPlugins_PATHS"
+
 /*
  * =========================================================================
  * ITK related macros
 #  define ITK_OVERRIDE
 #endif // ITK_OVERRIDE
 
+/*
+ * =========================================================================
+ * VTK related macros
+ * =========================================================================
+ */
+#include <vtkConfigure.h>
+#ifndef VTK_OVERRIDE
+#  define VTK_OVERRIDE
+#endif // VTK_OVERRIDE
+
 /*
  * =========================================================================
  * Identify OS
@@ -24,6 +41,7 @@
 #  define cpPlugins_SYS_WINDOWS
 #  define cpPlugins_LIB_PREFIX ""
 #  define cpPlugins_LIB_EXT "dll"
+#  define cpPlugins_SEPARATOR ";"
 #  ifndef WIN32_LEAN_AND_MEAN
 #    define WIN32_LEAN_AND_MEAN
 #  endif
 #  define cpPlugins_SYS_LINUX
 #  define cpPlugins_LIB_PREFIX "lib"
 #  define cpPlugins_LIB_EXT "so"
+#  define cpPlugins_SEPARATOR ":"
 #elif defined( __APPLE__ ) || defined( MACOSX ) || defined( macintosh ) || defined( Macintosh )
 #  define cpPlugins_SYS_MACOS
 #  define cpPlugins_LIB_PREFIX "lib"
 #  define cpPlugins_LIB_EXT "dylib"
+#  define cpPlugins_SEPARATOR ":"
 #elif defined( __FreeBSD__ ) || defined( __FreeBSD_kernel__ )
 #  define cpPlugins_SYS_FREEBSD
 #  define cpPlugins_LIB_PREFIX "lib"
 #  define cpPlugins_LIB_EXT "so"
+#  define cpPlugins_SEPARATOR ":"
 #else
 #  error "This operating system is not supported by cpPlugins"
 #endif
  * =========================================================================
  */
 
+#include <chrono>
 #include <cstring>
 #include <fstream>
 #include <iostream>
 #include <string>
 
+// -------------------------------------------------------------------------
 #ifdef cpPlugins_SYS_WINDOWS
 #  define cpPlugins_STRTOK( A, B, N ) strtok_s( A, B, N )
 #else // cpPlugins_SYS_WINDOWS
 #  define cpPlugins_STRTOK( A, B, N ) std::strtok( A, B )
 #endif // cpPlugins_SYS_WINDOWS
 
+// -------------------------------------------------------------------------
+#define cpPlugins_CHRONO                                                \
+  std::chrono::duration_cast< std::chrono::milliseconds >(              \
+    std::chrono::system_clock::now( ).time_since_epoch( )               \
+    ).count( )
+
 namespace cpPlugins
 {
   struct IsSeparator
@@ -79,9 +108,9 @@ namespace cpPlugins
   };
 
   // -----------------------------------------------------------------------
-  inline bool IsBlank( const char& value )
+  inline bool IsBlank( const char& v )
   {
-    return( value == ' ' || value == '\t' || value == '\n' || value == '\r' );
+    return( v == ' ' || v == '\t' || v == '\n' || v == '\r' );
   }
 
   // -----------------------------------------------------------------------
@@ -124,7 +153,9 @@ namespace cpPlugins
   }
 
   // -----------------------------------------------------------------------
-  inline bool ReadFileIntoString( std::string& buffer, const std::string& fname )
+  inline bool ReadFileIntoString(
+    std::string& buffer, const std::string& fname
+    )
   {
     buffer = "";
     std::ifstream file_stream( fname.c_str( ) );