00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "ExceptionDef.h"
00024
00025 #include "Repository.h"
00026 #include "idltype.h"
00027 #include "PersistNode.h"
00028
00029 namespace Omniifr {
00030
00031 TypeCode_ptr ExceptionDef_impl::type()
00032 {
00033 return Repository_impl::inst()._orb
00034 ->create_exception_tc(_id.in(),_name.in(),_members.in());
00035 }
00036
00037 StructMemberSeq* ExceptionDef_impl::members()
00038 {
00039 return _members.copy();
00040 }
00041
00042 void ExceptionDef_impl::members(const StructMemberSeq& v)
00043 {
00044 checkReadonly();
00045
00046
00047 StructMemberSeq temp(v);
00048 for(ULong i=0; i<temp.length(); i++)
00049 {
00050 if(CORBA::is_nil(temp[i].type_def))
00051 throw CORBA::BAD_PARAM(
00052 IFELSE_OMNIORB4(omni::BAD_PARAM_InvalidObjectRef,43),
00053 CORBA::COMPLETED_NO
00054 );
00055 try {
00056 temp[i].type=temp[i].type_def->type();
00057 }
00058 catch(...) {
00059 DB(15,"Caught exception at "<<__FILE__<<":"<<__LINE__)
00060 throw;
00061 }
00062 }
00063
00064 _members.assign(temp);
00065 }
00066
00067 CORBA::Contained::Description* ExceptionDef_impl::describe()
00068 {
00069 ExceptionDescription_var desc =new ExceptionDescription();
00070 desc->name = name();
00071 desc->id = id();
00072 desc->defined_in = definedInId();
00073 desc->version = version();
00074 desc->type = type();
00075
00076 CORBA::Contained::Description_var description =
00077 new CORBA::Contained::Description();
00078 description->kind = def_kind();
00079 description->value <<= desc._retn();
00080
00081 return description._retn();
00082 }
00083
00084 void ExceptionDef_impl::uncheckedDestroy()
00085 {
00086 _members.clear();
00087 Contained_impl::uncheckedDestroy();
00088 Container_impl::uncheckedDestroy();
00089 }
00090
00091 bool ExceptionDef_impl::canContain(DefinitionKind kind)
00092 {
00093 switch(kind)
00094 {
00095 case dk_Struct:
00096 case dk_Union:
00097 case dk_Enum:
00098 return true;
00099 default:
00100 return false;
00101 }
00102 }
00103
00104 void ExceptionDef_impl::reincarnate(const PersistNode& node)
00105 {
00106 cdrMemoryStream memstr =node.attrCdrStream("state");
00107 StructMemberSeq m;
00108 m<<=memstr;
00109 _members.uncheckedAssign(m);
00110 }
00111
00112 void ExceptionDef_impl::output(ostream &os)
00113 {
00114 outputSelf(os,"ExceptionDef");
00115 cdrMemoryStream memstr(CORBA::ULong(0),CORBA::Boolean(1));
00116 _members.in()>>=memstr;
00117 PersistNode::outputCdrMemoryStream(os,memstr,"\n state=");
00118 os<<" ;;\n";
00119 outputContents(os);
00120 }
00121
00122 }