source: dev/trunk/abdev/BasicCompiler_Common/include/Parameter.h@ 396

Last change on this file since 396 was 383, checked in by dai_9181, 17 years ago

ジェネリクスインターフェイス実装時のオーバーロード解決ロジックを改良。(型パラメータを引数に持つメソッドのオーバーロードをミスしてしまうバグを修正)

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