source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/include/Parameter.h@ 497

Last change on this file since 497 was 461, checked in by dai_9181, 17 years ago

smoothieプロジェクトが不要になったため、破棄。

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