[MOAB-dev] r3645 - in MOAB/trunk/src: . moab

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Wed Mar 17 14:21:06 CDT 2010


Author: kraftche
Date: 2010-03-17 14:21:06 -0500 (Wed, 17 Mar 2010)
New Revision: 3645

Modified:
   MOAB/trunk/src/MBEntityType.h
   MOAB/trunk/src/moab/EntityType.hpp
Log:
try again to have C, C++ w/out namespaces, and C++ w/ namespaces for EntityType enum

Modified: MOAB/trunk/src/MBEntityType.h
===================================================================
--- MOAB/trunk/src/MBEntityType.h	2010-03-17 19:20:13 UTC (rev 3644)
+++ MOAB/trunk/src/MBEntityType.h	2010-03-17 19:21:06 UTC (rev 3645)
@@ -16,20 +16,19 @@
 #ifndef MB_ENTITY_TYPE_H
 #define MB_ENTITY_TYPE_H
 
-#ifndef MOAB_ENTITY_TYPE_NAME
-#  define MOAB_ENTITY_TYPE_NAME MBEntityType
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /*! Entity types defined in MOAB and MBCN
  *  The ordering here must ensure that all element types are 
  *  grouped together and all elements of similar dimension are
  *  grouped together.
  */
-typedef enum 
+
+#ifdef __cplusplus
+namespace moab { 
+# define MOAB_ENTITY_TYPE_NAME EntityType
+# else /* __cplusplus */
+# define MOAB_ENTITY_TYPE_NAME MBEntityType
+#endif /* __cplusplus */
+enum MOAB_ENTITY_TYPE_NAME
 {
   MBVERTEX = 0, /**< Mesh Vertex AKA node */
   MBEDGE,       /**< Mesh Edge */
@@ -45,12 +44,8 @@
   MBENTITYSET,    /**< MeshSet */
   MBMAXTYPE  /**< Just a place keeper - must be the # of entities, for array */
     /**< dimensioning purposes  */
-} MOAB_ENTITY_TYPE_NAME;
+};
 
-#ifdef __cplusplus
-} /* extern "C" */
-
-
 /** prefix increment operator for MBEntityType */
 inline MOAB_ENTITY_TYPE_NAME & operator++(MOAB_ENTITY_TYPE_NAME &type)
 {
@@ -79,8 +74,21 @@
   return oldval;
 }
 
-#endif
+#ifdef __cplusplus
+} /* namespace moab*/
+#endif /* __cplusplus */
 
 #undef MOAB_ENTITY_TYPE_NAME
+#endif /* MB_ENTITY_TYPE_H */
 
-#endif
+#ifdef __cplusplus
+#  ifndef MOAB_ENTITY_TYPE_NS_ONLY
+#    define MOAB_ENTITY_TYPE_NS_ONLY
+     typedef moab::EntityType MBEntityType;
+#  endif /* MOAB_ENTITY_TYPE_NS_ONLY */
+#else /* __cplusplus */
+#  ifndef MOAB_ENTITY_TYPE_C
+#    define MOAB_ENTITY_TYPE_C
+     typedef enum MBEntityType MBEntityType;
+#  endif /* MOAB_ENTITY_TYPE_C */
+#endif /* __cplusplus */

Modified: MOAB/trunk/src/moab/EntityType.hpp
===================================================================
--- MOAB/trunk/src/moab/EntityType.hpp	2010-03-17 19:20:13 UTC (rev 3644)
+++ MOAB/trunk/src/moab/EntityType.hpp	2010-03-17 19:21:06 UTC (rev 3645)
@@ -1,12 +1,6 @@
-#ifndef MOAB_ENTITY_TYPE_HPP
-#define MOAB_ENTITY_TYPE_HPP
+#ifndef MOAB_ENTITY_TYPE_NS_ONLY
+# define MOAB_ENTITY_TYPE_NS_ONLY
+# include "MBEntityType.h"
+# undef MOAB_ENTITY_TYPE_NS_ONLY
+#endif 
 
-namespace moab {
-  #undef MB_ENTITY_TYPE_H
-  #define MOAB_ENTITY_TYPE_NAME EntityType
-  #include "MBEntityType.h"
-  #undef MB_ENTITY_TYPE_H
-}
-
-#endif
-



More information about the moab-dev mailing list