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

Omniifr::OperationDef_impl Class Reference

#include <OperationDef.h>

Inheritance diagram for Omniifr::OperationDef_impl:

Inheritance graph
[legend]
Collaboration diagram for Omniifr::OperationDef_impl:

Collaboration graph
[legend]
List of all members.

Public Member Functions

TypeCode_ptr result ()
IDLType_ptr result_def ()
void result_def (IDLType_ptr v)
ParDescriptionSeq * params ()
void params (const ParDescriptionSeq &v)
OperationMode mode ()
void mode (OperationMode v)
ContextIdSeq * contexts ()
void contexts (const ContextIdSeq &v)
ExceptionDefSeq * exceptions ()
void exceptions (const ExceptionDefSeq &v)
DefinitionKind def_kind ()
CORBA::Contained::Description * describe ()
 OperationDef_impl ()
virtual ~OperationDef_impl ()
void uncheckedDestroy ()
 Destroys this object, without first checking for dependencies.
void reincarnate (const PersistNode &node)
 Re-create the repository from information saved in the log file.
void output (ostream &os)
 Save this object's state to a stream.

Private Member Functions

void checkOneway (const OperationMode mode, const ParDescriptionSeq &params, IDLType_ptr result_def) const
 Tests for a violation of the rules on oneway operations.

Private Attributes

TypeCode_var _result
 set from _result_def
Dependency1< IDLType > _result_def
Dependency3< ParDescriptionSeq > _params
OperationMode _mode
ContextIdSeq _contexts
Dependency2< ExceptionDefSeq > _exceptions
ExcDescriptionSeq _excDescriptionSeq
 set from _exceptions

Constructor & Destructor Documentation

Omniifr::OperationDef_impl::OperationDef_impl  )  [inline]
 

Definition at line 66 of file OperationDef.h.

References _contexts, _excDescriptionSeq, _exceptions, _mode, _params, _result, and _result_def.

00066                      :
00067     _result(),
00068     _result_def(this),
00069     _params(this),
00070     _mode(CORBA::OP_NORMAL),
00071     _contexts(),
00072     _exceptions(this),
00073     _excDescriptionSeq()
00074   {}
  virtual ~OperationDef_impl() {}

virtual Omniifr::OperationDef_impl::~OperationDef_impl  )  [inline, virtual]
 

Definition at line 75 of file OperationDef.h.

00075 {}


Member Function Documentation

void Omniifr::OperationDef_impl::checkOneway const OperationMode  mode,
const ParDescriptionSeq &  params,
IDLType_ptr  result_def
const [private]
 

Tests for a violation of the rules on oneway operations.

If a violation is found, then raises BAD_PARAM(31), else does nothing.

Definition at line 190 of file OperationDef.cc.

References params().

Referenced by mode(), params(), and result_def().

00195 {
00196   // Only worry about oneway operations.
00197   // If result_def is not yet set, then don't perform the check. This should
00198   // only happen during a call to InterfaceDef_impl::create_operation().
00199   if(mode==OP_ONEWAY && !CORBA::is_nil(result_def))
00200   {
00201     // Return type must be void.
00202     TypeCode_var resultTc =result_def->type();
00203     if(resultTc->kind()!=tk_void)
00204         throw CORBA::BAD_PARAM(31,CORBA::COMPLETED_NO);
00205 
00206     // Parameters' modes must be PARAM_IN.
00207     for(ULong i=0; i<params.length(); ++i)
00208     {
00209       if(params[i].mode!=PARAM_IN)
00210         throw CORBA::BAD_PARAM(31,CORBA::COMPLETED_NO);
00211     }
00212   }
00213 }

void Omniifr::OperationDef_impl::contexts const ContextIdSeq &  v  ) 
 

Definition at line 88 of file OperationDef.cc.

References _contexts, and Omniifr::IRObject_impl::checkReadonly().

00089 {
00090   checkReadonly();
00091   _contexts=v;
00092 }

