TAO_Literal_Constraint Class Reference

TAO_Literal_Constraint represents a literal occuring in the constraint expression tree. More...

#include <Constraint_Nodes.h>

Inheritance diagram for TAO_Literal_Constraint:

Inheritance graph
[legend]
Collaboration diagram for TAO_Literal_Constraint:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_Literal_Constraint (void)
 TAO_Literal_Constraint (CORBA::Any *any)
 TAO_Literal_Constraint (CORBA::ULongLong uinteger)
 TAO_Literal_Constraint (CORBA::LongLong integer)
 TAO_Literal_Constraint (CORBA::Boolean boolean)
 TAO_Literal_Constraint (CORBA::Double doub)
 TAO_Literal_Constraint (const char *str)
 TAO_Literal_Constraint (const TAO_Literal_Constraint &lit)
 Copy constructor.
 ~TAO_Literal_Constraint (void)
 Destructor.
virtual int accept (TAO_Constraint_Visitor *visitor)
 Visitor accept methods.
virtual TAO_Expression_Type expr_type (void) const
 Return the expression type represented by this node.
void operator= (const TAO_Literal_Constraint &co)
 Assignment operator.
 operator CORBA::Boolean (void) const
 operator CORBA::ULongLong (void) const
 operator CORBA::LongLong (void) const
 operator CORBA::Double (void) const
 operator const char * (void) const
 operator const CORBA::Any * (void) const

Static Public Member Functions

static TAO_Expression_Type widest_type (const TAO_Literal_Constraint &left, const TAO_Literal_Constraint &right)
 Ensure both operands are of the same simple numeric type.
static TAO_Expression_Type comparable_type (CORBA::TypeCode_ptr type)
 Determine the comparable Expression Type from the CORBA type.

Private Member Functions

void copy (const TAO_Literal_Constraint &co)
 Private copy method.

Private Attributes

