UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
u_abs_hod.hpp
1 /* u_abs_hod.hpp */
2 /* $Id: u_abs_hod.hpp 21267 2011-11-23 15:19:39Z guser1 $ */
3 #ifndef __u_abs_hod_hpp
4 #define __u_abs_hod_hpp
5 
6 #include <map>
7 #include <vector>
8 
9 #ifdef GE_BUILD
10 #include <u3d_point.hpp>
11 #else
12 #include <mth/u3d_point.hpp>
13 #endif
14 
15 //#include "service.hpp"
16 
17 
18 typedef std::pair<int, int> FBDTraceKey;
19 
20 
22 struct UHodEl
23 {
24  UHodEl();
25  UHodEl(size_t ndp,
26  size_t nsp,
27  size_t nrp,
28  float l,
29  float tfb,
30  float wht,
31  int ntr,
32  int nmgl,
33  U3dPoint _sp,
34  U3dPoint _rp);
35 
36  size_t NDP;
37  size_t NSP;
38  size_t NRP;
39  float L;
40  float TFB;
41  float weight;
42  size_t NTR;
43  size_t NMGL;
44 
45  U3dPoint sp;
46  U3dPoint rp;
47 
48  static bool ndp_eq(const UHodEl& h1, const UHodEl& h2) { return h1.NDP == h2.NDP; }
49 
50  static bool nsp_eq(const UHodEl& h1, const UHodEl& h2) { return h1.NSP == h2.NSP; }
51 
52  static bool nrp_eq(const UHodEl& h1, const UHodEl& h2) { return h1.NRP == h2.NRP; }
53 
54  static bool ofst_eq(const UHodEl& h1, const UHodEl& h2) { return h1.L == h2.L; }
55 
56  static bool ndp_asc(const UHodEl& h1, const UHodEl& h2) { return h1.NDP < h2.NDP; }
57 
58  static bool nsp_asc(const UHodEl& h1, const UHodEl& h2) { return h1.NSP < h2.NSP; }
59 
60  static bool nrp_asc(const UHodEl& h1, const UHodEl& h2) { return h1.NRP < h2.NRP; }
61 
62  static bool ofst_asc(const UHodEl& h1, const UHodEl& h2) { return h1.L < h2.L; }
63 
64  static bool pts_rev_eq(const UHodEl& h1, const UHodEl& h2) { return (h1.sp == h2.rp && h1.rp == h2.sp); }
65 };
66 
67 typedef std::vector<UHodEl> UHod;
68 
69 typedef std::map<FBDTraceKey, UHodEl> FBDHodMap;
70 
71 
73 {
74 public:
75 
76  enum SortType
77  {
78  CDP=0,
79  CSP,
80  CRP,
81  OFST
82  };
83 
84  UAbstractHod() { m_st_defined = false; }
85 
86  UAbstractHod(UHod hod) : m_hod(hod) { m_st_defined = false; }
87 
88  ~UAbstractHod() {}
89 
90  /* ================== Members access ================== */
91 
93  size_t getNMGLs(std::vector<float> &nmgls);
94 
96  size_t getNDPS(std::vector<int> &dps_id);
97 
99  size_t getSPS(std::vector<int> &sps_id);
100 
102  size_t getRPS(std::vector<int> &rps_id);
103 
105  size_t getOffsets(std::vector<float> &offsets);
106 
109  bool getHod(UHod &hod, float id=-1) const;
110 
112  const UHod& getHod() const { return m_hod; }
113 
115  void getHod(FBDHodMap &hod_map) const;
116 
118  bool getSortType(SortType& sort_type) const;
119 
120  /* ================== Modifiers ================== */
121 
123  bool setSortType(SortType sort_type);
124 
126  void resetSortType() { m_st_defined = false; }
127 
129  void setHod(UHod hod);
130 
132  bool setHod(FBDHodMap hod_map);
133 
134 protected:
135 
136  bool checkId(const UHodEl& h1, float id) const;
137 
138  bool m_st_defined;
139 
140  SortType m_st;
141 
142  UHod m_hod;
143 
144 };
145 
146 
147 
148 
149 #endif /* u_abs_hod.hpp */
bool getSortType(SortType &sort_type) const
void resetSortType()
Definition: u_abs_hod.hpp:126
size_t getOffsets(std::vector< float > &offsets)
size_t getNMGLs(std::vector< float > &nmgls)
void setHod(UHod hod)
size_t getSPS(std::vector< int > &sps_id)
float TFB
Definition: u_abs_hod.hpp:40
const UHod & getHod() const
Definition: u_abs_hod.hpp:112
bool setSortType(SortType sort_type)
size_t getRPS(std::vector< int > &rps_id)
Definition: u3d_point.hpp:16
size_t NSP
Definition: u_abs_hod.hpp:37
float L
Definition: u_abs_hod.hpp:39
size_t getNDPS(std::vector< int > &dps_id)
Definition: u_abs_hod.hpp:72
Definition: u_abs_hod.hpp:22
size_t NRP
Definition: u_abs_hod.hpp:38
float weight
Definition: u_abs_hod.hpp:41
size_t NDP
Definition: u_abs_hod.hpp:36