DynCommon.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    DynCommon.h
00006  *
00007  *  $Id: DynCommon.h 77779 2007-03-23 11:48:02Z johnnyw $
00008  *
00009  *  @author Jeff Parsons <parsons@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef TAO_DYNCOMMON_H
00015 #define TAO_DYNCOMMON_H
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "tao/DynamicAny/DynamicAny.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00025 
00026 /**
00027  * @class TAO_DynCommon
00028  *
00029  * Contains most of the functionality common to all the
00030  * Dynamic Any implementation classes.
00031  */
00032 class TAO_DynamicAny_Export TAO_DynCommon
00033   : public virtual DynamicAny::DynAny
00034 {
00035 public:
00036   /// Constructor.
00037   TAO_DynCommon (void);
00038 
00039   /// Destructor.
00040   virtual ~TAO_DynCommon (void);
00041 
00042   // = Some functions common to all Dynamic Any types.
00043 
00044   virtual CORBA::TypeCode_ptr type (void);
00045 
00046   virtual void assign (DynamicAny::DynAny_ptr dyn_any);
00047 
00048   virtual void insert_boolean (CORBA::Boolean value);
00049 
00050   virtual void insert_octet (CORBA::Octet value);
00051 
00052   virtual void insert_char (CORBA::Char value);
00053   virtual void insert_short (CORBA::Short value);
00054   virtual void insert_ushort (CORBA::UShort value);
00055 
00056   virtual void insert_long (CORBA::Long value);
00057 
00058   virtual void insert_ulong (CORBA::ULong value);
00059 
00060   virtual void insert_float (CORBA::Float value);
00061 
00062   virtual void insert_double (CORBA::Double value);
00063 
00064   virtual void insert_string (const char * value);
00065 
00066   virtual void insert_reference (CORBA::Object_ptr value);
00067 
00068   virtual void insert_typecode (CORBA::TypeCode_ptr value);
00069 
00070   virtual void insert_longlong (CORBA::LongLong value);
00071 
00072   virtual void insert_ulonglong (CORBA::ULongLong value);
00073 
00074   virtual void insert_longdouble (CORBA::LongDouble value);
00075 
00076   virtual void insert_wchar (CORBA::WChar value);
00077 
00078   virtual void insert_wstring (const CORBA::WChar * value);
00079 
00080   virtual void insert_any (const CORBA::Any & value);
00081 
00082   virtual void insert_dyn_any (DynamicAny::DynAny_ptr value);
00083 
00084   virtual void insert_val (CORBA::ValueBase * value);
00085 
00086   virtual CORBA::Boolean get_boolean (void);
00087 
00088   virtual CORBA::Octet get_octet (void);
00089 
00090   virtual CORBA::Char get_char (void);
00091 
00092   virtual CORBA::Short get_short (void);
00093 
00094   virtual CORBA::UShort get_ushort (void);
00095 
00096   virtual CORBA::Long get_long (void);
00097 
00098   virtual CORBA::ULong get_ulong (void);
00099 
00100   virtual CORBA::Float get_float (void);
00101 
00102   virtual CORBA::Double get_double (void);
00103 
00104   virtual char * get_string (void);
00105 
00106   virtual CORBA::Object_ptr get_reference (void);
00107 
00108   virtual CORBA::TypeCode_ptr get_typecode (void);
00109 
00110   virtual CORBA::LongLong get_longlong (void);
00111 
00112   virtual CORBA::ULongLong get_ulonglong (void);
00113 
00114   virtual CORBA::LongDouble get_longdouble (void);
00115 
00116   virtual CORBA::WChar get_wchar (void);
00117 
00118   virtual CORBA::WChar * get_wstring (void);
00119 
00120   virtual CORBA::Any * get_any (void);
00121 
00122   virtual DynamicAny::DynAny_ptr get_dyn_any (void);
00123 
00124   virtual CORBA::ValueBase * get_val (void);
00125 
00126   virtual CORBA::Boolean seek (CORBA::Long index);
00127 
00128   virtual void rewind (void);
00129 
00130   virtual CORBA::Boolean next (void);
00131 
00132   virtual DynamicAny::DynAny_ptr copy (void);
00133 
00134   virtual CORBA::ULong component_count (void);
00135 
00136   virtual void insert_abstract (CORBA::AbstractBase_ptr value);
00137 
00138   virtual CORBA::AbstractBase_ptr get_abstract (void);
00139 
00140   virtual void insert_boolean_seq (const CORBA::BooleanSeq & value);
00141 
00142   virtual void insert_octet_seq (const CORBA::OctetSeq & value);
00143 
00144   virtual void insert_char_seq (const CORBA::CharSeq & value);
00145 
00146   virtual void insert_short_seq (const CORBA::ShortSeq & value);
00147 
00148   virtual void insert_ushort_seq (const CORBA::UShortSeq & value);
00149 
00150   virtual void insert_long_seq (const CORBA::LongSeq & value);
00151 
00152   virtual void insert_ulong_seq (const CORBA::ULongSeq & value);
00153 
00154   virtual void insert_float_seq (const CORBA::FloatSeq & value);
00155 
00156   virtual void insert_double_seq (const CORBA::DoubleSeq & value);
00157 
00158   virtual void insert_longlong_seq (const CORBA::LongLongSeq & value);
00159 
00160   virtual void insert_ulonglong_seq (const CORBA::ULongLongSeq & value);
00161 
00162   virtual void insert_longdouble_seq (const CORBA::LongDoubleSeq & value);
00163 
00164   virtual void insert_wchar_seq (const CORBA::WCharSeq & value);
00165 
00166   virtual CORBA::BooleanSeq * get_boolean_seq (void);
00167 
00168   virtual CORBA::OctetSeq * get_octet_seq (void);
00169 
00170   virtual CORBA::CharSeq * get_char_seq (void);
00171 
00172   virtual CORBA::ShortSeq * get_short_seq (void);
00173 
00174   virtual CORBA::UShortSeq * get_ushort_seq (void);
00175 
00176   virtual CORBA::LongSeq * get_long_seq (void);
00177 
00178   virtual CORBA::ULongSeq * get_ulong_seq (void);
00179 
00180   virtual CORBA::FloatSeq * get_float_seq (void);
00181 
00182   virtual CORBA::DoubleSeq * get_double_seq (void);
00183 
00184   virtual CORBA::LongLongSeq * get_longlong_seq (void);
00185 
00186   virtual CORBA::ULongLongSeq * get_ulonglong_seq (void);
00187 
00188   virtual CORBA::LongDoubleSeq * get_longdouble_seq (void);
00189 
00190   virtual CORBA::WCharSeq * get_wchar_seq (void);
00191 
00192   /// This sets one of two flags in this base class. CORBA 2.4.2
00193   /// requires that destroy() do nothing if it is called on
00194   /// the result of current_component(), the only non-deep-copying
00195   /// method in the Dynamic Any API. If the boolean arg below is 0,
00196   /// the call is from inside current_component(), and the flag
00197   /// ref_to_component_ is set. If the boolean arg is 1, the call
00198   /// is from inside destroy(), and the container_is_destroying_
00199   /// flag is set, overriding the first flag in the component's
00200   /// destroy() method.
00201   void set_flag (DynamicAny::DynAny_ptr component, CORBA::Boolean destroying);
00202 
00203   // Utility functions.
00204 
00205   DynamicAny::DynAny_ptr check_component (void);
00206 
00207   void check_type (CORBA::TypeCode_ptr tc);
00208 
00209   static bool is_basic_type_seq (CORBA::TypeCode_ptr tc);
00210 
00211   // Accessors
00212 
00213   CORBA::Boolean has_components (void) const;
00214   CORBA::Boolean destroyed (void) const;
00215   CORBA::Any &the_any (void);
00216 
00217   // Mutators
00218 
00219   void container_is_destroying (CORBA::Boolean val);
00220   void ref_to_component (CORBA::Boolean val);
00221 
00222 protected:
00223   /// Were we created by current_component()?
00224   CORBA::Boolean ref_to_component_;
00225 
00226   /// Flag to let destroy() call by container override the flag above.
00227   CORBA::Boolean container_is_destroying_;
00228 
00229   /// Do we contain other Dynamic Anys?
00230   CORBA::Boolean has_components_;
00231 
00232   /// Has destroy() been called on us yet?
00233   CORBA::Boolean destroyed_;
00234 
00235   /// Slot of the current component (if any).
00236   CORBA::Long current_position_;
00237 
00238   /// Number of components, as defined by CORBA 2.4.2.
00239   CORBA::ULong component_count_;
00240 
00241   /// Holder for our type code.
00242   CORBA::TypeCode_var type_;
00243 
00244   /// Gets a value only for basic types, but used in insert_*
00245   /// and get_*, defined in this base class.
00246   CORBA::Any any_;
00247 
00248 private:
00249   // Utility functions used by insert_* and get_*.
00250 
00251   CORBA::TypeCode_ptr check_type_and_unalias (CORBA::TypeCode_ptr tc);
00252 };
00253 
00254 TAO_END_VERSIONED_NAMESPACE_DECL
00255 
00256 #include /**/ "ace/post.h"
00257 #endif /* TAO_DYNCOMMON_H */

Generated on Tue Feb 2 17:43:10 2010 for TAO_DynamicAny by  doxygen 1.4.7