union {
   char *   str_
   CORBA::Any_ptr   any_
   CORBA::ULongLong   uinteger_
   CORBA::LongLong   integer_
   CORBA::Boolean   bool_
   CORBA::Double   double_
op_
TAO_Expression_Type type_
 The actual types of the TAO_Literal_Constraint.

Friends

TAO_Trading_Serv_Export bool operator< (const TAO_Literal_Constraint &left, const TAO_Literal_Constraint &right)
TAO_Trading_Serv_Export bool operator<= (const TAO_Literal_Constraint &left, const TAO_Literal_Constraint &right)
TAO_Trading_Serv_Export bool operator> (const TAO_Literal_Constraint &left, const TAO_Literal_Constraint &right)
TAO_Trading_Serv_Export bool operator>= (const TAO_Literal_Constraint &left, const TAO_Literal_Constraint &right)
TAO_Trading_Serv_Export bool operator== (const TAO_Literal_Constraint &left, const TAO_Literal_Constraint &right)
TAO_Trading_Serv_Export bool operator!= (const TAO_Literal_Constraint &left, const TAO_Literal_Constraint &right)
TAO_Trading_Serv_Export bool operator== (double left, const TAO_Literal_Constraint &right)
TAO_Trading_Serv_Export bool operator== (const TAO::String_Manager &left, const TAO_Literal_Constraint &right)
TAO_Trading_Serv_Export TAO_Literal_Constraint operator+ (const TAO_Literal_Constraint &left, const TAO_Literal_Constraint &right)
TAO_Trading_Serv_Export TAO_Literal_Constraint operator- (const TAO_Literal_Constraint &left, const TAO_Literal_Constraint &right)
TAO_Trading_Serv_Export TAO_Literal_Constraint operator * (const TAO_Literal_Constraint &left, const TAO_Literal_Constraint &right)
TAO_Trading_Serv_Export TAO_Literal_Constraint operator/ (const TAO_Literal_Constraint &left, const TAO_Literal_Constraint &right)
TAO_Trading_Serv_Export TAO_Literal_Constraint operator- (const TAO_Literal_Constraint &operand)

Detailed Description

TAO_Literal_Constraint represents a literal occuring in the constraint expression tree.

Definition at line 222 of file Constraint_Nodes.h.


Constructor & Destructor Documentation

TAO_Literal_Constraint::TAO_Literal_Constraint ( void   ) 

Definition at line 293 of file Constraint_Nodes.cpp.

00294   : type_ (TAO_UNKNOWN)
00295 {
00296 }

TAO_Literal_Constraint::TAO_Literal_Constraint ( CORBA::Any *  any  ) 

Definition at line 307 of file Constraint_Nodes.cpp.

References comparable_type(), TAO_Pseudo_Var_T< T >::in(), op_, CORBA::string_dup(), TAO_BOOLEAN, TAO_DOUBLE, TAO_SEQUENCE, TAO_SIGNED, TAO_STRING, TAO_UNSIGNED, CORBA::tk_float, CORBA::tk_long, CORBA::tk_null, CORBA::tk_short, CORBA::tk_ulong, CORBA::tk_ushort, and type_.

00308 {
00309   CORBA::Any& any_ref = *any;
00310   CORBA::TypeCode_var type = any_ref.type ();
00311   // @@ No where to throw exception back.
00312   CORBA::TCKind corba_type = CORBA::tk_null;
00313   try
00314     {
00315       corba_type = type->kind ();
00316     }
00317   catch (const CORBA::Exception&)
00318     {
00319       // @@ Seth: Don't know what else to do.  Make sure we can tell
00320       // when this constructor fails.
00321       return;
00322     }
00323 
00324   this->type_ = TAO_Literal_Constraint::comparable_type (type.in ());
00325   switch (this->type_)
00326     {
00327     case TAO_SIGNED:
00328       this->op_.integer_ = 0;
00329       if (corba_type == CORBA::tk_short)
00330         {
00331           CORBA::Short sh;
00332           any_ref >>= sh;
00333           this->op_.integer_ = static_cast<CORBA::LongLong> (sh);
00334         }
00335       else if (corba_type == CORBA::tk_long)
00336         {
00337           CORBA::Long sh;
00338           any_ref >>= sh;
00339           this->op_.integer_ = static_cast<CORBA::LongLong> (sh);
00340         }
00341       else
00342         any_ref >>= this->op_.integer_;
00343       break;
00344     case TAO_UNSIGNED:
00345       this->op_.uinteger_ = 0;
00346       if (corba_type == CORBA::tk_ushort)
00347         {
00348           CORBA::UShort sh;
00349           any_ref >>= sh;
00350           this->op_.uinteger_ = static_cast<CORBA::ULongLong> (sh);
00351         }
00352       else if (corba_type == CORBA::tk_ulong)
00353         {
00354           CORBA::ULong sh;
00355           any_ref >>= sh;
00356           this->op_.uinteger_ = static_cast<CORBA::ULongLong> (sh);
00357         }
00358       else
00359         any_ref >>= this->op_.uinteger_;
00360       break;
00361     case TAO_DOUBLE:
00362       if (corba_type == CORBA::tk_float)
00363         {
00364           CORBA::Float fl;
00365           (*any) >>= fl;
00366           this->op_.double_ = (CORBA::Double) fl;
00367         }
00368       else
00369         (*any) >>= this->op_.double_;
00370       break;
00371     case TAO_BOOLEAN:
00372       {
00373         CORBA::Any::to_boolean tmp (this->op_.bool_);
00374         (*any) >>= tmp;
00375       }
00376     break;
00377     case TAO_STRING:
00378       {
00379         const char* s;
00380         any_ref >>= s;
00381         this->op_.str_ = CORBA::string_dup (s);
00382       }
00383     break;
00384     case TAO_SEQUENCE:
00385       this->op_.any_ = any;
00386     }
00387 }

TAO_Literal_Constraint::TAO_Literal_Constraint ( CORBA::ULongLong  uinteger  ) 

Definition at line 389 of file Constraint_Nodes.cpp.

References op_.

00390   : type_ (TAO_UNSIGNED)
00391 {
00392   this->op_.uinteger_ = uinteger;
00393 }

TAO_Literal_Constraint::TAO_Literal_Constraint ( CORBA::LongLong  integer  ) 

Definition at line 395 of file Constraint_Nodes.cpp.

References op_.

00396   : type_ (TAO_SIGNED)
00397 {
00398   this->op_.integer_ = integer;
00399 }

TAO_Literal_Constraint::TAO_Literal_Constraint ( CORBA::Boolean  boolean  ) 

Definition at line 401 of file Constraint_Nodes.cpp.

References op_.

00402   : type_ (TAO_BOOLEAN)
00403 {
00404   this->op_.bool_ = boolean;
00405 }

TAO_Literal_Constraint::TAO_Literal_Constraint ( CORBA::Double  doub  ) 

Definition at line 407 of file Constraint_Nodes.cpp.

References op_.

00408   : type_ (TAO_DOUBLE)
00409 {
00410   this->op_.double_ = doub;
00411 }

TAO_Literal_Constraint::TAO_Literal_Constraint ( const char *  str  ) 

Definition at line 413 of file Constraint_Nodes.cpp.

References op_, and CORBA::string_dup().

00414   : type_ (TAO_STRING)
00415 {
00416   this->op_.str_ = CORBA::string_dup (str);
00417 }

TAO_Literal_Constraint::TAO_Literal_Constraint ( const TAO_Literal_Constraint lit  ) 

Copy constructor.

Definition at line 299 of file Constraint_Nodes.cpp.

References copy().

00300   : TAO_Constraint (lit)
00301 {
00302   this->copy (lit);
00303 }

TAO_Literal_Constraint::~TAO_Literal_Constraint ( void   ) 

Destructor.

Definition at line 419 of file Constraint_Nodes.cpp.

References CORBA::string_free(), and TAO_STRING.

00420 {
00421   if (this->type_ == TAO_STRING)
00422     CORBA::string_free (this->op_.str_);
00423 }


Member Function Documentation

int TAO_Literal_Constraint::accept ( TAO_Constraint_Visitor visitor  )  [virtual]

Visitor accept methods.

Implements TAO_Constraint.

Definition at line 426 of file Constraint_Nodes.cpp.

References TAO_Constraint_Visitor::visit_literal().

00427 {
00428   return visitor->visit_literal (this);
00429 }

TAO_Expression_Type TAO_Literal_Constraint::comparable_type ( CORBA::TypeCode_ptr  type  )  [static]

Determine the comparable Expression Type from the CORBA type.

Definition at line 510 of file Constraint_Nodes.cpp.

References TAO_BOOLEAN, TAO_DOUBLE, TAO_SEQUENCE, TAO_SIGNED, TAO_STRING, TAO_UNKNOWN, TAO_UNSIGNED, CORBA::tk_alias, CORBA::tk_boolean, CORBA::tk_double, CORBA::tk_float, CORBA::tk_long, CORBA::tk_longlong, CORBA::tk_null, CORBA::tk_sequence, CORBA::tk_short, CORBA::tk_string, CORBA::tk_ulong, CORBA::tk_ulonglong, CORBA::tk_ushort, and CORBA::tk_void.

Referenced by TAO_Constraint_Validator::extract_type(), and TAO_Literal_Constraint().

00511 {
00512   // Convert a CORBA::TCKind into a TAO_Literal_Type
00513   TAO_Expression_Type return_value = TAO_UNKNOWN;
00514   CORBA::TCKind kind = CORBA::tk_null;
00515   try
00516     {
00517       kind = type->kind ();
00518     }
00519   catch (const CORBA::Exception&)
00520     {
00521       return return_value;
00522     }
00523   // Since this is a "top level try block, no need to check again.
00524 
00525   switch (kind)
00526     {
00527     case CORBA::tk_ushort:
00528     case CORBA::tk_ulong:
00529     case CORBA::tk_ulonglong:
00530       return_value = TAO_UNSIGNED;
00531       break;
00532     case CORBA::tk_long:
00533     case CORBA::tk_short:
00534     case CORBA::tk_longlong:
00535       return_value = TAO_SIGNED;
00536       break;
00537     case CORBA::tk_boolean:
00538       return_value = TAO_BOOLEAN;
00539       break;
00540     case CORBA::tk_float:
00541     case CORBA::tk_double:
00542       return_value = TAO_DOUBLE;
00543       break;
00544     case CORBA::tk_string:
00545       return_value = TAO_STRING;
00546       break;
00547     case CORBA::tk_sequence:
00548       return_value = TAO_SEQUENCE;
00549       break;
00550     case CORBA::tk_alias:
00551       {
00552         CORBA::TCKind kind = CORBA::tk_void;
00553         try
00554           {
00555             CORBA::TypeCode_var typecode = type->content_type ();
00556             kind = typecode->kind ();
00557             ;
00558           }
00559         catch (const CORBA::Exception&)
00560           {
00561             return return_value;
00562           }
00563         // Since this is a "top level try block, no need to check again.
00564 
00565         if (kind == CORBA::tk_sequence)
00566           return_value = TAO_SEQUENCE;
00567       }
00568     break;
00569     default:
00570       return_value = TAO_UNKNOWN;
00571     }
00572 
00573   return return_value;
00574 }

void TAO_Literal_Constraint::copy ( const TAO_Literal_Constraint co  )  [private]

Private copy method.

Definition at line 950 of file Constraint_Nodes.cpp.

References any_, bool_, double_, integer_, op_, str_, CORBA::string_dup(), TAO_BOOLEAN, TAO_DOUBLE, TAO_SEQUENCE, TAO_SIGNED, TAO_STRING, TAO_UNKNOWN, TAO_UNSIGNED, type_, and uinteger_.

Referenced by operator=(), and TAO_Literal_Constraint().

00951 {
00952   this->type_ = lit.type_;
00953   if (this->type_ == TAO_STRING)
00954     this->op_.str_ = CORBA::string_dup (lit.op_.str_);
00955   else if (this->type_ == TAO_DOUBLE)
00956     this->op_.double_ = lit.op_.double_;
00957   else if (this->type_ == TAO_UNSIGNED)
00958     this->op_.uinteger_ = lit.op_.uinteger_;
00959   else if (this->type_ == TAO_SIGNED)
00960     this->op_.integer_ = lit.op_.integer_;
00961   else if (this->type_ == TAO_BOOLEAN)
00962     this->op_.bool_ = lit.op_.bool_;
00963   else if (this->type_ == TAO_SEQUENCE)
00964     this->op_.any_ = lit.op_.any_;
00965   else
00966     type_ = TAO_UNKNOWN;
00967 }

virtual TAO_Expression_Type TAO_Literal_Constraint::expr_type ( void   )  const [inline, virtual]

Return the expression type represented by this node.

Implements TAO_Constraint.

Definition at line 246 of file Constraint_Nodes.h.

Referenced by operator-(), and widest_type().

00247     { return type_; }

TAO_Literal_Constraint::operator const char * ( void   )  const

Definition at line 499 of file Constraint_Nodes.cpp.

References op_, and TAO_STRING.

00500 {
00501   return (this->type_ == TAO_STRING) ? this->op_.str_ : 0;
00502 }

TAO_Literal_Constraint::operator const CORBA::Any * ( void   )  const

Definition at line 504 of file Constraint_Nodes.cpp.

References op_, and TAO_SEQUENCE.

00505 {
00506   return (this->type_ == TAO_SEQUENCE) ? this->op_.any_ : 0;
00507 }

TAO_Literal_Constraint::operator CORBA::Boolean ( void   )  const

Definition at line 437 of file Constraint_Nodes.cpp.

References op_, and TAO_BOOLEAN.

00438 {
00439   return (this->type_ == TAO_BOOLEAN) ? this->op_.bool_ : 0;
00440 }

TAO_Literal_Constraint::operator CORBA::Double ( void   )  const

Definition at line 485 of file Constraint_Nodes.cpp.

References op_, TAO_DOUBLE, TAO_SIGNED, and TAO_UNSIGNED.

00486 {
00487   CORBA::Double return_value = 0.0;
00488 
00489   if (this->type_ == TAO_DOUBLE)
00490     return_value = this->op_.double_;
00491   else if (this->type_ == TAO_SIGNED)
00492     return_value = (CORBA::Double) this->op_.integer_;
00493   else if (this->type_ == TAO_UNSIGNED)
00494     return_value = (CORBA::Double) this->op_.uinteger_;
00495 
00496   return return_value;
00497 }

TAO_Literal_Constraint::operator CORBA::LongLong ( void   )  const

Definition at line 462 of file Constraint_Nodes.cpp.

References ACE_INT64_MAX, ACE_INT64_MIN, op_, TAO_DOUBLE, TAO_SIGNED, and TAO_UNSIGNED.

00463 {
00464   CORBA::LongLong return_value = 0;
00465 
00466   if (this->type_ == TAO_SIGNED)
00467     return_value = this->op_.integer_;
00468   else if (this->type_ == TAO_UNSIGNED)
00469     return_value =
00470       (this->op_.uinteger_ > static_cast<CORBA::ULongLong> (ACE_INT64_MAX)) ?
00471       ACE_INT64_MAX : static_cast<CORBA::LongLong> (this->op_.uinteger_);
00472   else if (this->type_ == TAO_DOUBLE)
00473     return_value  =
00474       (this->op_.double_ > 0) ?
00475       ((this->op_.double_ > ACE_INT64_MAX) ?
00476        ACE_INT64_MAX :
00477        static_cast<CORBA::LongLong> (this->op_.double_)) :
00478     ((this->op_.double_ < ACE_INT64_MIN) ?
00479      ACE_INT64_MIN :
00480      static_cast<CORBA::LongLong> (this->op_.double_));
00481 
00482   return return_value;
00483 }

TAO_Literal_Constraint::operator CORBA::ULongLong ( void   )  const

Definition at line 442 of file Constraint_Nodes.cpp.

References ACE_UINT64_MAX, op_, TAO_DOUBLE, TAO_SIGNED, and TAO_UNSIGNED.

00443 {
00444   CORBA::ULongLong return_value = 0;
00445 
00446   if (this->type_ == TAO_UNSIGNED)
00447     return_value = this->op_.uinteger_;
00448   else if (this->type_ == TAO_SIGNED)
00449     return_value =
00450       (this->op_.integer_ > 0) ?
00451         static_cast<CORBA::ULongLong> (this->op_.integer_) : 0;
00452   else if (this->type_ == TAO_DOUBLE)
00453     return_value =
00454       (this->op_.double_ > 0) ?
00455       ((this->op_.double_ > ACE_UINT64_MAX) ?
00456        ACE_UINT64_MAX :
00457        static_cast<CORBA::ULongLong> (this->op_.double_)) : 0;
00458 
00459   return return_value;
00460 }

void TAO_Literal_Constraint::operator= ( const TAO_Literal_Constraint co  ) 

Assignment operator.

Definition at line 432 of file Constraint_Nodes.cpp.

References copy().

00433 {
00434   this->copy (co);
00435 }

TAO_Expression_Type TAO_Literal_Constraint::widest_type ( const TAO_Literal_Constraint left,
const TAO_Literal_Constraint right 
) [static]

Ensure both operands are of the same simple numeric type.

Definition at line 931 of file Constraint_Nodes.cpp.

References expr_type().

Referenced by operator *(), operator!=(), operator+(), operator-(), operator/(), operator<(), operator<=(), operator==(), operator>(), and operator>=().

00933 {
00934   TAO_Expression_Type left_type = left.expr_type (),
00935     right_type = right.expr_type (),
00936     return_value = right_type;
00937 
00938   if (right_type != left_type)
00939     {
00940       if (right_type > left_type)
00941         return_value = right_type;
00942       else
00943         return_value = left_type;
00944     }
00945 
00946   return return_value;
00947 }


Friends And Related Function Documentation

TAO_Trading_Serv_Export TAO_Literal_Constraint operator * ( const TAO_Literal_Constraint left,
const TAO_Literal_Constraint right 
) [friend]

Definition at line 843 of file Constraint_Nodes.cpp.

00845 {
00846   TAO_Expression_Type widest_type =
00847     TAO_Literal_Constraint::widest_type (left, right);
00848 
00849   switch (widest_type)
00850     {
00851     case TAO_DOUBLE:
00852       {
00853         CORBA::Double result = (CORBA::Double) left * (CORBA::Double) right;
00854         return TAO_Literal_Constraint (result);
00855       }
00856     case TAO_SIGNED:
00857       {
00858         CORBA::LongLong result = static_cast<CORBA::LongLong> (left) *
00859                                  static_cast<CORBA::LongLong> (right);
00860         return TAO_Literal_Constraint (result);
00861       }
00862     case TAO_UNSIGNED:
00863       {
00864         CORBA::ULongLong result = static_cast<CORBA::ULongLong> (left) *
00865                                   static_cast<CORBA::ULongLong> (right);
00866         return TAO_Literal_Constraint (result);
00867       }
00868     default:
00869       return TAO_Literal_Constraint (static_cast<CORBA::LongLong> (0));
00870     }
00871 }

TAO_Trading_Serv_Export bool operator!= ( const TAO_Literal_Constraint left,
const TAO_Literal_Constraint right 
) [friend]

Definition at line 610 of file Constraint_Nodes.cpp.

00612 {
00613   bool return_value = false;
00614   TAO_Expression_Type widest_type =
00615     TAO_Literal_Constraint::widest_type (left, right);
00616 
00617   switch (widest_type)
00618     {
00619     case TAO_STRING:
00620       return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) != 0);
00621       break;
00622     case TAO_DOUBLE:
00623       return_value = (CORBA::Double) left != (CORBA::Double) right;
00624       break;
00625     case TAO_SIGNED:
00626       return_value = static_cast<CORBA::LongLong> (left) !=
00627                      static_cast<CORBA::LongLong> (right);
00628       break;
00629     case TAO_UNSIGNED:
00630       return_value = static_cast<CORBA::ULongLong> (left) !=
00631                      static_cast<CORBA::ULongLong> (right);
00632       break;
00633     case TAO_BOOLEAN:
00634       return_value = (CORBA::Boolean) left != (CORBA::Boolean) right;
00635       break;
00636     }
00637 
00638   return return_value;
00639 }

