Salome HOME
b557ef5550394539c02c700de40b3d5362b1d765
[modules/homard.git] / src / FrontTrack / FrontTrack_Utils.hxx
1 // File      : FrontTrack_Utils.hxx
2 // Created   : Tue Apr 25 17:23:33 2017
3 // Author    : Edward AGAPOV (eap)
4
5 #ifndef __FrontTrack_Utils_HXX__
6 #define __FrontTrack_Utils_HXX__
7
8 #include "FrontTrack_Projector.hxx"
9
10 #include <vector>
11 #include <string>
12 #include <map>
13
14 namespace XAO {
15   class Xao;
16   class Group;
17 }
18
19 namespace FT_Utils
20 {
21   // Check if a file exists
22   bool fileExists( const std::string& path );
23
24   // Check if a file can be created/overwritten
25   bool canWrite( const std::string& path );
26
27   // Transform anything printable to a string
28   template< typename T> std::string toStr( const T& t )
29   {
30     std::ostringstream s;
31     s << t;
32     return s.str();
33   }
34
35   //--------------------------------------------------------------------------------------------
36   /*!
37    * \brief Return projectors by group name
38    */
39   struct XaoGroups
40   {
41     XaoGroups( const XAO::Xao* xao );
42
43     int getProjectors( const std::string&                   groupName,
44                        const int                            dim,
45                        const std::vector< FT_Projector > &  allProjectors,
46                        std::vector< const FT_Projector* > & groupProjectors ) const;
47   private:
48
49     typedef std::multimap< std::string, XAO::Group* > TGroupByNameMap;
50     TGroupByNameMap _xaoGroups[ 2 ]; // by dim
51   };
52 }
53
54 #endif