00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #if !defined( _OESS_1__SCHEME__IMPL__TYPES_IMPL_HPP_ )
00033 #define _OESS_1__SCHEME__IMPL__TYPES_IMPL_HPP_
00034
00035 #include <oess_1/scheme/h/declspec.hpp>
00036
00037 #include <deque>
00038 #include <map>
00039
00040 #include <auto_ptr_3/h/obj_ptr.hpp>
00041
00042 #include <smart_ref_3/h/smart_ref.hpp>
00043
00044 #include <oess_1/scheme/h/types.hpp>
00045
00046 #include <oess_1/scheme/impl/h/iface_refs.hpp>
00047
00048 namespace oess_1 {
00049
00050 namespace scheme {
00051
00052 namespace impl {
00053
00054
00055
00056
00057 class std_base_t :
00058 public base_t
00059 {
00060 public :
00062
00063 enum subclassing_mode_t
00064 {
00066 normal_subclassing,
00068 subclassing_by_extension
00069 };
00070
00072 std_base_t(
00073 const type_t & type,
00074 bool is_virtual );
00077
00078 std_base_t(
00079 const type_t & type,
00080 const subclassing_mode_t & subclassing_mode );
00081
00082 virtual ~std_base_t();
00083
00086 virtual const type_t &
00087 query_type() const;
00088
00089 virtual bool
00090 is_virtual() const;
00091
00092 virtual bool
00093 is_extension_of() const;
00095
00096 private :
00098 const type_t & m_type;
00100 bool m_is_virtual;
00102 subclassing_mode_t m_subclassing_mode;
00103 };
00104
00105
00106
00107
00108 class std_cpp_mapping_t :
00109 public cpp_mapping_t {
00110 public :
00111 std_cpp_mapping_t(
00112 const std::string & ddl_type_name );
00113 virtual ~std_cpp_mapping_t();
00114
00115
00116 void
00117 set_name( const std::string & name );
00118
00119
00120
00121
00122 virtual const std::string &
00123 query_name() const;
00124
00125 private :
00126
00127
00128 std::string m_name;
00129 };
00130
00131
00132
00133
00134 class std_attr_type_t :
00135 public attr_type_t {
00136 public :
00137 std_attr_type_t(
00138 const type_t & type );
00139 virtual ~std_attr_type_t();
00140
00141
00142 virtual const type_t &
00143 query_type() const;
00144
00145
00146 void
00147 set_type_kind(
00148 type_kind_t kind_id );
00149
00150 virtual type_kind_t
00151 query_type_kind() const;
00152
00153
00154 void
00155 set_cont_kind(
00156 const ref_attr_cont_kind_t & ref_kind );
00157
00158
00159 virtual const attr_cont_kind_t &
00160 query_cont_kind() const;
00161
00162 private :
00163 const type_t & m_type;
00164
00165
00166 type_kind_t m_type_kind;
00167
00168
00169 ref_attr_cont_kind_t m_ref_cont_kind;
00170 };
00171
00172
00173
00174
00175
00181 class std_attr_present_if_t
00182 : public attr_present_if_t
00183 {
00184 public :
00186 std_attr_present_if_t();
00187 virtual ~std_attr_present_if_t();
00188
00190 void
00191 set_cpp( const std::string & expr );
00192
00195 virtual const std::string &
00196 cpp() const
00197 throw( std::exception );
00198
00199 virtual bool
00200 is_cpp() const;
00202
00203 private :
00205
00209 std::string m_cpp;
00210 };
00211
00212
00213
00214
00215
00220 class std_attr_default_t
00221 : public attr_default_t
00222 {
00223 public :
00225
00229 std_attr_default_t(
00231 bool is_optional );
00232 virtual ~std_attr_default_t();
00233
00235 void
00236 set_cpp(
00237 const std::string & expr );
00238
00241
00244 std_attr_present_if_t &
00245 std_present_if()
00246 throw( std::exception );
00247
00250 virtual const std::string &
00251 cpp() const
00252 throw( std::exception );
00253
00254 virtual bool
00255 is_cpp() const;
00256
00257 virtual bool
00258 is_optional() const;
00259
00260 virtual const attr_present_if_t &
00261 present_if() const;
00263
00264 private :
00266
00267 std::string m_cpp;
00268
00270
00272 auto_ptr_3::obj_ptr_t< std_attr_present_if_t >
00273 m_present_if;
00274 };
00275
00276
00277
00278
00279
00283 class std_attr_t :
00284 public attr_t {
00285 public :
00286 std_attr_t(
00287
00288 const std::string & name,
00289
00290 const type_t & type,
00293 unsigned int extension_level );
00294 virtual ~std_attr_t();
00295
00298 virtual const std::string &
00299 query_name() const;
00300
00301 virtual const attr_type_t &
00302 query_attr_type() const;
00303
00304 virtual const attr_default_t *
00305 query_attr_default() const;
00306
00307 virtual unsigned int
00308 extension_level() const;
00310
00311
00312 void
00313 set_type_kind(
00314 attr_type_t::type_kind_t kind_id );
00315
00316
00317 void
00318 set_cont_kind(
00319 const ref_attr_cont_kind_t & ref_kind );
00320
00325 void
00326 make_std_attr_default(
00328 bool is_optional );
00329
00337 std_attr_default_t &
00338 std_attr_default();
00339
00340 private :
00342 std::string m_name;
00343
00345 std_attr_type_t m_type;
00346
00350 unsigned int m_extension_level;
00351
00358 auto_ptr_3::obj_ptr_t< std_attr_default_t > m_default;
00359 };
00360
00361
00362
00363
00364 SMART_REF_3_DECL_DERIVED_REF( std_attr_t, attr_t, class )
00365
00366
00367
00368
00369
00370
00373 class std_type_t :
00374 public type_t
00375 {
00376 public :
00377 std_type_t(
00378 const std::string & name,
00379
00380 bool is_builtin = false );
00381 virtual ~std_type_t();
00382
00385 virtual const std::string &
00386 query_name() const;
00387
00388 virtual bool
00389 is_defined() const;
00390
00392 void
00393 make_defined();
00394
00395 virtual bool
00396 is_builtin() const;
00397
00398 virtual bool
00399 is_abstract() const;
00400
00402 void
00403 make_abstract();
00404
00405 virtual bool
00406 is_extensible() const;
00407
00409
00410 void
00411 make_extensible();
00412
00413 virtual bool
00414 is_subclassing_by_extension() const;
00415
00420 void
00421 turn_subclassing_by_extension_on();
00422
00423 virtual bool
00424 is_derived_as_extension() const;
00425
00427
00429 void
00430 add_base(
00431 const ref_base_t & ref_base );
00432
00435
00443 void
00444 add_base_as_extension(
00445 const ref_base_t & base );
00446
00447 virtual size_t
00448 query_base_count() const;
00449
00450 virtual const base_t &
00451 query_base( size_t index ) const;
00452
00453 virtual const base_t *
00454 find_base( const std::string & name ) const;
00455
00457
00459 void
00460 add_attr(
00461 const ref_attr_t & ref_attr,
00465 unsigned int extension_level );
00466
00467 virtual size_t
00468 query_attr_count() const;
00469
00470 virtual const attr_t &
00471 query_attr( size_t index ) const;
00472
00473 virtual const attr_t *
00474 find_attr( const std::string & name ) const;
00475
00476 virtual const cpp_mapping_t &
00477 query_cpp_mapping() const;
00478
00479 virtual unsigned int
00480 extension_deep() const;
00481
00482 virtual unsigned int
00483 extension_attr_count( unsigned int extension ) const;
00484
00485 virtual const attr_t &
00486 extension_attr( unsigned int extension,
00487 unsigned int attr_index ) const;
00489
00491 std_cpp_mapping_t &
00492 query_cpp_mapping();
00493
00500 void
00501 start_extension();
00502
00503 public :
00505 std::string m_name;
00506
00508 bool m_is_defined;
00509
00511 bool m_is_builtin;
00512
00514 bool m_is_abstract;
00515
00522 bool m_is_extensible;
00523
00532 bool m_is_subclassing_by_extension;
00533
00535 typedef std::deque< ref_base_t >
00536 ref_base_deque_t;
00538 ref_base_deque_t m_bases;
00539
00541 typedef std::map< std::string, const base_t *,
00542 std::less< std::string > >
00543 bases_map_t;
00545 bases_map_t m_bases_map;
00546
00548 typedef std::deque< ref_attr_t >
00549 ref_attr_deque_t;
00551
00555 typedef std::deque< ref_attr_deque_t >
00556 attr_extension_deque_t;
00557
00559
00563 ref_attr_deque_t m_attrs;
00564
00566
00570 attr_extension_deque_t m_attr_extensions;
00571
00573 typedef std::map< std::string, const attr_t *,
00574 std::less< std::string > >
00575 attrs_map_t;
00577 attrs_map_t m_attrs_map;
00578
00580 std_cpp_mapping_t m_cpp_mapping;
00581
00590 bool m_is_derived_as_extension;
00591 };
00592
00593
00594
00595
00596 SMART_REF_3_DECL_DERIVED_REF( std_type_t, type_t, class )
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606 class map_base_kind_impl_t {
00607 public :
00608 map_base_kind_impl_t(
00609 const type_t & type );
00610 virtual ~map_base_kind_impl_t();
00611
00612
00613 virtual const type_t &
00614 query_key_type() const;
00615
00616 private :
00617 const type_t & m_type;
00618 };
00619
00620
00621
00622
00623 class std_stl_map_kind_t :
00624 public stl_map_kind_t,
00625 public map_base_kind_impl_t {
00626 public :
00627 std_stl_map_kind_t(
00628 const type_t & type );
00629 virtual ~std_stl_map_kind_t();
00630
00631
00632
00633
00634 virtual const type_t &
00635 query_key_type() const;
00636 };
00637
00638
00639
00640
00641 class std_stl_multimap_kind_t :
00642 public stl_multimap_kind_t,
00643 public map_base_kind_impl_t {
00644 public :
00645 std_stl_multimap_kind_t(
00646 const type_t & type );
00647 virtual ~std_stl_multimap_kind_t();
00648
00649
00650
00651
00652 virtual const type_t &
00653 query_key_type() const;
00654 };
00655
00656
00657
00658
00659 class std_fixed_vector_kind_t :
00660 public fixed_vector_kind_t {
00661 public :
00662 std_fixed_vector_kind_t(
00663 size_t capacity );
00664 virtual ~std_fixed_vector_kind_t();
00665
00666
00667 virtual size_t
00668 query_capacity() const;
00669
00670 private :
00671 size_t m_capacity;
00672 };
00673
00674 }
00675
00676 }
00677
00678 }
00679
00680 #endif