TAO_Trading_Serv_Export TAO_Literal_Constraint operator+ ( const TAO_Literal_Constraint left,
const TAO_Literal_Constraint right 
) [friend]

Definition at line 781 of file Constraint_Nodes.cpp.

00783 {
00784   TAO_Expression_Type widest_type =
00785     TAO_Literal_Constraint::widest_type (left, right);
00786 
00787   switch (widest_type)
00788     {
00789     case TAO_DOUBLE:
00790       {
00791         CORBA::Double result = (CORBA::Double) left + (CORBA::Double) right;
00792         return TAO_Literal_Constraint (result);
00793       }
00794     case TAO_SIGNED:
00795       {
00796         CORBA::LongLong result = static_cast<CORBA::LongLong> (left) +
00797                                  static_cast<CORBA::LongLong> (right);
00798         return TAO_Literal_Constraint (result);
00799       }
00800     case TAO_UNSIGNED:
00801       {
00802         CORBA::ULongLong result = static_cast<CORBA::ULongLong> (left) +
00803                                   static_cast<CORBA::ULongLong> (right);
00804         return TAO_Literal_Constraint (result);
00805       }
00806     default:
00807       return TAO_Literal_Constraint (static_cast<CORBA::LongLong> (0));
00808     }
00809 }

TAO_Trading_Serv_Export TAO_Literal_Constraint operator- ( const TAO_Literal_Constraint operand  )  [friend]

