Notify_Constraint_Visitors.cpp

Go to the documentation of this file.
00001 // Notify_Constraint_Visitors.cpp,v 1.48 2006/03/16 15:53:36 sjiang Exp
00002 
00003 #include "orbsvcs/Notify/Notify_Constraint_Visitors.h"
00004 #include "orbsvcs/ETCL/ETCL_Constraint.h"
00005 #include "orbsvcs/ETCL/ETCL_y.h"
00006 #include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
00007 #include "tao/DynamicAny/DynArray_i.h"
00008 #include "tao/DynamicAny/DynSequence_i.h"
00009 #include "tao/DynamicAny/DynStruct_i.h"
00010 #include "tao/DynamicAny/DynUnion_i.h"
00011 #include "tao/DynamicAny/DynEnum_i.h"
00012 #include "tao/DynamicAny/DynAnyFactory.h"
00013 #include "tao/CDR.h"
00014 
00015 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00016 
00017 TAO_Notify_Constraint_Visitor::TAO_Notify_Constraint_Visitor (void)
00018   : implicit_id_ (TAO_Notify_Constraint_Visitor::EMPTY),
00019     implicit_ids_(implicit_ids_size_),
00020     filterable_data_(filterable_data_size_),
00021     variable_header_(variable_header_size_)
00022 {
00023   (void) this->implicit_ids_.bind (ACE_CString ("filterable_data",
00024     0,
00025     0),
00026     FILTERABLE_DATA);
00027   (void) this->implicit_ids_.bind (ACE_CString ("header",
00028     0,
00029     0),
00030     HEADER);
00031   (void) this->implicit_ids_.bind (ACE_CString ("remainder_of_body",
00032     0,
00033     0),
00034     REMAINDER_OF_BODY);
00035   (void) this->implicit_ids_.bind (ACE_CString ("fixed_header",
00036     0,
00037     0),
00038     FIXED_HEADER);
00039   (void) this->implicit_ids_.bind (ACE_CString ("variable_header",
00040     0,
00041     0),
00042     VARIABLE_HEADER);
00043   (void) this->implicit_ids_.bind (ACE_CString ("event_name",
00044     0,
00045     0),
00046     EVENT_NAME);
00047   (void) this->implicit_ids_.bind (ACE_CString ("event_type",
00048     0,
00049     0),
00050     EVENT_TYPE);
00051   (void) this->implicit_ids_.bind (ACE_CString ("domain_name",
00052     0,
00053     0),
00054     DOMAIN_NAME);
00055   (void) this->implicit_ids_.bind (ACE_CString ("type_name",
00056     0,
00057     0),
00058     TYPE_NAME);
00059 }
00060 
00061 int
00062 TAO_Notify_Constraint_Visitor::bind_structured_event (const CosNotification::StructuredEvent &s_event)
00063 {
00064   // The two sequences contained in a structured event are
00065   // copied into hash tables so iteration is done only once.
00066 
00067   CORBA::ULong length = s_event.filterable_data.length ();
00068   CORBA::ULong index = 0;
00069 
00070   for (index = 0; index < length; ++index)
00071   {
00072     ACE_CString name_str (s_event.filterable_data[index].name, 0, 0);
00073 
00074     int status =
00075       this->filterable_data_.bind (
00076         name_str,
00077         s_event.filterable_data[index].value
00078         );
00079 
00080     if (status != 0)
00081       return -1;
00082   }
00083 
00084   length = s_event.header.variable_header.length ();
00085 
00086   for (index = 0; index < length; ++index)
00087   {
00088     ACE_CString name_str (s_event.header.variable_header[index].name, 0, 0);
00089 
00090     int status =
00091       this->variable_header_.bind (
00092         name_str,
00093         s_event.header.variable_header[index].value
00094         );
00095 
00096     if (status != 0)
00097       return -1;
00098   }
00099 
00100   this->domain_name_ =
00101     CORBA::string_dup (s_event.header.fixed_header.event_type.domain_name);
00102 
00103   this->type_name_ =
00104     CORBA::string_dup (s_event.header.fixed_header.event_type.type_name);
00105 
00106   this->event_name_ =
00107     CORBA::string_dup (s_event.header.fixed_header.event_name);
00108 
00109   this->remainder_of_body_ = s_event.remainder_of_body;
00110 
00111   return 0;
00112 }
00113 
00114 CORBA::Boolean
00115 TAO_Notify_Constraint_Visitor::evaluate_constraint (
00116   TAO_ETCL_Constraint* root
00117   )
00118 {
00119   CORBA::Boolean result = 0;
00120   this->queue_.reset ();
00121 
00122   // Evaluate the constraint in root_;
00123   if (root != 0)
00124   {
00125     if ((root->accept (this) == 0) &&
00126       (! this->queue_.is_empty ()))
00127     {
00128       TAO_ETCL_Literal_Constraint top;
00129       this->queue_.dequeue_head (top);
00130       result = (CORBA::Boolean) top;
00131     }
00132   }
00133 
00134   // If a property couldn't be evaluated we must return 0.
00135   return result;
00136 }
00137 
00138 int
00139 TAO_Notify_Constraint_Visitor::visit_literal (
00140   TAO_ETCL_Literal_Constraint *literal
00141   )
00142 {
00143   this->queue_.enqueue_head (*literal);
00144   return 0;
00145 }
00146 
00147 int
00148 TAO_Notify_Constraint_Visitor::visit_identifier (TAO_ETCL_Identifier *ident)
00149 {
00150   int return_value = -1;
00151   const char *name = ident->value ();
00152   ACE_CString key (name, 0, 0);
00153 
00154   CORBA::Any any;
00155 
00156   if (this->filterable_data_.find (key, any) == 0)
00157   {
00158     if (any.impl() != 0)
00159     {
00160       this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (&any));
00161       return_value = 0;
00162     }
00163   }
00164 
00165   return return_value;
00166 }
00167 
00168 int
00169 TAO_Notify_Constraint_Visitor::visit_union_value (
00170   TAO_ETCL_Union_Value *union_value
00171   )
00172 {
00173   switch (union_value->sign ())
00174   {
00175     case 0:
00176       this->queue_.enqueue_head (*union_value->string ());
00177       break;
00178     case -1:
00179       this->queue_.enqueue_head (-(*union_value->integer ()));
00180       break;
00181     case 1:
00182       this->queue_.enqueue_head (*union_value->integer ());
00183       break;
00184     default:
00185       return -1;
00186   }
00187 
00188   return 0;
00189 }
00190 
00191 int
00192 TAO_Notify_Constraint_Visitor::visit_union_pos (
00193   TAO_ETCL_Union_Pos *union_pos
00194   )
00195 {
00196   ACE_DECLARE_NEW_CORBA_ENV;
00197   ACE_TRY
00198   {
00199     if (union_pos->union_value ()->accept (this) == 0)
00200     {
00201       TAO_ETCL_Literal_Constraint disc_val;
00202       this->queue_.dequeue_head (disc_val);
00203 
00204       TAO_DynUnion_i dyn_union;
00205       dyn_union.init (this->current_value_.in ()
00206         ACE_ENV_ARG_PARAMETER);
00207       ACE_TRY_CHECK;
00208 
00209       CORBA::TypeCode_var tc = this->current_value_->type ();
00210 
00211       switch (disc_val.expr_type ())
00212       {
00213       case TAO_ETCL_INTEGER:
00214       case TAO_ETCL_SIGNED:
00215       case TAO_ETCL_UNSIGNED:
00216         {
00217           CORBA::Any disc_any;
00218           CORBA::TypeCode_var disc_tc =
00219             tc->discriminator_type (ACE_ENV_SINGLE_ARG_PARAMETER);
00220           ACE_TRY_CHECK;
00221           CORBA::TCKind disc_kind =
00222             TAO_DynAnyFactory::unalias (disc_tc.in ()
00223             ACE_ENV_ARG_PARAMETER);
00224           ACE_TRY_CHECK;
00225 
00226           switch (disc_kind)
00227           {
00228           case CORBA::tk_boolean:
00229             disc_any <<= CORBA::Any::from_boolean ((CORBA::Boolean) disc_val);
00230             break;
00231           case CORBA::tk_short:
00232             disc_any <<= (CORBA::Short) ((CORBA::Long) disc_val);
00233             break;
00234           case CORBA::tk_ushort:
00235             disc_any <<= (CORBA::UShort) ((CORBA::ULong) disc_val);
00236             break;
00237           case CORBA::tk_long:
00238             disc_any <<= (CORBA::Long) disc_val;
00239             break;
00240           case CORBA::tk_ulong:
00241             disc_any <<= (CORBA::ULong) disc_val;
00242             break;
00243           case CORBA::tk_enum:
00244             {
00245               TAO_OutputCDR cdr;
00246               cdr.write_ulong ((CORBA::ULong) disc_val);
00247               TAO_InputCDR in_cdr (cdr);
00248               TAO::Unknown_IDL_Type *unk = 0;
00249               ACE_NEW_RETURN (unk,
00250                 TAO::Unknown_IDL_Type (disc_tc.in (),
00251                 in_cdr),
00252                 -1);
00253 
00254               disc_any.replace (unk);
00255               break;
00256             }
00257             // @@@ (JP) I don't think ETCL handles 64-bit
00258             // integers at this point, and I also think that
00259             // chars and/or wchars will just come out in the
00260             // constraint as (w)strings of length 1.
00261           case CORBA::tk_longlong:
00262           case CORBA::tk_ulonglong:
00263           case CORBA::tk_char:
00264           case CORBA::tk_wchar:
00265           default:
00266             return -1;
00267           }
00268 
00269           DynamicAny::DynAny_var dyn_any =
00270             TAO_DynAnyFactory::make_dyn_any (disc_any
00271             ACE_ENV_ARG_PARAMETER);
00272           ACE_TRY_CHECK;
00273           dyn_union.set_discriminator (dyn_any.in ()
00274             ACE_ENV_ARG_PARAMETER);
00275           ACE_TRY_CHECK;
00276           DynamicAny::DynAny_var u_member =
00277             dyn_union.member (ACE_ENV_SINGLE_ARG_PARAMETER);
00278           ACE_TRY_CHECK;
00279           this->current_value_ =
00280             u_member->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
00281           ACE_TRY_CHECK;
00282 
00283           break;
00284         }
00285       case TAO_ETCL_STRING:
00286         {
00287           const char *name = (const char *) disc_val;
00288           CORBA::ULong count =
00289             tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
00290           ACE_TRY_CHECK;
00291 
00292           const char *member_name = 0;
00293           CORBA::ULong i = 0;
00294 
00295           for (i = 0; i < count; ++i)
00296           {
00297             member_name = tc->member_name (i
00298               ACE_ENV_ARG_PARAMETER);
00299             ACE_TRY_CHECK;
00300 
00301             if (ACE_OS::strcmp (name, member_name) == 0)
00302               break;
00303           }
00304 
00305           // If there's no match, member_label will throw
00306           // CORBA::TypeCode::Bounds and the catch block will
00307           // return -1;
00308           this->current_value_ = tc->member_label (i
00309             ACE_ENV_ARG_PARAMETER);
00310           ACE_TRY_CHECK;
00311 
00312           break;
00313         }
00314         // The TAO_ETCL_Union_Value that was put on the queue
00315         // shouldn't have any other type.
00316       default:
00317         return -1;
00318       }
00319 
00320       TAO_ETCL_Constraint *nested = union_pos->component ();
00321 
00322       // If there's no nested component, then we just want the
00323       // union member value on the queue. Otherwise, we want
00324       // the member value in current_value_ while we visit
00325       // the nested component.
00326       if (nested == 0)
00327       {
00328         TAO_ETCL_Literal_Constraint lit (this->current_value_.ptr ());
00329         this->queue_.enqueue_head (lit);
00330         return 0;
00331       }
00332       else
00333         return nested->accept (this);
00334     }
00335     else
00336       return -1;
00337   }
00338   ACE_CATCHANY
00339   {
00340     return -1;
00341   }
00342   ACE_ENDTRY;
00343 }
00344 
00345 int
00346 TAO_Notify_Constraint_Visitor::visit_component_pos (
00347   TAO_ETCL_Component_Pos *pos
00348   )
00349 {
00350   ACE_DECLARE_NEW_CORBA_ENV;
00351   ACE_TRY
00352   {
00353     // If we are here (from visit_component) the Any containing the
00354     // component as found in filterable_data_ will be in current_value_.
00355     CORBA::TypeCode_var tc = this->current_value_->type ();
00356     CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()
00357       ACE_ENV_ARG_PARAMETER);
00358     ACE_TRY_CHECK;
00359 
00360     DynamicAny::DynAny_var member;
00361     CORBA::Boolean success = 0;
00362     CORBA::ULong slot = (CORBA::ULong) *pos->integer ();
00363 
00364     switch (kind)
00365     {
00366     case CORBA::tk_enum:
00367       {
00368         TAO_DynEnum_i dyn_enum;
00369         dyn_enum.init (this->current_value_.in ()
00370           ACE_ENV_ARG_PARAMETER);
00371         ACE_TRY_CHECK;
00372 
00373         success = dyn_enum.seek (slot
00374           ACE_ENV_ARG_PARAMETER);
00375         ACE_TRY_CHECK;
00376 
00377         if (success == 0)
00378           return -1;
00379 
00380         member =
00381           dyn_enum.current_component (ACE_ENV_SINGLE_ARG_PARAMETER);
00382         ACE_TRY_CHECK;
00383 
00384         break;
00385       }
00386     case CORBA::tk_struct:
00387       {
00388         TAO_DynStruct_i dyn_struct;
00389         dyn_struct.init (this->current_value_.in ()
00390           ACE_ENV_ARG_PARAMETER);
00391         ACE_TRY_CHECK;
00392 
00393         success = dyn_struct.seek (slot
00394           ACE_ENV_ARG_PARAMETER);
00395         ACE_TRY_CHECK;
00396 
00397         if (success == 0)
00398           return -1;
00399 
00400         member = dyn_struct.current_component (ACE_ENV_SINGLE_ARG_PARAMETER);
00401         ACE_TRY_CHECK;
00402 
00403         break;
00404       }
00405       // @@@ (JP) I think enums and structs are the only two cases
00406       // handled by Component_Pos, since arrays and sequences are
00407       // handled by Component_Array, and unions are handled by
00408       // Union_Pos.
00409     default:
00410       return -1;
00411     }
00412 
00413     CORBA::Any_var value = member->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
00414     ACE_TRY_CHECK;
00415 
00416     TAO_ETCL_Constraint *comp = pos->component ();
00417 
00418     if (comp == 0)
00419     {
00420       TAO_ETCL_Literal_Constraint result (value.ptr ());
00421       this->queue_.enqueue_head (result);
00422       return 0;
00423     }
00424     else
00425     {
00426       this->current_value_ = value._retn ();
00427       return comp->accept (this);
00428     }
00429   }
00430   ACE_CATCHANY
00431   {
00432     return -1;
00433   }
00434   ACE_ENDTRY;
00435 }
00436 
00437 int
00438 TAO_Notify_Constraint_Visitor::visit_component_assoc (
00439   TAO_ETCL_Component_Assoc *assoc
00440   )
00441 {
00442   CORBA::Any any;
00443   ACE_CString name (assoc->identifier ()->value (),
00444     0,
00445     0);
00446 
00447   switch (this->implicit_id_)
00448   {
00449   case FILTERABLE_DATA:
00450     if (this->filterable_data_.find (name, any) != 0
00451       || any.impl() == 0)
00452       return -1;
00453     break;
00454   case VARIABLE_HEADER:
00455     if (this->variable_header_.find (name, any) != 0
00456       || any.impl() == 0)
00457       return -1;
00458     break;
00459     // Only the sequence members of CosNotification::StructuredEvent
00460     // can be treated as associative arrays.
00461   default:
00462     return -1;
00463   }
00464 
00465   TAO_ETCL_Constraint *comp = assoc->component ();
00466   CORBA::Any *any_ptr = 0;
00467 
00468   if (comp == 0)
00469   {
00470     TAO_ETCL_Literal_Constraint result (&any);
00471     this->queue_.enqueue_head (result);
00472 
00473     // If we're at the end of the line, put the name into
00474     // current_value_ so visit_exist can use it.
00475     ACE_NEW_RETURN (any_ptr,
00476       CORBA::Any,
00477       -1);
00478     (*any_ptr) <<= name.c_str ();
00479     this->current_value_ = any_ptr;
00480 
00481     return 0;
00482   }
00483   else
00484   {
00485     ACE_NEW_RETURN (any_ptr,
00486       CORBA::Any (any),
00487       -1);
00488     this->current_value_ = any_ptr;
00489     return comp->accept (this);
00490   }
00491 }
00492 
00493 int
00494 TAO_Notify_Constraint_Visitor::visit_component_array (TAO_ETCL_Component_Array *array)
00495 {
00496   ACE_DECLARE_NEW_CORBA_ENV;
00497   ACE_TRY
00498   {
00499     // If we are here (from visit_component) the Any containing the
00500     // component as found in filterable_data_ will be in
00501     // current_value_.
00502     CORBA::TypeCode_var tc = this->current_value_->type ();
00503     CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()
00504       ACE_ENV_ARG_PARAMETER);
00505     ACE_TRY_CHECK;
00506 
00507     DynamicAny::DynAny_var member;
00508     CORBA::Boolean success = 0;
00509     CORBA::ULong slot = (CORBA::ULong) *array->integer ();
00510 
00511     switch (kind)
00512     {
00513     case CORBA::tk_array:
00514       {
00515         TAO_DynEnum_i dyn_array;
00516         dyn_array.init (this->current_value_.in ()
00517           ACE_ENV_ARG_PARAMETER);
00518         ACE_TRY_CHECK;
00519 
00520         success = dyn_array.seek (slot
00521           ACE_ENV_ARG_PARAMETER);
00522         ACE_TRY_CHECK;
00523 
00524         if (success == 0)
00525           return -1;
00526 
00527         member = dyn_array.current_component (ACE_ENV_SINGLE_ARG_PARAMETER);
00528         ACE_TRY_CHECK;
00529 
00530         break;
00531       }
00532     case CORBA::tk_sequence:
00533       {
00534         TAO_DynStruct_i dyn_sequence;
00535         dyn_sequence.init (this->current_value_.in ()
00536           ACE_ENV_ARG_PARAMETER);
00537         ACE_TRY_CHECK;
00538 
00539         success = dyn_sequence.seek (slot
00540           ACE_ENV_ARG_PARAMETER);
00541         ACE_TRY_CHECK;
00542 
00543         if (success == 0)
00544           return -1;
00545 
00546         member =
00547           dyn_sequence.current_component (ACE_ENV_SINGLE_ARG_PARAMETER);
00548         ACE_TRY_CHECK;
00549 
00550         break;
00551       }
00552       // Enums and sequences are the only two cases handled
00553       // by Component_Array.
00554     default:
00555       return -1;
00556     }
00557 
00558     CORBA::Any_var value = member->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
00559     ACE_TRY_CHECK;
00560 
00561     TAO_ETCL_Constraint *comp = array->component ();
00562 
00563     if (comp == 0)
00564     {
00565       TAO_ETCL_Literal_Constraint result (value.ptr ());
00566       this->queue_.enqueue_head (result);
00567       return 0;
00568     }
00569     else
00570     {
00571       this->current_value_ = value._retn ();
00572       return comp->accept (this);
00573     }
00574   }
00575   ACE_CATCHANY
00576   {
00577     return -1;
00578   }
00579   ACE_ENDTRY;
00580 }
00581 
00582 int
00583 TAO_Notify_Constraint_Visitor::visit_special (TAO_ETCL_Special *special)
00584 {
00585   ACE_DECLARE_NEW_CORBA_ENV;
00586   ACE_TRY
00587   {
00588     CORBA::TypeCode_var tc = this->current_value_->type ();
00589     tc = TAO_DynAnyFactory::strip_alias (tc.in () ACE_ENV_ARG_PARAMETER);
00590     ACE_TRY_CHECK;
00591 
00592       CORBA::TCKind kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
00593       ACE_TRY_CHECK;
00594 
00595     switch (special->type ())
00596     {
00597     case TAO_ETCL_LENGTH:
00598       {
00599         CORBA::ULong length;
00600 
00601             switch (kind)
00602         {
00603         case CORBA::tk_sequence:
00604           {
00605             TAO_DynSequence_i dyn_seq;
00606             dyn_seq.init (current_value_.in()
00607               ACE_ENV_ARG_PARAMETER);
00608             ACE_TRY_CHECK;
00609 
00610             DynamicAny::AnySeq_var any_seq =
00611               dyn_seq.get_elements (ACE_ENV_SINGLE_ARG_PARAMETER);
00612             ACE_TRY_CHECK;
00613 
00614             length = any_seq->length ();
00615           }
00616           break;
00617         case CORBA::tk_array:
00618           {
00619             length = tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
00620             ACE_TRY_CHECK;
00621           }
00622           break;
00623         default:
00624           return -1;
00625         }
00626 
00627         TAO_ETCL_Literal_Constraint lit (length);
00628         this->queue_.enqueue_head (lit);
00629         return 0;
00630       }
00631     case TAO_ETCL_DISCRIMINANT:
00632       {
00633         // If the TCKind is not a union, the call to init() will
00634         // raise an exception, and the catch block will return -1;
00635         TAO_DynUnion_i dyn_union;
00636         dyn_union.init (this->current_value_.in ()
00637           ACE_ENV_ARG_PARAMETER);
00638         ACE_TRY_CHECK;
00639 
00640         DynamicAny::DynAny_var disc =
00641           dyn_union.get_discriminator (ACE_ENV_SINGLE_ARG_PARAMETER);
00642         ACE_TRY_CHECK;
00643 
00644         CORBA::Any_var disc_any = disc->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
00645         ACE_TRY_CHECK;
00646 
00647         TAO_ETCL_Literal_Constraint lit (disc_any.ptr ());
00648         this->queue_.enqueue_head (lit);
00649         return 0;
00650       }
00651     case TAO_ETCL_TYPE_ID:
00652       {
00653         const char *name = tc->name (ACE_ENV_SINGLE_ARG_PARAMETER);
00654         ACE_TRY_CHECK;
00655 
00656         TAO_ETCL_Literal_Constraint lit (name);
00657         this->queue_.enqueue_head (lit);
00658         return 0;
00659       }
00660     case TAO_ETCL_REPOS_ID:
00661       {
00662         const char *id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
00663         ACE_TRY_CHECK;
00664 
00665         TAO_ETCL_Literal_Constraint lit (id);
00666         this->queue_.enqueue_head (lit);
00667         return 0;
00668       }
00669     default:
00670       return -1;
00671     }
00672   }
00673   ACE_CATCHANY
00674   {
00675     return -1;
00676   }
00677   ACE_ENDTRY;
00678 }
00679 
00680 int
00681 TAO_Notify_Constraint_Visitor::visit_component (
00682   TAO_ETCL_Component *component
00683   )
00684 {
00685   TAO_ETCL_Constraint *nested = component->component ();
00686   TAO_ETCL_Identifier *identifier = component->identifier ();
00687   ACE_CString component_name (identifier->value (),
00688     0,
00689     0);
00690   CORBA::Any *any_ptr = 0;
00691 
00692   if (this->implicit_ids_.find (component_name, this->implicit_id_) != 0)
00693     this->implicit_id_ = TAO_Notify_Constraint_Visitor::EMPTY;
00694 
00695   // If this component has no sub-component, only an identifier, then
00696   // we just visit the identifier, which puts a literal on the queue
00697   // to be handled upon returning from this method call.  If there is
00698   // a sub-component, we store the literal's value in our member _var
00699   // for possible examination at a more nested level, and visit the
00700   // sub-component. If the identifier matches one of the nested field
00701   // names in CosNotification::StructuredEvent, we just visit the
00702   // nested component, if any.
00703   if (this->implicit_id_ == TAO_Notify_Constraint_Visitor::EMPTY)
00704   {
00705     if (nested == 0)
00706     {
00707       // If this is the end of the line, we put the component name
00708       // into current_value_ so visit_exist can use it.
00709       ACE_NEW_RETURN (any_ptr,
00710         CORBA::Any,
00711         -1);
00712       (*any_ptr) <<= component_name.c_str ();
00713       this->current_value_ = any_ptr;
00714       return identifier->accept (this);
00715     }
00716     else
00717     {
00718       int result = identifier->accept (this);
00719 
00720       if (result != 0)
00721         return result;
00722 
00723       TAO_ETCL_Literal_Constraint id;
00724       this->queue_.dequeue_head (id);
00725       ACE_NEW_RETURN (any_ptr,
00726         CORBA::Any (*(const CORBA::Any *) id),
00727         -1);
00728       this->current_value_ = any_ptr;
00729     }
00730   }
00731 
00732   if (nested != 0)
00733     return nested->accept (this);
00734   else
00735   {
00736     switch (this->implicit_id_)
00737     {
00738     case TYPE_NAME:
00739       {
00740         TAO_ETCL_Literal_Constraint tn (this->type_name_.in ());
00741         this->queue_.enqueue_head (tn);
00742         return 0;
00743       }
00744     case EVENT_NAME:
00745       {
00746         TAO_ETCL_Literal_Constraint en (this->event_name_.in ());
00747         this->queue_.enqueue_head (en);
00748         return 0;
00749       }
00750     case DOMAIN_NAME:
00751       {
00752         TAO_ETCL_Literal_Constraint dn (this->domain_name_.in ());
00753         this->queue_.enqueue_head (dn);
00754         return 0;
00755       }
00756     case REMAINDER_OF_BODY:
00757       {
00758         TAO_ETCL_Literal_Constraint rob (&this->remainder_of_body_);
00759         this->queue_.enqueue_head (rob);
00760         return 0;
00761       }
00762       // The above cases are the leaves of the
00763       // CosNotification::StructuredEvent "tree". Anything else and we
00764       // should have a nested component. otherwise, it's an error.
00765     default:
00766       return -1;
00767     }
00768   }
00769 }
00770 
00771 int
00772 TAO_Notify_Constraint_Visitor::visit_dot (TAO_ETCL_Dot *dot)
00773 {
00774   // If we are here, we know we're headed for a more nested
00775   // level, so we just visit it, there's nothing else in this
00776   // constraint.
00777   return dot->component ()->accept (this);
00778 }
00779 
00780 int
00781 TAO_Notify_Constraint_Visitor::visit_eval (TAO_ETCL_Eval *eval)
00782 {
00783   // Nothing to do but visit the contained component.
00784   return eval->component ()->accept (this);
00785 }
00786 
00787 int
00788 TAO_Notify_Constraint_Visitor::visit_default (TAO_ETCL_Default *def)
00789 {
00790   TAO_ETCL_Constraint *comp = def->component ();
00791 
00792   if (comp == 0)
00793     return -1;
00794 
00795   if (comp->accept (this) != 0)
00796     return -1;
00797 
00798   ACE_DECLARE_NEW_CORBA_ENV;
00799   ACE_TRY
00800   {
00801     CORBA::TypeCode_var tc = this->current_value_->type ();
00802 
00803     // If the current member is not a union, this call will throw
00804     // BadKind and the catch block will return -1.
00805     CORBA::Long default_index = tc->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
00806     ACE_TRY_CHECK;
00807 
00808     // No default index.
00809     if (default_index == -1)
00810     {
00811       TAO_ETCL_Literal_Constraint result ((CORBA::Boolean) 0);
00812       this->queue_.enqueue_head (result);
00813       return 0;
00814     }
00815 
00816     // Okay, there's a default index, but is it active?
00817 
00818     TAO_ETCL_Literal_Constraint disc;
00819     this->queue_.dequeue_head (disc);
00820     TAO_ETCL_Literal_Constraint default_index_value (default_index);
00821     return (disc == default_index_value);
00822   }
00823   ACE_CATCHANY
00824   {
00825     return -1;
00826   }
00827   ACE_ENDTRY;
00828 }
00829 
00830 int
00831 TAO_Notify_Constraint_Visitor::visit_exist (TAO_ETCL_Exist *exist)
00832 {
00833   TAO_ETCL_Constraint *component = exist->component ();
00834 
00835   if (component->accept (this) == 0)
00836   {
00837     const char *value = 0;
00838     CORBA::Boolean result = 0;
00839 
00840     // For the two cases below, we don't want the item at the top of
00841     // the queue, because it's the result of a hash table
00842     // lookup. For an existence test, we want the key value, which
00843     // is stored in the current_value_ member.
00844     if (this->implicit_id_ == FILTERABLE_DATA
00845       || this->implicit_id_ == VARIABLE_HEADER)
00846     {
00847       TAO_ETCL_Literal_Constraint current (&this->current_value_.inout ());
00848       value = CORBA::string_dup ((const char *) current);
00849     }
00850 
00851     switch (this->implicit_id_)
00852     {
00853     case FILTERABLE_DATA:
00854       result =
00855         (this->filterable_data_.find (ACE_CString (value, 0, 0)) == 0);
00856       break;
00857     case VARIABLE_HEADER:
00858       result =
00859         (this->variable_header_.find (ACE_CString (value, 0, 0)) == 0);
00860       break;
00861     case TYPE_NAME:
00862       result = (this->type_name_.in () != 0);
00863       break;
00864     case EVENT_NAME:
00865       result = (this->event_name_.in () != 0);
00866       break;
00867     case DOMAIN_NAME:
00868       result = (this->domain_name_.in () != 0);
00869       break;
00870       // Anything other than the above cases is an error.
00871     default:
00872       return -1;
00873     }
00874 
00875     this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
00876 
00877     return 0;
00878   }
00879 
00880   return -1;
00881 }
00882 
00883 int
00884 TAO_Notify_Constraint_Visitor::visit_unary_expr (
00885   TAO_ETCL_Unary_Expr *unary_expr
00886   )
00887 {
00888   TAO_ETCL_Constraint *subexpr = unary_expr->subexpr ();
00889 
00890   if (subexpr->accept (this) == 0)
00891   {
00892     TAO_ETCL_Literal_Constraint subexpr_result;
00893     CORBA::Boolean result = 0;
00894     int op_type = unary_expr->type ();
00895 
00896     switch (op_type)
00897     {
00898     case TAO_ETCL_NOT:
00899       this->queue_.dequeue_head (subexpr_result);
00900       result = ! (CORBA::Boolean) subexpr_result;
00901       this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
00902       return 0;
00903     case TAO_ETCL_MINUS:
00904       // The leading '-' was parsed separately, so we have to pull
00905       // the literal constraint off the queue, apply the class' own
00906       // unary minus operator, and put it back.
00907       this->queue_.dequeue_head (subexpr_result);
00908       this->queue_.enqueue_head (-subexpr_result);
00909       return 0;
00910     case TAO_ETCL_PLUS:
00911       // Leave the literal constraint on the queue. The leading
00912       // '+' was just syntactic sugar - no action is necessary.
00913       return 0;
00914     default:
00915       // The parser should never construct a TAO_ETCL_Unary_Constraint
00916       // behind any operators except the above three.
00917       return -1;
00918     }
00919   }
00920 
00921   return -1;
00922 }
00923 
00924 int
00925 TAO_Notify_Constraint_Visitor::visit_binary_expr (
00926   TAO_ETCL_Binary_Expr *binary_expr
00927   )
00928 {
00929   int bin_op_type = binary_expr->type ();
00930 
00931   switch (bin_op_type)
00932   {
00933   case TAO_ETCL_OR:
00934     return this->visit_or (binary_expr);
00935   case TAO_ETCL_AND:
00936     return this->visit_and (binary_expr);
00937   case TAO_ETCL_LT:
00938   case TAO_ETCL_LE:
00939   case TAO_ETCL_GT:
00940   case TAO_ETCL_GE:
00941   case TAO_ETCL_EQ:
00942   case TAO_ETCL_NE:
00943   case TAO_ETCL_PLUS:
00944   case TAO_ETCL_MINUS:
00945   case TAO_ETCL_MULT:
00946   case TAO_ETCL_DIV:
00947     return this->visit_binary_op (binary_expr,
00948       bin_op_type);
00949   case TAO_ETCL_TWIDDLE:
00950     return this->visit_twiddle (binary_expr);
00951   case TAO_ETCL_IN:
00952     return this->visit_in (binary_expr);
00953   default:
00954     return -1;
00955   }
00956 }
00957 
00958 int
00959 TAO_Notify_Constraint_Visitor::visit_or (
00960   TAO_ETCL_Binary_Expr *binary
00961   )
00962 {
00963   int return_value = -1;
00964   CORBA::Boolean result = 0;
00965   TAO_ETCL_Constraint *lhs = binary->lhs ();
00966 
00967   if (lhs->accept (this) == 0)
00968   {
00969     TAO_ETCL_Literal_Constraint lhs_result;
00970     this->queue_.dequeue_head (lhs_result);
00971     result = (CORBA::Boolean) lhs_result;
00972 
00973     // Short-circuiting OR.
00974     if (result == 0)
00975     {
00976       TAO_ETCL_Constraint *rhs = binary->rhs ();
00977 
00978       if (rhs->accept (this) == 0)
00979       {
00980         TAO_ETCL_Literal_Constraint rhs_result;
00981         this->queue_.dequeue_head (rhs_result);
00982         result = (CORBA::Boolean) rhs_result;
00983         return_value = 0;
00984       }
00985     }
00986     else
00987       return_value = 0;
00988   }
00989 
00990   if (return_value == 0)
00991     this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
00992 
00993   return return_value;
00994 }
00995 
00996 int
00997 TAO_Notify_Constraint_Visitor::visit_and (TAO_ETCL_Binary_Expr *binary)
00998 {
00999   int return_value = -1;
01000   CORBA::Boolean result = 0;
01001   TAO_ETCL_Constraint *lhs = binary->lhs ();
01002 
01003   if (lhs->accept (this) == 0)
01004   {
01005     TAO_ETCL_Literal_Constraint lhs_result;
01006     this->queue_.dequeue_head (lhs_result);
01007     result = (CORBA::Boolean) lhs_result;
01008 
01009     // Short-circuiting AND.
01010     if (result == 1)
01011     {
01012       TAO_ETCL_Constraint *rhs = binary->rhs ();
01013 
01014       if (rhs->accept (this) == 0)
01015       {
01016         TAO_ETCL_Literal_Constraint rhs_result;
01017         this->queue_.dequeue_head (rhs_result);
01018         result = (CORBA::Boolean) rhs_result;
01019         return_value = 0;
01020       }
01021     }
01022     else
01023       return_value = 0;
01024   }
01025 
01026   if (return_value == 0)
01027     this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
01028 
01029   return return_value;
01030 }
01031 
01032 int
01033 TAO_Notify_Constraint_Visitor::visit_binary_op (TAO_ETCL_Binary_Expr *binary,
01034                                                 int op_type)
01035 {
01036   int return_value = -1;
01037   TAO_ETCL_Constraint *lhs = binary->lhs ();
01038   CORBA::Boolean result = 0;
01039 
01040   // Perform an operation on the results of evaluating the left and
01041   // right branches of this subtree.
01042   if (lhs->accept (this) == 0)
01043   {
01044     TAO_ETCL_Literal_Constraint left_operand;
01045     this->queue_.dequeue_head (left_operand);
01046     TAO_ETCL_Constraint *rhs = binary->rhs ();
01047 
01048     if (rhs->accept (this) == 0)
01049     {
01050       TAO_ETCL_Literal_Constraint right_operand;
01051       this->queue_.dequeue_head (right_operand);
01052       return_value = 0;
01053 
01054       switch (op_type)
01055       {
01056       case TAO_ETCL_LT:
01057         result = left_operand < right_operand;
01058         this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
01059         break;
01060       case TAO_ETCL_LE:
01061         result = left_operand <= right_operand;
01062         this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
01063         break;
01064       case TAO_ETCL_GT:
01065         result = left_operand > right_operand;
01066         this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
01067         break;
01068       case TAO_ETCL_GE:
01069         result = left_operand >= right_operand;
01070         this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
01071         break;
01072       case TAO_ETCL_EQ:
01073         result = left_operand == right_operand;
01074         this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
01075         break;
01076       case TAO_ETCL_NE:
01077         result = left_operand != right_operand;
01078         this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
01079         break;
01080       case TAO_ETCL_PLUS:
01081         this->queue_.enqueue_head (left_operand + right_operand);
01082         break;
01083       case TAO_ETCL_MINUS:
01084         this->queue_.enqueue_head (left_operand - right_operand);
01085         break;
01086       case TAO_ETCL_MULT:
01087         this->queue_.enqueue_head (left_operand * right_operand);
01088         break;
01089       case TAO_ETCL_DIV:
01090         this->queue_.enqueue_head (left_operand / right_operand);
01091         break;
01092       default:
01093         return_value = -1;
01094       }
01095     }
01096   }
01097 
01098   return return_value;
01099 }
01100 
01101 int
01102 TAO_Notify_Constraint_Visitor::visit_twiddle (TAO_ETCL_Binary_Expr *binary)
01103 {
01104   int return_value = -1;
01105   TAO_ETCL_Constraint *lhs = binary->lhs ();
01106 
01107   // Determine if the left operand is a substring of the right.
01108   if (lhs->accept (this) == 0)
01109   {
01110     TAO_ETCL_Literal_Constraint left;
01111     this->queue_.dequeue_head (left);
01112     TAO_ETCL_Constraint *rhs = binary->rhs ();
01113 
01114     if (rhs->accept (this) == 0)
01115     {
01116       TAO_ETCL_Literal_Constraint right;
01117       this->queue_.dequeue_head (right);
01118       CORBA::Boolean result =
01119         (ACE_OS::strstr ((const char *) right,
01120         (const char *) left) != 0);
01121       this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
01122       return_value = 0;
01123     }
01124   }
01125 
01126   return return_value;
01127 }
01128 
01129 int
01130 TAO_Notify_Constraint_Visitor::visit_in (TAO_ETCL_Binary_Expr *binary)
01131 {
01132   int return_value = -1;
01133   TAO_ETCL_Constraint *lhs = binary->lhs ();
01134 
01135   // Determine if the left operand is contained in the right.
01136   if (lhs->accept (this) == 0)
01137   {
01138     TAO_ETCL_Literal_Constraint left;
01139     this->queue_.dequeue_head (left);
01140 
01141     TAO_ETCL_Constraint *rhs = binary->rhs ();
01142 
01143     if (rhs->accept (this) == 0)
01144     {
01145       TAO_ETCL_Literal_Constraint bag;
01146       this->queue_.dequeue_head (bag);
01147 
01148       if (bag.expr_type () == TAO_ETCL_COMPONENT)
01149       {
01150         const CORBA::Any *component = (const CORBA::Any *) bag;
01151         CORBA::TCKind kind = CORBA::tk_null;
01152 
01153         ACE_DECLARE_NEW_CORBA_ENV;
01154         ACE_TRY
01155         {
01156           CORBA::TypeCode_var tc = component->type ();
01157           kind = TAO_DynAnyFactory::unalias (tc.in ()
01158             ACE_ENV_ARG_PARAMETER);
01159           ACE_TRY_CHECK;
01160         }
01161         ACE_CATCHANY
01162         {
01163           return return_value;
01164         }
01165         ACE_ENDTRY;
01166 
01167         CORBA::Boolean result = 0;
01168 
01169         switch (kind)
01170         {
01171         case CORBA::tk_sequence:
01172           result = this->sequence_does_contain (component,
01173             left);
01174           break;
01175         case CORBA::tk_array:
01176           result = this->array_does_contain (component,
01177             left);
01178           break;
01179         case CORBA::tk_struct:
01180           result = this->struct_does_contain (component,
01181             left);
01182           break;
01183         case CORBA::tk_union:
01184           result = this->union_does_contain (component,
01185             left);
01186           break;
01187         case CORBA::tk_any:
01188           result = this->any_does_contain (component,
01189             left);
01190           break;
01191         default:
01192           return return_value;
01193         }
01194 
01195         this->queue_.enqueue_head (TAO_ETCL_Literal_Constraint (result));
01196         return_value = 0;
01197       }
01198     }
01199   }
01200 
01201   return return_value;
01202 }
01203 
01204 int
01205 TAO_Notify_Constraint_Visitor::visit_preference (TAO_ETCL_Preference *)
01206 {
01207   // According to OMG 00-06-20 section 2.4.1, the Notification Service
01208   // does not use the preference operators. The method must be here
01209   // because it is called by the ETCL node, which may be used by other
01210   // CORBA services that do use the preference operators.
01211   return -1;
01212 }
01213 
01214 CORBA::Boolean
01215 TAO_Notify_Constraint_Visitor::sequence_does_contain (const CORBA::Any *any,
01216                                                       TAO_ETCL_Literal_Constraint &item)
01217 {
01218   ACE_DECLARE_NEW_CORBA_ENV;
01219   ACE_TRY
01220   {
01221     CORBA::TypeCode_var type = any->type ();
01222     CORBA::TypeCode_var base_type =
01223       TAO_DynAnyFactory::strip_alias (type.in () ACE_ENV_ARG_PARAMETER);
01224     ACE_TRY_CHECK;
01225     CORBA::TypeCode_var content_type =
01226       base_type->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
01227     ACE_TRY_CHECK;
01228     CORBA::TCKind kind =
01229       TAO_DynAnyFactory::unalias (content_type.in() ACE_ENV_ARG_PARAMETER);
01230     ACE_TRY_CHECK;
01231 
01232     // The literal and the array elements must be
01233     // of the same simple type.
01234     CORBA::Boolean match = this->simple_type_match (item.expr_type (),
01235       kind);
01236 
01237     if (match == 0)
01238       return 0;
01239 
01240     TAO_DynSequence_i dyn_seq;
01241     dyn_seq.init (*any
01242       ACE_ENV_ARG_PARAMETER);
01243     ACE_TRY_CHECK;
01244 
01245     DynamicAny::AnySeq_var any_seq =
01246       dyn_seq.get_elements (ACE_ENV_SINGLE_ARG_PARAMETER);
01247     ACE_TRY_CHECK;
01248 
01249     CORBA::ULong length = any_seq->length ();
01250 
01251     for (CORBA::ULong i = 0; i < length; ++i)
01252     {
01253       TAO_ETCL_Literal_Constraint element (&any_seq[i]);
01254 
01255       if (item == element)
01256         return 1;
01257     }
01258   }
01259   ACE_CATCHANY
01260   {
01261     return 0;
01262   }
01263   ACE_ENDTRY;
01264 
01265   return 0;
01266 }
01267 
01268 CORBA::Boolean
01269 TAO_Notify_Constraint_Visitor::array_does_contain (const CORBA::Any *any,
01270                                                    TAO_ETCL_Literal_Constraint &item)
01271 {
01272   ACE_DECLARE_NEW_CORBA_ENV;
01273   ACE_TRY
01274   {
01275     CORBA::TypeCode_var type = any->type ();
01276     CORBA::TCKind kind = TAO_DynAnyFactory::unalias (type.in ()
01277       ACE_ENV_ARG_PARAMETER);
01278     ACE_TRY_CHECK;
01279 
01280     // The literal and the array elements must be
01281     // of the same simple type.
01282     CORBA::Boolean match = this->simple_type_match (item.expr_type (),
01283       kind);
01284 
01285     if (match == 0)
01286       return 0;
01287 
01288     TAO_DynArray_i dyn_array;
01289     dyn_array.init (*any
01290       ACE_ENV_ARG_PARAMETER);
01291     ACE_TRY_CHECK;
01292 
01293     DynamicAny::AnySeq_var any_seq =
01294       dyn_array.get_elements (ACE_ENV_SINGLE_ARG_PARAMETER);
01295     ACE_TRY_CHECK;
01296 
01297     CORBA::ULong length = any_seq->length ();
01298 
01299     for (CORBA::ULong i = 0; i < length; ++i)
01300     {
01301       TAO_ETCL_Literal_Constraint element (&any_seq[i]);
01302 
01303       if (item == element)
01304         return 1;
01305     }
01306   }
01307   ACE_CATCHANY
01308   {
01309     return 0;
01310   }
01311   ACE_ENDTRY;
01312 
01313   return 0;
01314 }
01315 
01316 CORBA::Boolean
01317 TAO_Notify_Constraint_Visitor::struct_does_contain (const CORBA::Any *any,
01318                                                     TAO_ETCL_Literal_Constraint &item)
01319 {
01320   ACE_DECLARE_NEW_CORBA_ENV;
01321   ACE_TRY
01322   {
01323     TAO_DynStruct_i dyn_struct;
01324     dyn_struct.init (*any
01325       ACE_ENV_ARG_PARAMETER);
01326     ACE_TRY_CHECK;
01327 
01328     DynamicAny::NameValuePairSeq_var members =
01329       dyn_struct.get_members (ACE_ENV_SINGLE_ARG_PARAMETER);
01330     ACE_TRY_CHECK;
01331 
01332     CORBA::ULong length = members->length ();
01333     CORBA::TypeCode_var tc;
01334     CORBA::TCKind kind;
01335 
01336     for (CORBA::ULong i = 0; i < length; ++i)
01337     {
01338       tc = members[i].value.type ();
01339       kind = TAO_DynAnyFactory::unalias (tc.in ()
01340         ACE_ENV_ARG_PARAMETER);
01341       ACE_TRY_CHECK;
01342 
01343       // The literal and the struct member must be
01344       // of the same simple type.
01345       CORBA::Boolean match = this->simple_type_match (item.expr_type (),
01346         kind);
01347 
01348       if (match == 0)
01349         continue;
01350 
01351       TAO_ETCL_Literal_Constraint element (&members[i].value);
01352 
01353       if (item == element)
01354         return 1;
01355     }
01356   }
01357   ACE_CATCHANY
01358   {
01359     return 0;
01360   }
01361   ACE_ENDTRY;
01362 
01363   return 0;
01364 }
01365 
01366 CORBA::Boolean
01367 TAO_Notify_Constraint_Visitor::union_does_contain (const CORBA::Any *any,
01368                                                    TAO_ETCL_Literal_Constraint &item)
01369 {
01370   ACE_DECLARE_NEW_CORBA_ENV;
01371   ACE_TRY
01372   {
01373     TAO_DynUnion_i dyn_union;
01374     dyn_union.init (*any
01375       ACE_ENV_ARG_PARAMETER);
01376     ACE_TRY_CHECK;
01377 
01378     DynamicAny::DynAny_var cc =
01379       dyn_union.current_component (ACE_ENV_SINGLE_ARG_PARAMETER);
01380     ACE_TRY_CHECK;
01381 
01382     CORBA::Any_var member = cc->to_any (ACE_ENV_SINGLE_ARG_PARAMETER);
01383     ACE_TRY_CHECK;
01384 
01385     CORBA::TypeCode_var tc = member->type ();
01386     CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()
01387       ACE_ENV_ARG_PARAMETER);
01388     ACE_TRY_CHECK;
01389 
01390     // The literal and the union member must be
01391     // of the same simple type.
01392     CORBA::Boolean match = this->simple_type_match (item.expr_type (),
01393       kind);
01394 
01395     if (match == 0)
01396       return 0;
01397 
01398     TAO_ETCL_Literal_Constraint element (&member.inout ());
01399 
01400     return (item == element);
01401   }
01402   ACE_CATCHANY
01403   {
01404     return 0;
01405   }
01406   ACE_ENDTRY;
01407 }
01408 
01409 CORBA::Boolean
01410 TAO_Notify_Constraint_Visitor::any_does_contain (
01411   const CORBA::Any *any,
01412   TAO_ETCL_Literal_Constraint &item
01413   )
01414 {
01415   const CORBA::Any *result = 0;
01416 
01417   *any >>= result;
01418 
01419   TAO_ETCL_Literal_Constraint element (const_cast<CORBA::Any *>(result));
01420   return item == element;
01421 }
01422 
01423 CORBA::Boolean
01424 TAO_Notify_Constraint_Visitor::simple_type_match (int expr_type,
01425                                                   CORBA::TCKind tc_kind)
01426 {
01427   switch (expr_type)
01428   {
01429   case TAO_ETCL_STRING:
01430     if (tc_kind != CORBA::tk_string)
01431       return 0;
01432     break;
01433   case TAO_ETCL_DOUBLE:
01434     if (tc_kind != CORBA::tk_double
01435       && tc_kind != CORBA::tk_float)
01436       return 0;
01437     break;
01438   case TAO_ETCL_INTEGER:
01439   case TAO_ETCL_SIGNED:
01440     if (tc_kind != CORBA::tk_short
01441       && tc_kind != CORBA::tk_long
01442       && tc_kind != CORBA::tk_longlong)
01443       return 0;
01444     break;
01445   case TAO_ETCL_UNSIGNED:
01446     if (tc_kind != CORBA::tk_ushort
01447       && tc_kind != CORBA::tk_ulong
01448       && tc_kind != CORBA::tk_ulonglong)
01449       return 0;
01450     break;
01451   case TAO_ETCL_BOOLEAN:
01452     if (tc_kind != CORBA::tk_boolean)
01453       return 0;
01454     break;
01455   default:
01456     return 0;
01457   }
01458   return 1;
01459 }
01460 
01461 const size_t TAO_Notify_Constraint_Visitor::implicit_ids_size_ = 27;
01462 const size_t TAO_Notify_Constraint_Visitor::filterable_data_size_ = 31;
01463 const size_t TAO_Notify_Constraint_Visitor::variable_header_size_ = 31;
01464 
01465 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 13:24:12 2006 for TAO_CosNotification by doxygen 1.3.6