Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / Unbounded_Value_Sequence_T.h
blobb190d90e54ac73d8c03a952c0f2ce1446aa29d63
1 #ifndef guard_unbounded_value_sequence_hpp
2 #define guard_unbounded_value_sequence_hpp
3 /**
4 * @file
6 * @brief Implement unbounded sequences for types with value-like
7 * semantics.
9 * @author Carlos O'Ryan
12 #include "tao/Unbounded_Value_Allocation_Traits_T.h"
13 #include "tao/Value_Traits_T.h"
14 #include "tao/Generic_Sequence_T.h"
16 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
18 namespace TAO
20 template<class T, class Tag=int>
21 class unbounded_value_sequence
23 public:
24 typedef T value_type;
25 typedef T element_type;
26 typedef T const const_value_type;
27 typedef value_type & subscript_type;
28 typedef value_type const & const_subscript_type;
29 typedef ::CORBA::ULong size_type;
31 typedef details::unbounded_value_allocation_traits<value_type,true> allocation_traits;
32 typedef details::value_traits<value_type,true> element_traits;
33 typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type;
35 inline unbounded_value_sequence()
36 : impl_()
38 inline explicit unbounded_value_sequence(CORBA::ULong maximum)
39 : impl_(maximum)
41 inline unbounded_value_sequence(
42 CORBA::ULong maximum,
43 CORBA::ULong length,
44 value_type * data,
45 CORBA::Boolean release = false)
46 : impl_(maximum, length, data, release)
48 /* Use default ctor, operator= and dtor */
49 inline CORBA::ULong maximum() const {
50 return impl_.maximum();
52 inline CORBA::Boolean release() const {
53 return impl_.release();
55 inline CORBA::ULong length() const {
56 return impl_.length();
58 inline void length(CORBA::ULong length) {
59 impl_.length(length);
61 inline value_type const & operator[](CORBA::ULong i) const {
62 return impl_[i];
64 inline value_type & operator[](CORBA::ULong i) {
65 return impl_[i];
67 inline void replace(
68 CORBA::ULong maximum,
69 CORBA::ULong length,
70 value_type * data,
71 CORBA::Boolean release = false) {
72 impl_.replace(maximum, length, data, release);
74 inline value_type const * get_buffer() const {
75 return impl_.get_buffer();
77 inline value_type * get_buffer(CORBA::Boolean orphan = false) {
78 return impl_.get_buffer(orphan);
80 inline void swap(unbounded_value_sequence & rhs) noexcept {
81 impl_.swap(rhs.impl_);
83 static value_type * allocbuf(CORBA::ULong maximum) {
84 return implementation_type::allocbuf(maximum);
86 static void freebuf(value_type * buffer) {
87 implementation_type::freebuf(buffer);
90 private:
91 implementation_type impl_;
93 } // namespace TAO
95 TAO_END_VERSIONED_NAMESPACE_DECL
97 #endif // guard_unbounded_string_sequence_hpp