ContextIdSeq * Omniifr::OperationDef_impl::contexts  ) 
 

Definition at line 83 of file OperationDef.cc.

References _contexts.

00084 {
00085   return new ContextIdSeq(_contexts);
00086 }

DefinitionKind Omniifr::OperationDef_impl::def_kind  )  [inline, virtual]
 

Implements Omniifr::IRObject_impl.

Definition at line 52 of file OperationDef.h.

Referenced by describe().

00052 {return CORBA::dk_Operation;}

CORBA::Contained::Description * Omniifr::OperationDef_impl::describe  )  [virtual]
 

Implements Omniifr::Contained_impl.

Definition at line 126 of file OperationDef.cc.

References _contexts, _excDescriptionSeq, _mode, _params, def_kind(), Omniifr::Contained_impl::definedInId(), Omniifr::Contained_impl::id(), Omniifr::Dependency3< T_xxxDescriptionSeq >::in(), Omniifr::Contained_impl::name(), result(), and Omniifr::Contained_impl::version().

00127 {
00128   OperationDescription_var desc =new OperationDescription();
00129   desc->name       = name();
00130   desc->id         = id();
00131   desc->version    = version();
00132   desc->result     = result();
00133   desc->mode       = _mode;
00134   desc->contexts   = _contexts;
00135   desc->parameters = _params.in();
00136   desc->exceptions = _excDescriptionSeq;
00137   desc->defined_in = definedInId();
00138 
00139   CORBA::Contained::Description_var description =
00140     new CORBA::Contained::Description();
00141   description->kind  =   def_kind();
00142   description->value <<= desc._retn();
00143 
00144   return description._retn();
00145 }

void Omniifr::OperationDef_impl::exceptions const ExceptionDefSeq &  v  ) 
 

Definition at line 99 of file OperationDef.cc.

References _excDescriptionSeq, _exceptions, Omniifr::Dependency2< T_IRObjectSeq >::assign(), Omniifr::IRObject_impl::checkReadonly(), and IFELSE_OMNIORB4.

00100 {
00101   checkReadonly();
00102   // Construct a new ExcDescriptionSeq, ready to assign to _excDescriptionSeq.
00103   // (Checks for problems before we do anything irrevocable.)
00104   ExcDescriptionSeq eds;
00105   eds.length(v.length());
00106   for(CORBA::ULong i=0; i<v.length(); i++)
00107   {
00108     CORBA::Contained::Description_var description =v[i]->describe();
00109     const ExceptionDescription* exceptionDescription;
00110     Boolean ok( description->value >>= exceptionDescription );
00111     if(!ok)
00112         throw CORBA::BAD_PARAM(
00113           IFELSE_OMNIORB4(omni::BAD_PARAM_EnumValueOutOfRange,25),
00114           CORBA::COMPLETED_NO
00115         );
00116     eds[i]=*exceptionDescription; // take a copy
00117     // No need to delete exceptionDescription - it's still owned by the Any.
00118   }
00119   // Perform the following two assignments in the correct order to ensure that
00120   // both _exceptions & _excDescriptionSeq remain untouched if an exception
00121   // occurs.
00122   _exceptions.assign(v); // may throw BAD_PARAM
00123   _excDescriptionSeq=eds; // does not throw.
00124 }

ExceptionDefSeq * Omniifr::OperationDef_impl::exceptions  ) 
 

Definition at line 94 of file OperationDef.cc.

References _exceptions, and Omniifr::Dependency2< T_IRObjectSeq >::copy().

00095 {
00096   return _exceptions.copy();
00097 }

void Omniifr::OperationDef_impl::mode OperationMode  v  ) 
 

Definition at line 71 of file OperationDef.cc.

References _mode, _params, _result_def, checkOneway(), Omniifr::IRObject_impl::checkReadonly(), IFELSE_OMNIORB4, Omniifr::Dependency1< T_IRObject >::in(), and Omniifr::Dependency3< T_xxxDescriptionSeq >::in().

