+
+//================================================================================
+/*!
+ * \brief Return an array of strings corresponding to items of enum FunctorType
+ */
+//================================================================================
+
+static const char** getFunctNames()
+{
+ static const char* functName[ SMESH::FT_Undefined + 1 ] = {
+ // IT's necessary to update this array according to enum FunctorType (SMESH_Filter.idl)
+ // The order is IMPORTANT !!!
+ "FT_AspectRatio", "FT_AspectRatio3D", "FT_Warping", "FT_MinimumAngle",
+ "FT_Taper", "FT_Skew", "FT_Area", "FT_Volume3D", "FT_MaxElementLength2D",
+ "FT_MaxElementLength3D", "FT_FreeBorders", "FT_FreeEdges", "FT_FreeNodes",
+ "FT_FreeFaces","FT_EqualNodes","FT_EqualEdges","FT_EqualFaces","FT_EqualVolumes",
+ "FT_MultiConnection", "FT_MultiConnection2D", "FT_Length",
+ "FT_Length2D", "FT_BelongToGeom", "FT_BelongToPlane", "FT_BelongToCylinder",
+ "FT_BelongToGenSurface", "FT_LyingOnGeom", "FT_RangeOfIds", "FT_BadOrientedVolume",
+ "FT_BareBorderVolume", "FT_BareBorderFace", "FT_OverConstrainedVolume",
+ "FT_OverConstrainedFace", "FT_LinearOrQuadratic", "FT_GroupColor", "FT_ElemGeomType",
+ "FT_CoplanarFaces", "FT_LessThan", "FT_MoreThan", "FT_EqualTo", "FT_LogicalNOT",
+ "FT_LogicalAND", "FT_LogicalOR", "FT_Undefined" };
+ return functName;
+}
+
+//================================================================================
+/*!
+ * \brief Return a string corresponding to an item of enum FunctorType
+ */
+//================================================================================
+
+const char* SMESH::FunctorTypeToString(SMESH::FunctorType ft)
+{
+ if ( ft < 0 || ft > SMESH::FT_Undefined )
+ return "FT_Undefined";
+ return getFunctNames()[ ft ];
+}
+
+//================================================================================
+/*!
+ * \brief Converts a string to FunctorType. This is reverse of FunctorTypeToString()
+ */
+//================================================================================
+
+SMESH::FunctorType SMESH::StringToFunctorType(const char* str)
+{
+ std::string name( str + 3 ); // skip "FT_"
+ const char** functNames = getFunctNames();
+ int ft = 0;
+ for ( ; ft < SMESH::FT_Undefined; ++ft )
+ if ( name == ( functNames[ft] + 3 ))
+ break;
+
+ //ASSERT( strcmp( str, FunctorTypeToString( SMESH::FunctorType( ft ))) == 0 );
+
+ return SMESH::FunctorType( ft );
+}