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

Last change on this file since 756 was 632, checked in by dai_9181, 16 years ago

ジェネリッククラスの型パラメータに値型が指定されたときに限り、テンプレート展開を行うようにした。

TODO: libファイルを跨ってテンプレート展開ができていないため、ソースコード管理部分に手を加える必要あり。

File size: 2.2 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();
32 ~Parameter();
33
34 void SetArray( const Subscripts &subscripts ){
35 isArray = true;
36 this->subscripts = subscripts;
37 }
38
39 const std::string &GetVarName() const
40 {
41 return varName;
42 }
43
44 bool IsRef() const
45 {
46 return isRef;
47 }
48 bool IsArray(){
49 return isArray;
50 }
51 const Subscripts &GetSubscripts() const
52 {
53 return subscripts;
54 }
55
56 const std::string &GetInitValue() const
57 {
58 return initValue;
59 }
60
61 bool Equals( const Parameter &param, bool isContravariant ) const;
62 bool Equals( const Types &actualTypeParametersForThisProc, const Parameter &param, bool isContravariant ) const;
63};
64
65class Parameters : public std::vector<Parameter *>
66{
67 // XMLシリアライズ用
68private:
69 friend class boost::serialization::access;
70 template<class Archive> void serialize(Archive& ar, const unsigned int version)
71 {
72 trace_for_serialize( "serializing - Parameters" );
73
74 ar & boost::serialization::make_nvp("vector_Parameter", boost::serialization::base_object<std::vector<Parameter *>>(*this));
75 }
76
77public:
78
79 bool Equals( const Parameters &params, bool isContravariant = false ) const;
80 bool Equals( const Types &actualTypeParametersForThisProc, const Parameters &params, bool isContravariant = false ) const;
81
82 int GetMemorySize() const
83 {
84 return (int)this->size() * PTR_SIZE;
85 }
86};
Note: See TracBrowser for help on using the repository browser.