Definition at line 905 of file Constraint_Nodes.cpp.

00906 {
00907   switch (operand.expr_type ())
00908     {
00909     case TAO_DOUBLE:
00910       {
00911         CORBA::Double result = - (CORBA::Double) operand;
00912         return TAO_Literal_Constraint (result);
00913       }
00914     case TAO_SIGNED:
00915       {
00916         CORBA::LongLong result = - static_cast<CORBA::LongLong> (operand);
00917         return TAO_Literal_Constraint (result);
00918       }
00919     case TAO_UNSIGNED:
00920       {
00921         CORBA::LongLong result = - static_cast<CORBA::LongLong> (
00922                                      static_cast<CORBA::ULongLong> (operand));
00923         return TAO_Literal_Constraint (static_cast<CORBA::ULongLong> (result));
00924       }
00925     default:
00926       return TAO_Literal_Constraint (static_cast<CORBA::LongLong> (0));
00927     }
00928 }

TAO_Trading_Serv_Export TAO_Literal_Constraint operator- ( const TAO_Literal_Constraint left,
const TAO_Literal_Constraint right 
) [friend]

Definition at line 812 of file Constraint_Nodes.cpp.

00814 {
00815   TAO_Expression_Type widest_type =
00816     TAO_Literal_Constraint::widest_type (left, right);
00817 
00818   switch (widest_type)
00819     {
00820     case TAO_DOUBLE:
00821       {
00822         CORBA::Double result = (CORBA::Double) left - (CORBA::Double) right;
00823         return TAO_Literal_Constraint (result);
00824       }
00825     case TAO_SIGNED:
00826       {
00827         CORBA::LongLong result = static_cast<CORBA::LongLong> (left) -
00828                                  static_cast<CORBA::LongLong> (right);
00829         return TAO_Literal_Constraint (result);
00830       }
00831     case TAO_UNSIGNED:
00832       {
00833         CORBA::ULongLong result = static_cast<CORBA::ULongLong> (left) -
00834                                   static_cast<CORBA::ULongLong> (right);
00835         return TAO_Literal_Constraint (result);
00836       }
00837     default:
00838       return TAO_Literal_Constraint (static_cast<CORBA::LongLong> (0));
00839     }
00840 }

