1 | #pragma once
|
---|
2 |
|
---|
3 | class 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シリアライズ用
|
---|
13 | private:
|
---|
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 |
|
---|
27 | public:
|
---|
28 | Parameter( const std::string &varName, const Type &type, bool isRef = false, const std::string initValue = "" ):
|
---|
29 | Type( type ),
|
---|
30 | varName( varName ),
|
---|
31 | isRef( isRef ),
|
---|
32 | isArray( false ),
|
---|
33 | initValue( initValue )
|
---|
34 | {
|
---|
35 | }
|
---|
36 | Parameter( const Parameter ¶m ):
|
---|
37 | Type( param ),
|
---|
38 | varName( param.varName ),
|
---|
39 | isRef( param.isRef ),
|
---|
40 | isArray( param.isArray ),
|
---|
41 | subscripts( param.subscripts ),
|
---|
42 | initValue( param.initValue )
|
---|
43 | {
|
---|
44 | }
|
---|
45 | Parameter()
|
---|
46 | {
|
---|
47 | }
|
---|
48 | ~Parameter(){}
|
---|
49 |
|
---|
50 | void SetArray( const Subscripts &subscripts ){
|
---|
51 | isArray = true;
|
---|
52 | this->subscripts = subscripts;
|
---|
53 | }
|
---|
54 |
|
---|
55 | const std::string &GetVarName() const
|
---|
56 | {
|
---|
57 | return varName;
|
---|
58 | }
|
---|
59 |
|
---|
60 | bool IsRef() const
|
---|
61 | {
|
---|
62 | return isRef;
|
---|
63 | }
|
---|
64 | bool IsArray(){
|
---|
65 | return isArray;
|
---|
66 | }
|
---|
67 | const Subscripts &GetSubscripts() const
|
---|
68 | {
|
---|
69 | return subscripts;
|
---|
70 | }
|
---|
71 |
|
---|
72 | const std::string &GetInitValue() const
|
---|
73 | {
|
---|
74 | return initValue;
|
---|
75 | }
|
---|
76 |
|
---|
77 | bool Equals( const Parameter ¶m, bool isContravariant ) const;
|
---|
78 | bool Equals( const Types &actualTypeParametersForThisProc, const Parameter ¶m, bool isContravariant ) const;
|
---|
79 | };
|
---|
80 |
|
---|
81 | class Parameters : public std::vector<Parameter *>
|
---|
82 | {
|
---|
83 | // XMLシリアライズ用
|
---|
84 | private:
|
---|
85 | friend class boost::serialization::access;
|
---|
86 | template<class Archive> void serialize(Archive& ar, const unsigned int version)
|
---|
87 | {
|
---|
88 | trace_for_serialize( "serializing - Parameters" );
|
---|
89 |
|
---|
90 | ar & boost::serialization::make_nvp("vector_Parameter", boost::serialization::base_object<std::vector<Parameter *>>(*this));
|
---|
91 | }
|
---|
92 |
|
---|
93 | public:
|
---|
94 |
|
---|
95 | bool Equals( const Parameters ¶ms, bool isContravariant = false ) const;
|
---|
96 | bool Equals( const Types &actualTypeParametersForThisProc, const Parameters ¶ms, bool isContravariant = false ) const;
|
---|
97 |
|
---|
98 | int GetMemorySize() const
|
---|
99 | {
|
---|
100 | return (int)this->size() * PTR_SIZE;
|
---|
101 | }
|
---|
102 |
|
---|
103 | bool Analyze( const char *sourceOfParams, int nowLine );
|
---|
104 |
|
---|
105 | std::string GetString() const;
|
---|
106 | };
|
---|