Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

PrimitiveDef.cc

Go to the documentation of this file.
00001 //                            Package   : omniIFR
00002 //  PrimitiveDef.cc           Created   : 2004/02/22
00003 //                            Author    : Alex Tingle
00004 //
00005 //    Copyright (C) 2004 Alex Tingle.
00006 //
00007 //    This file is part of the omniIFR application.
00008 //
00009 //    omniIFR is free software; you can redistribute it and/or
00010 //    modify it under the terms of the GNU Lesser General Public
00011 //    License as published by the Free Software Foundation; either
00012 //    version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //    omniIFR is distributed in the hope that it will be useful,
00015 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //    Lesser General Public License for more details.
00018 //
00019 //    You should have received a copy of the GNU Lesser General Public
00020 //    License along with this library; if not, write to the Free Software
00021 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 #include "PrimitiveDef.h"
00024 #include <assert.h>
00025 
00026 using namespace CORBA;
00027 
00028 namespace Omniifr {
00029 
00030 void PrimitiveDef_impl::destroy()
00031 {
00032   // Specification dictates the following exception:
00033   throw CORBA::BAD_INV_ORDER(
00034     IFELSE_OMNIORB4(omni::BAD_INV_ORDER_ObjectIndestructible,2),
00035     CORBA::COMPLETED_NO
00036   );
00037 }
00038 
00039 TypeCode_ptr PrimitiveDef_impl::type()
00040 {
00041   // cannot be pk_null
00042   switch(_kind)
00043   {
00044     case pk_null:       return TypeCode::_nil();
00045     case pk_void:       return TypeCode::_duplicate( _tc_void );
00046     case pk_short:      return TypeCode::_duplicate( _tc_short );
00047     case pk_long:       return TypeCode::_duplicate( _tc_long );
00048     case pk_ushort:     return TypeCode::_duplicate( _tc_ushort );
00049     case pk_ulong:      return TypeCode::_duplicate( _tc_ulong );
00050     case pk_float:      return TypeCode::_duplicate( _tc_float );
00051     case pk_double:     return TypeCode::_duplicate( _tc_double );
00052     case pk_boolean:    return TypeCode::_duplicate( _tc_boolean );
00053     case pk_char:       return TypeCode::_duplicate( _tc_char );
00054     case pk_octet:      return TypeCode::_duplicate( _tc_octet );
00055     case pk_any:        return TypeCode::_duplicate( _tc_any );
00056     case pk_TypeCode:   return TypeCode::_duplicate( _tc_TypeCode );
00057     case pk_Principal:  return TypeCode::_duplicate( _tc_Principal );
00058     case pk_string:     return TypeCode::_duplicate( _tc_string );
00059     case pk_objref:     return TypeCode::_duplicate( _tc_Object );
00060 #ifdef HAS_LongLong
00061     case pk_longlong:   return TypeCode::_duplicate( _tc_longlong );
00062     case pk_ulonglong:  return TypeCode::_duplicate( _tc_ulonglong );
00063 #endif
00064 #ifdef HAS_LongDouble
00065     case pk_longdouble: return TypeCode::_duplicate( _tc_longdouble );
00066 #endif
00067     case pk_wchar:      return TypeCode::_duplicate( _tc_wchar );
00068     case pk_wstring:    return TypeCode::_duplicate( _tc_wstring );
00069     case pk_value_base: throw NO_IMPLEMENT(); //?? return TypeCode::_duplicate( ?? );
00070 
00071     // Omit default in order that GCC's -Wall will tell us when cases are
00072     // missing.
00073   }
00074   assert(0);
00075   return TypeCode::_nil();
00076 }
00077 
00078 
00079 PrimitiveDef_impl::PrimitiveDef_impl(CORBA::PrimitiveKind kind)
00080 : _kind(kind)
00081 {
00082   switch(_kind)
00083   {
00084     case pk_null:       throw BAD_PARAM();
00085     case pk_void:       activateObjectWithId("pk_void"      ); break;
00086     case pk_short:      activateObjectWithId("pk_short"     ); break;
00087     case pk_long:       activateObjectWithId("pk_long"      ); break;
00088     case pk_ushort:     activateObjectWithId("pk_ushort"    ); break;
00089     case pk_ulong:      activateObjectWithId("pk_ulong"     ); break;
00090     case pk_float:      activateObjectWithId("pk_float"     ); break;
00091     case pk_double:     activateObjectWithId("pk_double"    ); break;
00092     case pk_boolean:    activateObjectWithId("pk_boolean"   ); break;
00093     case pk_char:       activateObjectWithId("pk_char"      ); break;
00094     case pk_octet:      activateObjectWithId("pk_octet"     ); break;
00095     case pk_any:        activateObjectWithId("pk_any"       ); break;
00096     case pk_TypeCode:   activateObjectWithId("pk_TypeCode"  ); break;
00097     case pk_Principal:  activateObjectWithId("pk_Principal" ); break;
00098     case pk_string:     activateObjectWithId("pk_string"    ); break;
00099     case pk_objref:     activateObjectWithId("pk_objref"    ); break;
00100 #ifdef HAS_LongLong
00101     case pk_longlong:   activateObjectWithId("pk_longlong"  ); break;
00102     case pk_ulonglong:  activateObjectWithId("pk_ulonglong" ); break;
00103 #endif
00104 #ifdef HAS_LongDouble
00105     case pk_longdouble: activateObjectWithId("pk_longdouble"); break;
00106 #endif
00107     case pk_wchar:      activateObjectWithId("pk_wchar"     ); break;
00108     case pk_wstring:    activateObjectWithId("pk_wstring"   ); break;
00109     case pk_value_base: throw NO_IMPLEMENT();
00110 
00111     // Omit default in order that GCC's -Wall will tell us when cases are
00112     // missing.
00113   }
00114 }
00115 
00116 } // end namespace Omniifr

Generated on Fri Mar 4 13:03:23 2005 for OmniIFR by  doxygen 1.4.1