TAO_Trading_Serv_Export TAO_Literal_Constraint operator/ ( const TAO_Literal_Constraint left,
const TAO_Literal_Constraint right 
) [friend]

Definition at line 874 of file Constraint_Nodes.cpp.

00876 {
00877   TAO_Expression_Type widest_type =
00878     TAO_Literal_Constraint::widest_type (left, right);
00879 
00880   switch (widest_type)
00881     {
00882     case TAO_DOUBLE:
00883       {
00884         CORBA::Double result = (CORBA::Double) left / (CORBA::Double) right;
00885         return TAO_Literal_Constraint (result);
00886       }
00887     case TAO_SIGNED:
00888       {
00889         CORBA::LongLong result = static_cast<CORBA::LongLong> (left) /
00890                                  static_cast<CORBA::LongLong> (right);
00891         return TAO_Literal_Constraint (result);
00892       }
00893     case TAO_UNSIGNED:
00894       {
00895         CORBA::ULongLong result = static_cast<CORBA::ULongLong> (left) /
00896                                   static_cast<CORBA::ULongLong> (right);
00897         return TAO_Literal_Constraint (result);
00898       }
00899     default:
00900       return TAO_Literal_Constraint (static_cast<CORBA::LongLong> (0));
00901     }
00902 }

TAO_Trading_Serv_Export bool operator< ( const TAO_Literal_Constraint left,
const TAO_Literal_Constraint right 
) [friend]