00072 {
00073   checkReadonly();
00074   if(v!=OP_NORMAL && v!=OP_ONEWAY)
00075       throw CORBA::BAD_PARAM(
00076         IFELSE_OMNIORB4(omni::BAD_PARAM_EnumValueOutOfRange,25),
00077         CORBA::COMPLETED_NO
00078       );
00079   checkOneway(v,_params.in(),_result_def.in());
00080   _mode=v;
00081 }

OperationMode Omniifr::OperationDef_impl::mode  ) 
 

Definition at line 66 of file OperationDef.cc.

References _mode.

00067 {
00068   return _mode;
00069 }

void Omniifr::OperationDef_impl::output ostream &  os  )  [virtual]
 

Save this object's state to a stream.

Implements Omniifr::IRObject_impl.

Definition at line 175 of file OperationDef.cc.

References _contexts, _excDescriptionSeq, _exceptions, _mode, _params, _result, _result_def, Omniifr::Dependency2< T_IRObjectSeq >::in(), Omniifr::Dependency3< T_xxxDescriptionSeq >::in(), Omniifr::Dependency1< T_IRObject >::in(), and Omniifr::Contained_impl::outputSelf().

00176 {
00177   outputSelf(os,"OperationDef");
00178   PersistNode::outputIOR(os,_result_def.in(),"\n result_def=");
00179   cdrMemoryStream memstr(CORBA::ULong(0),CORBA::Boolean(1)/*clearMemory*/);
00180   TypeCode::marshalTypeCode(_result.in(),memstr);
00181   _params.in()>>=memstr;
00182   _mode>>=memstr;
00183   _contexts>>=memstr;
00184   _exceptions.in()>>=memstr;
00185   _excDescriptionSeq>>=memstr;
00186   PersistNode::outputCdrMemoryStream(os,memstr,"\n state=");
00187   os<<" ;;\n";
00188 }

void Omniifr::OperationDef_impl::params const ParDescriptionSeq &  v  ) 
 

Definition at line 59 of file OperationDef.cc.

References _mode, _params, _result_def, Omniifr::Dependency3< T_xxxDescriptionSeq >::assign(), checkOneway(), Omniifr::IRObject_impl::checkReadonly(), and Omniifr::Dependency1< T_IRObject >::in().

00060 {
00061   checkReadonly();
00062   checkOneway(_mode,v,_result_def.in()); // throws BAD_PARAM if check fails
00063   _params.assign(v);
00064 }

ParDescriptionSeq * Omniifr::OperationDef_impl::params  ) 
 

Definition at line 54 of file OperationDef.cc.

References _params, and Omniifr::Dependency3< T_xxxDescriptionSeq >::copy().

Referenced by checkOneway().

00055 {
00056   return _params.copy();
00057 }

void Omniifr::OperationDef_impl::reincarnate const PersistNode node  )  [virtual]
 

Re-create the repository from information saved in the log file.

Reimplemented from Omniifr::IRObject_impl.

Definition at line 155 of file OperationDef.cc.

References _contexts, _excDescriptionSeq, _exceptions, _mode, _params, _result, _result_def, Omniifr::Dependency2< T_IRObjectSeq >::assign(), Omniifr::Dependency1< T_IRObject >::assign(), and Omniifr::Dependency3< T_xxxDescriptionSeq >::uncheckedAssign().

00156 {
00157   _result_def.assign(
00158     string_to_<CORBA::IDLType>(node.attrString("result_def").c_str())
00159   );
00160   // Read state.
00161   // Order must match that in OperationDef_impl::output():
00162   cdrMemoryStream memstr =node.attrCdrStream("state");
00163   _result=TypeCode::unmarshalTypeCode(memstr);  // _result
00164   ParDescriptionSeq       p;                    // _params
00165                           p<<=memstr;
00166   _params.uncheckedAssign(p);
00167   _mode<<=memstr;                               // _mode
00168   _contexts<<=memstr;                           // _contexts
00169   ExceptionDefSeq    e;                         // _exceptions
00170                      e<<=memstr;
00171   _exceptions.assign(e);
00172   _excDescriptionSeq<<=memstr;                  // _excDescriptionSeq
00173 }

