source: dev/trunk/ab5.0/abdev/ab_common/include/Lexical/Parameter.h

Last change on this file was 829, checked in by イグトランス (egtra), 12 years ago

svn:eol-styleとsvn:mime-type(文字コード指定含む)の設定

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/plain; charset=Shift_JIS
File size: 3.0 KB
Line 
1#pragma once
2
3class Parameter : public Type
4{
5 std::string varName;
6 bool isRef;
7 bool isArray;
8 Subscripts subscripts;
9
10 std::string initValue;
11
12 // XMLシリアライズ用
13private:
14 friend class boost::serialization::access;
15 template<class Archive> void serialize(Archive& ar, const unsigned int version)
16 {
17 trace_for_serialize( "serializing - Parameter" );
18
19 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Type );
20 ar & BOOST_SERIALIZATION_NVP( varName );
21 ar & BOOST_SERIALIZATION_NVP( isRef );
22 ar & BOOST_SERIALIZATION_NVP( isArray );
23 ar & BOOST_SERIALIZATION_NVP( subscripts );
24 ar & BOOST_SERIALIZATION_NVP( initValue );
25 }
26
27public:
28 Parameter( const std::string &varName, const Type &type, bool isRef = false, const std::string initValue = "" );
29 Parameter( const Parameter &param, const Type &type );
30 Parameter( const Parameter &param );
31 Parameter(Parameter&& param)
32 : varName(std::move(param.varName))
33 , isRef(std::move(param.isRef))
34 , isArray(std::move(param.isArray))
35 , subscripts(std::move(param.subscripts))
36 , initValue(std::move(param.initValue)) {}
37 Parameter();
38 ~Parameter();
39
40 Parameter& operator =(Parameter&& y)
41 {
42 varName = std::move(y.varName);
43 isRef = std::move(y.isRef);
44 isArray = std::move(y.isArray);
45 subscripts = std::move(y.subscripts);
46 initValue = std::move(y.initValue);
47 return *this;
48 }
49
50 Parameter& operator =(Parameter const& y)
51 {
52 return *this = std::move(Parameter(y));
53 }
54
55 void SetArray( const Subscripts &subscripts ){
56 isArray = true;
57 this->subscripts = subscripts;
58 }
59
60 const std::string &GetVarName() const
61 {
62 return varName;
63 }
64
65 bool IsRef() const
66 {
67 return isRef;
68 }
69 bool IsArray() const
70 {
71 return isArray;
72 }
73 const Subscripts &GetSubscripts() const
74 {
75 return subscripts;
76 }
77
78 const std::string &GetInitValue() const
79 {
80 return initValue;
81 }
82
83 bool Equals( const Parameter &param, bool isContravariant ) const;
84 bool Equals( const Types &actualTypeParametersForThisProc, const Parameter &param, bool isContravariant ) const;
85};
86
87class Parameters : public std::vector<Parameter *>
88{
89 // XMLシリアライズ用
90private:
91 friend class boost::serialization::access;
92 template<class Archive> void serialize(Archive& ar, const unsigned int version)
93 {
94 trace_for_serialize( "serializing - Parameters" );
95
96 ar & boost::serialization::make_nvp("vector_Parameter", boost::serialization::base_object<std::vector<Parameter *>>(*this));
97 }
98
99public:
100 Parameters() : std::vector<Parameter *>() {}
101 Parameters(Parameters&& y) : std::vector<Parameter *>(std::move(y)) {}
102 Parameters(Parameters const& y) : std::vector<Parameter *>(y) {}
103
104 Parameters& operator =(Parameters&& y)
105 {
106 std::vector<Parameter *>::operator =(std::move(y));
107 return *this;
108 }
109
110 Parameters& operator =(Parameters const& y)
111 {
112 return *this = std::move(Parameters(y));
113 }
114
115 bool Equals( const Parameters &params, bool isContravariant = false ) const;
116 bool Equals( const Types &actualTypeParametersForThisProc, const Parameters &params, bool isContravariant = false ) const;
117
118 int GetMemorySize() const
119 {
120 return (int)this->size() * PTR_SIZE;
121 }
122};
Note: See TracBrowser for help on using the repository browser.