Definition at line 642 of file Constraint_Nodes.cpp.

00644 {
00645   bool return_value = false;
00646   TAO_Expression_Type widest_type =
00647     TAO_Literal_Constraint::widest_type (left, right);
00648 
00649   switch (widest_type)
00650     {
00651     case TAO_STRING:
00652       return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) < 0);
00653       break;
00654     case TAO_DOUBLE:
00655       return_value = (CORBA::Double) left < (CORBA::Double) right;
00656       break;
00657     case TAO_SIGNED:
00658       return_value = static_cast<CORBA::LongLong> (left) <
00659                      static_cast<CORBA::LongLong> (right);
00660       break;
00661     case TAO_UNSIGNED:
00662       return_value = static_cast<CORBA::ULongLong> (left) <
00663                      static_cast<CORBA::ULongLong> (right);
00664       break;
00665     case TAO_BOOLEAN:
00666       return_value = (CORBA::Boolean) left < (CORBA::Boolean) right;
00667       break;
00668     }
00669 
00670   return return_value;
00671 }

TAO_Trading_Serv_Export bool operator<= ( const TAO_Literal_Constraint left,
const TAO_Literal_Constraint right 
) [friend]

Definition at line 674 of file Constraint_Nodes.cpp.

00676 {
00677   bool return_value = false;
00678   TAO_Expression_Type widest_type =
00679     TAO_Literal_Constraint::widest_type (left, right);
00680 
00681   switch (widest_type)
00682     {
00683     case TAO_STRING:
00684       return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) <= 0);
00685       break;
00686     case TAO_DOUBLE:
00687       return_value = (CORBA::Double) left <= (CORBA::Double) right;
00688       break;
00689     case TAO_SIGNED:
00690       return_value = static_cast<CORBA::LongLong> (left) <=
00691                      static_cast<CORBA::LongLong> (right);
00692       break;
00693     case TAO_UNSIGNED:
00694       return_value = static_cast<CORBA::ULongLong> (left) <=
00695                      static_cast<CORBA::ULongLong> (right);
00696       break;
00697     }
00698 
00699   return return_value;
00700 }

