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
00037 #if !defined( _OESS_1__SCHEME__SCHEME_HPP_ )
00038 #define _OESS_1__SCHEME__SCHEME_HPP_
00039
00040 #include <oess_1/scheme/h/declspec.hpp>
00041
00042 #include <oess_1/scheme/h/types.hpp>
00043
00044 namespace oess_1 {
00045
00046 namespace scheme {
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00086 class OESS_1__SCHEME__TYPE attr_editor_t
00087 {
00088 public :
00089 virtual ~attr_editor_t();
00090
00092
00093 virtual void
00094 make_ptr_kind() = 0;
00095
00097
00101 virtual void
00102 make_extension_kind() = 0;
00103
00104
00105 virtual void
00106 make_single_obj_kind() = 0;
00107
00108 virtual void
00109 make_stl_vector_kind() = 0;
00110
00111 virtual void
00112 make_stl_list_kind() = 0;
00113
00114 virtual void
00115 make_stl_deque_kind() = 0;
00116
00117 virtual void
00118 make_stl_set_kind() = 0;
00119
00120 virtual void
00121 make_stl_multiset_kind() = 0;
00122
00123
00124 virtual void
00125 make_stl_map_kind(
00126 const std::string & key_type_name ) = 0;
00127
00128
00129 virtual void
00130 make_stl_multimap_kind(
00131 const std::string & key_type_name ) = 0;
00132
00133 virtual void
00134 make_fixed_vector_kind(
00135 size_t capacity ) = 0;
00136
00142 virtual void
00143 set_default_existence(
00145 bool is_optional ) = 0;
00146
00154 virtual void
00155 set_cpp_default(
00156 const std::string & expr ) = 0;
00157
00169 virtual void
00170 set_cpp_present_if(
00171 const std::string & expr ) = 0;
00172 };
00173
00174
00175
00176
00177
00181 class OESS_1__SCHEME__TYPE cpp_mapping_editor_t {
00182 public :
00183 virtual ~cpp_mapping_editor_t();
00184
00185 virtual void
00186 set_name( const std::string & name ) = 0;
00187 };
00188
00189
00190
00191
00192
00196 class OESS_1__SCHEME__TYPE type_editor_t {
00197 public :
00198 virtual ~type_editor_t();
00199
00201 virtual void
00202 make_abstract() = 0;
00203
00208 virtual void
00209 make_extensible() = 0;
00210
00212
00213 virtual void
00214 add_base(
00215 const std::string & name,
00216 bool is_virtual ) = 0;
00217
00220
00228 virtual void
00229 add_base_as_extension(
00230 const std::string & name ) = 0;
00231
00233
00237 virtual attr_editor_t &
00238 start_attr_def(
00240 const std::string & attr_name,
00242 const std::string & type_name ) = 0;
00243
00246
00249 virtual void
00250 commit_attr_def() = 0;
00251
00253
00255 virtual void
00256 rollback_attr_def() = 0;
00257
00260 virtual cpp_mapping_editor_t &
00261 cpp_mapping() = 0;
00262
00274 virtual void
00275 start_extension() = 0;
00276
00281 virtual void
00282 turn_subclassing_by_extension_on() = 0;
00283 };
00284
00285
00286
00287
00288
00292 class OESS_1__SCHEME__TYPE scheme_t {
00293 public :
00294 virtual ~scheme_t();
00295
00301 virtual size_t
00302 query_type_count() const = 0;
00303
00309 virtual const type_t &
00310 query_type( size_t index ) const = 0;
00311
00317 virtual const type_t *
00318 find_type( const std::string & name ) const = 0;
00319
00327 virtual type_editor_t &
00328 start_type_def(
00329 const std::string & name ) = 0;
00330
00338 virtual void
00339 commit_type_def() = 0;
00340
00346 virtual void
00347 rollback_type_def() = 0;
00348 };
00349
00350
00351
00352
00353 class pseudo_type_list_t {
00354 private :
00355 const scheme_t & m_scheme;
00356
00357 public :
00358 inline
00359 pseudo_type_list_t( const scheme_t & sch ) :
00360 m_scheme( sch )
00361 {
00362 }
00363
00364 class const_iterator
00365 : public std::iterator< std::forward_iterator_tag, type_t > {
00366 friend class pseudo_type_list_t;
00367 private :
00368 const scheme_t * m_scheme;
00369 size_t m_index;
00370
00371 inline
00372 const_iterator(
00373 const scheme_t & sch,
00374 size_t index ) :
00375 m_scheme( &sch ),
00376 m_index( index )
00377 {
00378 }
00379
00380 public :
00381 inline
00382 const_iterator() :
00383 m_scheme( 0 ),
00384 m_index( 0 )
00385 {
00386 }
00387
00388 inline
00389 const_iterator(
00390 const const_iterator & o ) :
00391 m_scheme( o.m_scheme ),
00392 m_index( o.m_index )
00393 {
00394 }
00395
00396 inline const type_t &
00397 operator*() const {
00398 return m_scheme->query_type( m_index );
00399 }
00400
00401 bool
00402 operator==( const const_iterator & o ) const {
00403 return ( m_scheme == o.m_scheme && m_index == o.m_index );
00404 }
00405
00406 bool
00407 operator!=( const const_iterator & o ) const {
00408 return ( m_scheme != o.m_scheme || m_index != o.m_index );
00409 }
00410
00411 const_iterator&
00412 operator++() {
00413 ++m_index;
00414 return *this;
00415 }
00416
00417 const_iterator
00418 operator++( int ) {
00419 return const_iterator( *m_scheme, m_index++ );
00420 }
00421 };
00422
00423 inline const_iterator
00424 begin() const {
00425 return const_iterator( m_scheme, 0 );
00426 }
00427
00428 inline const_iterator
00429 end() const {
00430 return const_iterator( m_scheme, m_scheme.query_type_count() );
00431 }
00432 };
00433
00434
00435
00436
00437
00442 class OESS_1__SCHEME__TYPE scheme_auto_ptr_t {
00443 public :
00444 scheme_auto_ptr_t();
00445 ~scheme_auto_ptr_t();
00446
00447 scheme_t &
00448 operator*();
00449
00450 const scheme_t &
00451 operator*() const;
00452
00453 scheme_t *
00454 operator->();
00455
00456 const scheme_t *
00457 operator->() const;
00458
00459 scheme_t *
00460 query();
00461
00462 const scheme_t *
00463 query() const;
00464
00465 private :
00466 scheme_t * m_scheme;
00467 };
00468
00469
00470
00471
00472
00478 class OESS_1__SCHEME__TYPE attr_editor_auto_ptr_t {
00479 public :
00480 attr_editor_auto_ptr_t(
00481 type_editor_t & type_editor,
00482 const std::string & attr_name,
00483 const std::string & type_name );
00484 ~attr_editor_auto_ptr_t();
00485
00486 attr_editor_t &
00487 operator*();
00488
00489 const attr_editor_t &
00490 operator*() const;
00491
00492 attr_editor_t *
00493 operator->();
00494
00495 const attr_editor_t *
00496 operator->() const;
00497
00498 attr_editor_t *
00499 query();
00500
00501 const attr_editor_t *
00502 query() const;
00503
00513 void
00514 commit();
00515
00525 void
00526 rollback();
00527
00528 private :
00529 type_editor_t & m_type_editor;
00530 attr_editor_t * m_attr_editor;
00531 };
00532
00533
00534
00535
00536
00542 class OESS_1__SCHEME__TYPE type_editor_auto_ptr_t {
00543 public :
00544 type_editor_auto_ptr_t(
00545 scheme_t & scheme,
00546 const std::string & type_name );
00547 ~type_editor_auto_ptr_t();
00548
00549 type_editor_t &
00550 operator*();
00551
00552 const type_editor_t &
00553 operator*() const;
00554
00555 type_editor_t *
00556 operator->();
00557
00558 const type_editor_t *
00559 operator->() const;
00560
00561 type_editor_t *
00562 query();
00563
00564 const type_editor_t *
00565 query() const;
00566
00576 void
00577 commit();
00578
00588 void
00589 rollback();
00590
00591 private :
00592 scheme_t & m_scheme;
00593 type_editor_t * m_type_editor;
00594 };
00595
00596 }
00597
00598 }
00599
00600 #endif
00601