TypeCode_ptr Omniifr::OperationDef_impl::result  ) 
 

Definition at line 34 of file OperationDef.cc.

References _result.

Referenced by describe().

00035 {
00036   return TypeCode::_duplicate(_result.in());
00037 }

void Omniifr::OperationDef_impl::result_def IDLType_ptr  v  ) 
 

Definition at line 46 of file OperationDef.cc.

References _mode, _params, _result, _result_def, Omniifr::Dependency1< T_IRObject >::assign(), checkOneway(), Omniifr::IRObject_impl::checkReadonly(), and Omniifr::Dependency3< T_xxxDescriptionSeq >::in().

00047 {
00048   checkReadonly();
00049   checkOneway(_mode,_params.in(),v); // throws BAD_PARAM if check fails
00050   _result_def.assign(IDLType::_duplicate(v));
00051   _result=v->type();
00052 }

IDLType_ptr Omniifr::OperationDef_impl::result_def  ) 
 

Definition at line 40 of file OperationDef.cc.

References _result_def, and Omniifr::Dependency1< T_IRObject >::in().

00041 {
00042   return IDLType::_duplicate(_result_def.in());
00043 }

void Omniifr::OperationDef_impl::uncheckedDestroy  )  [virtual]
 

Destroys this object, without first checking for dependencies.

Implements Omniifr::Contained_impl.

Definition at line 147 of file OperationDef.cc.

References _exceptions, _params, _result_def, Omniifr::Dependency2< T_IRObjectSeq >::clear(), Omniifr::Dependency3< T_xxxDescriptionSeq >::clear(), and Omniifr::Dependency1< T_IRObject >::clear().

00148 {
00149   _result_def.clear();
00150   _params.clear();
00151   _exceptions.clear();
00152   Contained_impl::uncheckedDestroy(); // superclass
00153 }


Member Data Documentation

ContextIdSeq Omniifr::OperationDef_impl::_contexts [private]
 

Definition at line 61 of file OperationDef.h.

Referenced by contexts(), describe(), OperationDef_impl(), output(), and reincarnate().

ExcDescriptionSeq Omniifr::OperationDef_impl::_excDescriptionSeq [private]
 

set from _exceptions

Definition at line 63 of file OperationDef.h.

Referenced by describe(), exceptions(), OperationDef_impl(), output(), and reincarnate().

Dependency2<ExceptionDefSeq> Omniifr::OperationDef_impl::_exceptions [private]
 

Definition at line 62 of file OperationDef.h.

Referenced by exceptions(), OperationDef_impl(), output(), reincarnate(), and uncheckedDestroy().

OperationMode Omniifr::OperationDef_impl::_mode [private]
 

Definition at line 60 of file OperationDef.h.

Referenced by describe(), mode(), OperationDef_impl(), output(), params(), reincarnate(), and result_def().

Dependency3<ParDescriptionSeq> Omniifr::OperationDef_impl::_params [private]
 

Definition at line 59 of file OperationDef.h.

Referenced by describe(), mode(), OperationDef_impl(), output(), params(), reincarnate(), result_def(), and uncheckedDestroy().

TypeCode_var Omniifr::OperationDef_impl::_result [private]
 

set from _result_def

Definition at line 57 of file OperationDef.h.

Referenced by OperationDef_impl(), output(), reincarnate(), result(), and result_def().

Dependency1<IDLType> Omniifr::OperationDef_impl::_result_def [private]
 

Definition at line 58 of file OperationDef.h.

Referenced by mode(), OperationDef_impl(), output(), params(), reincarnate(), result_def(), and uncheckedDestroy().


The documentation for this class was generated from the following files:
Generated on Fri Mar 4 13:04:05 2005 for OmniIFR by  doxygen 1.4.1