TAO_Trading_Serv_Export bool operator== ( const TAO::String_Manager left,
const TAO_Literal_Constraint right 
) [friend]

Definition at line 768 of file Constraint_Nodes.cpp.

00770 {
00771   bool result = false;
00772 
00773   if ((const char*) right != 0)
00774     result = ACE_OS::strcmp ((const char*) left,
00775                              (const char*) right) == 0;
00776   return result;
00777 }

TAO_Trading_Serv_Export bool operator== ( double  left,
const TAO_Literal_Constraint right 
) [friend]

TAO_Trading_Serv_Export bool operator== ( const TAO_Literal_Constraint left,
const TAO_Literal_Constraint right 
) [friend]

Definition at line 577 of file Constraint_Nodes.cpp.

00579 {
00580   bool return_value = false;
00581   TAO_Expression_Type widest_type =
00582     TAO_Literal_Constraint::widest_type (left, right);
00583 
00584   switch (widest_type)
00585     {
00586     case TAO_STRING:
00587       return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) == 0);
00588       break;
00589     case TAO_DOUBLE:
00590       return_value = (CORBA::Double) left == (CORBA::Double) right;
00591       break;
00592     case TAO_SIGNED:
00593       return_value = static_cast<CORBA::LongLong> (left) ==
00594                      static_cast<CORBA::LongLong> (right);
00595       break;
00596     case TAO_UNSIGNED:
00597       return_value = static_cast<CORBA::ULongLong> (left) ==
00598                      static_cast<CORBA::ULongLong> (right);
00599       break;
00600     case TAO_BOOLEAN:
00601       return_value = (CORBA::Boolean) left == (CORBA::Boolean) right;
00602       break;
00603     }
00604 
00605   return return_value;
00606 }

