MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
GelPositions.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGGelPositions_HH_
6 #define _MGGelPositions_HH_
7 
8 class MGGroup;
9 #include <algorithm>
10 #include <vector>
11 #include "mg/GelPosition.h"
12 
13 class MGPickObjects;
14 
20 
23 class MG_DLL_DECLR MGGelPositions{
24 public:
25 
27  typedef std::vector<MGGelPosition> container_type;
28  typedef container_type::reference reference;
29  typedef container_type::const_reference const_reference;
30  typedef container_type::iterator iterator;
31  typedef container_type::const_iterator const_iterator;
32  typedef container_type::size_type size_type;
33  typedef container_type::difference_type difference_type;
34  typedef container_type::value_type value_type;
35  typedef container_type::allocator_type allocator_type;
36  typedef allocator_type::pointer pointer;
37  typedef allocator_type::const_pointer const_pointer;
38  typedef container_type::reverse_iterator reverse_iterator;
39  typedef container_type::const_reverse_iterator const_reverse_iterator;
40 
41 
43 MG_DLL_DECLR friend std::ostream& operator<< (std::ostream&, const MGGelPositions&);
44 
46 
49 
52 MGGelPositions(const MGGelPosition& gelp);
53 
55 MGGelPositions(const MGPickObjects& gelp);
56 
58 MGGelPositions(const MGGelPositions& obj2);
59 
62 
64 
65 const_reference operator[](size_type i)const{return m_gelps[i];};
66 reference operator[](size_type i){return m_gelps[i];};
67 
69 MGGelPositions& operator+=(const MGGelPositions& gelps){push_back(gelps);return *this;};
70 MGGelPositions& operator+=(const MGGelPosition& gelp){push_back(gelp);return *this;};
71 MGGelPositions& operator-=(const MGGelPositions& gelps){remove(gelps);return *this;};
72 MGGelPositions& operator-=(const MGGelPosition& gelp){remove(gelp);return *this;};
73 MGGelPositions& operator-=(const MGAbstractGels& types){remove(types);return *this;};
74 MGGelPositions& operator&=(const MGGelPositions& gelps){reset_with_common(gelps);return *this;};
75 
77 
79 void assign(const_iterator first, const_iterator last);
80 
83 virtual const_reference back() const{return m_gelps.back();};
84 virtual reference back(){return m_gelps.back();};
85 
87 const_iterator begin() const{return m_gelps.begin();}
88 iterator begin(){return m_gelps.begin();}
89 
91 void clear(){m_gelps.clear();};
92 
95 bool empty() const{return m_gelps.empty();};
96 
98 const_iterator end() const{return m_gelps.end();};
99 iterator end(){return m_gelps.end();};
100 
103 iterator erase(iterator x){return m_gelps.erase(x);};
104 
107 iterator erase(iterator first, iterator last){return m_gelps.erase(first,last);};
108 
110 void erase(int i){erase(begin()+i);};
111 
113 iterator find(const MGGelPosition& gelp){return std::find(begin(),end(),gelp);};
114 const_iterator find(const MGGelPosition& gelp)const{return std::find(begin(),end(),gelp);};
115 
116 //Test if there is a MGPickObject that includes input objin
117 //in this MGPickObjects' member. If input objin is MGShell,
118 //and a member is_shell_face(), test is performed to the shell.
119 //Returns true if objin is included in this MGPickObjects.
120 iterator includes(const MGObject* objin);
121 
124 virtual const_reference front() const{return m_gelps.front();};
125 virtual reference front(){return m_gelps.front();};
126 
129 iterator insert(iterator it, const MGGelPosition& x){return m_gelps.insert(it,x);};
130 
131 container_type& object_vector(){return m_gelps;};
132 const container_type& object_vector()const{return m_gelps;};
133 
135 void pop_back(){m_gelps.pop_back();};
136 
139 void push_back(const MGGelPositions& gelps){
140  m_gelps.insert(end(), gelps.begin(), gelps.end());
141 }
142 void push_back(const MGGelPosition& gelp);
143 
145 const_reverse_iterator rbegin() const{return m_gelps.rbegin();};
146 reverse_iterator rbegin(){return m_gelps.rbegin();};
147 
149 const_reverse_iterator rend() const{return m_gelps.rend();};
150 reverse_iterator rend(){return m_gelps.rend();};
151 
153 void resize(size_type n){m_gelps.resize(n);};
154 
156 void reserve(int n);
157 
159 void remove(const MGGelPosition& gelp);
160 
162 void remove(const MGAbstractGels& types);
163 
165 void remove(const MGGelPositions& gelps);
166 
168 void reset_with_common(const MGGelPositions& pobjs2);
169 
174 void reset_with_symmetric_difference(MGGelPositions& pobjs2);
175 
177 void reset(int i, const MGGelPosition& pobj);
178 
182 MGGelPositions select(const MGAbstractGels& types)const;
183 
189 MGGelPosition select_1st_curve()const;
190 
195 void select_curves(MGGelPositions& curves)const;
196 
202 MGGelPosition select_1st_fsurface()const;
203 
208 void select_fsurfaces(MGGelPositions& surfaces)const;
209 
211 size_type size() const{return m_gelps.size();};
212 
217 bool symmetric(const MGGelPositions& gels2)const;
218 
219 private:
221  container_type m_gelps;
222 
223 };
224  // end of GelRelated group
226 #endif
bool empty() const
Definition: GelPositions.h:95
container_type & object_vector()
Definition: GelPositions.h:131
void pop_back()
pop last element.
Definition: GelPositions.h:135
iterator begin()
Definition: GelPositions.h:88
container_type::value_type value_type
Definition: GelPositions.h:34
size_type size() const
Return the number of items that are in the list.
Definition: GelPositions.h:211
reference operator[](size_type i)
Definition: GelPositions.h:66
reverse_iterator rend()
Definition: GelPositions.h:150
iterator insert(iterator it, const MGGelPosition &x)
Definition: GelPositions.h:129
MGGelPosition Container Class.
Definition: GelPositions.h:23
MGGelPositions()
Void constructor(初期化なしでオブジェクトを作成する。)
Definition: GelPositions.h:48
container_type::iterator iterator
Definition: GelPositions.h:30
const_reverse_iterator rbegin() const
Return reverse_iterator at the beginning of list.
Definition: GelPositions.h:145
MGGelPositions & operator-=(const MGGelPositions &gelps)
Definition: GelPositions.h:71
virtual reference front()
Definition: GelPositions.h:125
Is a container of MGAbstractGel, to specify what kind of gels are required.
Definition: AbstractGels.h:25
container_type::reference reference
Definition: GelPositions.h:28
std::ostream & operator<<(std::ostream &ostrm, const MGisect &is)
Debug Function.
Definition: isect.h:95
const_reference operator[](size_type i) const
Definition: GelPositions.h:65
iterator find(const MGGelPosition &gelp)
Find the input MGGelposition.
Definition: GelPositions.h:113
Is an abstract class which represents a whole geometry and a topology.
Definition: Object.h:42
container_type::allocator_type allocator_type
Definition: GelPositions.h:35
void resize(size_type n)
Resize the gelp.
Definition: GelPositions.h:153
virtual reference back()
Definition: GelPositions.h:84
container_type::difference_type difference_type
Definition: GelPositions.h:33
container_type::size_type size_type
Definition: GelPositions.h:32
allocator_type::const_pointer const_pointer
Definition: GelPositions.h:37
const_reverse_iterator rend() const
Return const_reverse_iterator at the end of list.
Definition: GelPositions.h:149
reverse_iterator rbegin()
Definition: GelPositions.h:146
virtual const_reference front() const
Definition: GelPositions.h:124
const container_type & object_vector() const
Definition: GelPositions.h:132
container_type::const_reverse_iterator const_reverse_iterator
Definition: GelPositions.h:39
allocator_type::pointer pointer
Definition: GelPositions.h:36
MGGelPositions & operator+=(const MGGelPositions &gelps)
Set operation.
Definition: GelPositions.h:69
MGGelPosition is a class to locate where a gel is in a group hierarchy.
Definition: GelPosition.h:39
void erase(int i)
erase i-th element.
Definition: GelPositions.h:110
container_type::const_iterator const_iterator
Definition: GelPositions.h:31
iterator end()
Definition: GelPositions.h:99
MGGelPositions & operator-=(const MGAbstractGels &types)
Definition: GelPositions.h:73
MGGelPositions & operator-=(const MGGelPosition &gelp)
Definition: GelPositions.h:72
iterator erase(iterator x)
Definition: GelPositions.h:103
const_iterator find(const MGGelPosition &gelp) const
Definition: GelPositions.h:114
MGGelPositions & operator+=(const MGGelPosition &gelp)
Definition: GelPositions.h:70
virtual const_reference back() const
Definition: GelPositions.h:83
void clear()
clear list, that is, erase all the elements in the MGGelPositions.
Definition: GelPositions.h:91
const_iterator end() const
Return const_iterator at the end of MGGelPositions.
Definition: GelPositions.h:98
container_type::const_reference const_reference
Definition: GelPositions.h:29
MGGroup is a class which constains MGGel elements.
Definition: Group.h:35
MGGelPositions & operator&=(const MGGelPositions &gelps)
Definition: GelPositions.h:74
a container class for MGPickObject.
Definition: PickObjects.h:29
container_type::reverse_iterator reverse_iterator
Definition: GelPositions.h:38
void push_back(const MGGelPositions &gelps)
Definition: GelPositions.h:139
std::vector< MGGelPosition > container_type
別名定義
Definition: GelPositions.h:27
iterator erase(iterator first, iterator last)
Definition: GelPositions.h:107
const_iterator begin() const
Return iterator at the beginning of list.
Definition: GelPositions.h:87