MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
KnotArray.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGKnotArray_HH_
6 #define _MGKnotArray_HH_
7 
12 #include <vector>
13 #include "mg/Knot.h"
14 
15 // MGKnotArray.h
16 //
17 
18 //Forward Declaration
19 class MGIfstream;
20 class MGOfstream;
21 
23 
26 class MG_DLL_DECLR MGKnotArray{
27 
29 
30 public:
31 
32 
34 MG_DLL_DECLR friend std::ostream& operator<< (std::ostream&, const MGKnotArray&);
35 
37 
40 
42 explicit MGKnotArray(const MGKnot&);
43 
45 MGKnotArray(double knot, int mult);
46 
47 // MGKnotArray(const MGKnotArray&); //Copy Constructor.
48 
51 
53 
55 const MGKnot& operator[](int pos) const
56 {return m_ktArray.operator[](pos);}
57 MGKnot& operator[](int pos)
58 {return m_ktArray.operator[](pos);}
59 
61 
63 MGKnotArray& add(const MGKnot&);
64 MGKnotArray& add(double knot, int mult=1);
65 
67 const MGKnot& back() const{return m_ktArray.back();};
68 MGKnot& back(){return m_ktArray.back();};
69 
71 std::vector<MGKnot>::iterator begin(){return m_ktArray.begin();};
72 std::vector<MGKnot>::const_iterator begin() const{return m_ktArray.begin();};
73 
75 void clear(){m_ktArray.clear();};
76 
78 std::vector<MGKnot>::iterator end(){return m_ktArray.end();};
79 std::vector<MGKnot>::const_iterator end() const{return m_ktArray.end();};
80 
82 const MGKnot& front() const{return m_ktArray.front();};
83 MGKnot& front(){return m_ktArray.front();};
84 
85 void push_back(const MGKnot& knot){m_ktArray.push_back(knot);};
86 
88 int length() const {return int(m_ktArray.size());};
89 int size() const{return int(m_ktArray.size());};
90 
93 
96  int dump_size() const;
97 
99  int dump(MGOfstream& ) const;
100 
102  int restore(MGIfstream& );
103 
104 private:
105  std::vector<MGKnot> m_ktArray;
106 
107 };
108  // end of BASE group
110 #endif
MGKnotArray()
Dummy constructor.
Definition: KnotArray.h:39
void clear()
Clear all the elements in m_CCilist.
Definition: KnotArray.h:75
const MGKnot & back() const
Get the last element in the vector.
Definition: KnotArray.h:67
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
std::ostream & operator<<(std::ostream &ostrm, const MGisect &is)
Debug Function.
Definition: isect.h:95
std::vector< MGKnot >::const_iterator begin() const
Definition: KnotArray.h:72
std::vector< MGKnot >::iterator end()
Obtain the iterator of the first element.
Definition: KnotArray.h:78
int length() const
Return the number of items that are in the list.
Definition: KnotArray.h:88
MGKnot & operator[](int pos)
Definition: KnotArray.h:57
std::vector< MGKnot >::iterator begin()
Obtain the iterator of the first element.
Definition: KnotArray.h:71
~MGKnotArray()
Destructor.
Definition: KnotArray.h:50
std::vector< MGKnot >::const_iterator end() const
Definition: KnotArray.h:79
const MGKnot & operator[](int pos) const
[ ] reference.
Definition: KnotArray.h:55
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
int size() const
Definition: KnotArray.h:89
const MGKnot & front() const
Get the first element in the vector.
Definition: KnotArray.h:82
void push_back(const MGKnot &knot)
Definition: KnotArray.h:85
Defines Array of Knots.
Definition: KnotArray.h:26
MGKnot & back()
Definition: KnotArray.h:68
Defines knot value and its multiplicity.
Definition: Knot.h:20
MGKnot & front()
Definition: KnotArray.h:83