TAO_Trading_Serv_Export bool operator> ( const TAO_Literal_Constraint left,
const TAO_Literal_Constraint right 
) [friend]

Definition at line 703 of file Constraint_Nodes.cpp.

00705 {
00706   bool return_value = false;
00707   TAO_Expression_Type widest_type =
00708     TAO_Literal_Constraint::widest_type (left, right);
00709 
00710   switch (widest_type)
00711     {
00712     case TAO_STRING:
00713       return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) > 0);
00714       break;
00715     case TAO_DOUBLE:
00716       return_value = (CORBA::Double) left > (CORBA::Double) right;
00717       break;
00718     case TAO_SIGNED:
00719       return_value = static_cast<CORBA::LongLong> (left) >
00720                      static_cast<CORBA::LongLong> (right);
00721       break;
00722     case TAO_UNSIGNED:
00723       return_value = static_cast<CORBA::ULongLong> (left) >
00724                      static_cast<CORBA::ULongLong> (right);
00725       break;
00726     }
00727 
00728   return return_value;
00729 }

TAO_Trading_Serv_Export bool operator>= ( const TAO_Literal_Constraint left,
const TAO_Literal_Constraint right 
) [friend]

Definition at line 732 of file Constraint_Nodes.cpp.

00734 {
00735   bool return_value = false;
00736   TAO_Expression_Type widest_type =
00737     TAO_Literal_Constraint::widest_type (left, right);
00738 
00739   switch (widest_type)
00740     {
00741     case TAO_STRING:
00742       return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) >= 0);
00743       break;
00744     case TAO_DOUBLE:
00745       return_value = (CORBA::Double) left >= (CORBA::Double) right;
00746       break;
00747     case TAO_SIGNED:
00748       return_value = static_cast<CORBA::LongLong> (left) >=
00749                      static_cast<CORBA::LongLong> (right);
00750       break;
00751     case TAO_UNSIGNED:
00752       return_value = static_cast<CORBA::ULongLong> (left) >=
00753                      static_cast<CORBA::ULongLong> (right);
00754       break;
00755     }
00756 
00757   return return_value;
00758 }


Member Data Documentation

CORBA::Any_ptr TAO_Literal_Constraint::any_ [private]

Definition at line 334 of file Constraint_Nodes.h.

Referenced by copy().

CORBA::Boolean TAO_Literal_Constraint::bool_ [private]

Definition at line 337 of file Constraint_Nodes.h.

Referenced by copy().

CORBA::Double TAO_Literal_Constraint::double_ [private]

Definition at line 338 of file Constraint_Nodes.h.

Referenced by copy().

CORBA::LongLong TAO_Literal_Constraint::integer_ [private]

Definition at line 336 of file Constraint_Nodes.h.

Referenced by copy().

union { ... } TAO_Literal_Constraint::op_ [private]

Referenced by copy(), operator const char *(), operator const CORBA::Any *(), operator CORBA::Boolean(), operator CORBA::Double(), operator CORBA::LongLong(), operator CORBA::ULongLong(), and TAO_Literal_Constraint().

char* TAO_Literal_Constraint::str_ [private]

Definition at line 333 of file Constraint_Nodes.h.

Referenced by copy().

TAO_Expression_Type TAO_Literal_Constraint::type_ [private]

The actual types of the TAO_Literal_Constraint.

Definition at line 343 of file Constraint_Nodes.h.

Referenced by copy(), and TAO_Literal_Constraint().

CORBA::ULongLong TAO_Literal_Constraint::uinteger_ [private]

Definition at line 335 of file Constraint_Nodes.h.

Referenced by copy().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:49:32 2010 for TAO_CosTrader by  doxygen 1.4.7