#include <Constraint_Nodes.h>
Inheritance diagram for TAO_Literal_Constraint:
Definition at line 225 of file Constraint_Nodes.h.
|
Definition at line 229 of file Constraint_Nodes.h. References TAO_UNKNOWN.
00230 : type_ (TAO_UNKNOWN) {} |
|
Definition at line 295 of file Constraint_Nodes.cpp. References ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_TRY, ACE_TRY_CHECK, comparable_type(), CORBA::string_dup(), TAO_BOOLEAN, TAO_DOUBLE, TAO_SEQUENCE, TAO_SIGNED, TAO_STRING, and TAO_UNSIGNED.
00296 { 00297 ACE_DECLARE_NEW_CORBA_ENV; 00298 CORBA::Any& any_ref = *any; 00299 CORBA::TypeCode_var type = any_ref.type (); 00300 // @@ No where to throw exception back. 00301 CORBA::TCKind corba_type = CORBA::tk_null; 00302 ACE_TRY 00303 { 00304 corba_type = type->kind (ACE_ENV_SINGLE_ARG_PARAMETER); 00305 ACE_TRY_CHECK; 00306 } 00307 ACE_CATCHANY 00308 { 00309 // @@ Seth: Don't know what else to do. Make sure we can tell 00310 // when this constructor fails. 00311 return; 00312 } 00313 ACE_ENDTRY; 00314 00315 this->type_ = TAO_Literal_Constraint::comparable_type (type.in ()); 00316 switch (this->type_) 00317 { 00318 case TAO_SIGNED: 00319 this->op_.integer_ = 0; 00320 if (corba_type == CORBA::tk_short) 00321 { 00322 CORBA::Short sh; 00323 any_ref >>= sh; 00324 this->op_.integer_ = (CORBA::Long) sh; 00325 } 00326 else 00327 any_ref >>= this->op_.integer_; 00328 break; 00329 case TAO_UNSIGNED: 00330 this->op_.uinteger_ = 0; 00331 if (corba_type == CORBA::tk_ushort) 00332 { 00333 CORBA::UShort sh; 00334 any_ref >>= sh; 00335 this->op_.uinteger_ = (CORBA::ULong) sh; 00336 } 00337 else 00338 any_ref >>= this->op_.uinteger_; 00339 break; 00340 case TAO_DOUBLE: 00341 if (corba_type == CORBA::tk_float) 00342 { 00343 CORBA::Float fl; 00344 (*any) >>= fl; 00345 this->op_.double_ = (CORBA::Double) fl; 00346 } 00347 else 00348 (*any) >>= this->op_.double_; 00349 break; 00350 case TAO_BOOLEAN: 00351 { 00352 CORBA::Any::to_boolean tmp (this->op_.bool_); 00353 (*any) >>= tmp; 00354 } 00355 break; 00356 case TAO_STRING: 00357 { 00358 const char* s; 00359 any_ref >>= s; 00360 this->op_.str_ = CORBA::string_dup (s); 00361 } 00362 break; 00363 case TAO_SEQUENCE: 00364 this->op_.any_ = any; 00365 } 00366 } |
|
Definition at line 368 of file Constraint_Nodes.cpp. References TAO_UNSIGNED.
|
|
Definition at line 374 of file Constraint_Nodes.cpp. References TAO_SIGNED.
|
|
Definition at line 380 of file Constraint_Nodes.cpp. References TAO_BOOLEAN.
|
|
Definition at line 386 of file Constraint_Nodes.cpp. References TAO_DOUBLE.
|
|
Definition at line 392 of file Constraint_Nodes.cpp. References CORBA::string_dup(), and TAO_STRING.
00393 : type_ (TAO_STRING) 00394 { 00395 this->op_.str_ = CORBA::string_dup (str); 00396 } |
|
Copy constructor.
Definition at line 287 of file Constraint_Nodes.cpp. References copy().
00288 : TAO_Constraint (lit) 00289 { 00290 this->copy (lit); 00291 } |
|
Destructor.
Definition at line 398 of file Constraint_Nodes.cpp. References CORBA::string_free(), and TAO_STRING.
00399 { 00400 if (this->type_ == TAO_STRING) 00401 CORBA::string_free (this->op_.str_); 00402 } |
|
Visitor accept methods.
Implements TAO_Constraint. Definition at line 405 of file Constraint_Nodes.cpp. References TAO_Constraint_Visitor::visit_literal().
00406 { 00407 return visitor->visit_literal (this); 00408 } |
|
Determine the comparable Expression Type from the CORBA type.
Definition at line 489 of file Constraint_Nodes.cpp. References ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_TRY, ACE_TRY_CHECK, ACE_TRY_CHECK_EX, ACE_TRY_EX, TAO_BOOLEAN, TAO_DOUBLE, TAO_Expression_Type, TAO_SEQUENCE, TAO_SIGNED, TAO_STRING, TAO_UNKNOWN, and TAO_UNSIGNED. Referenced by TAO_Constraint_Validator::extract_type(), and TAO_Literal_Constraint().
00490 { 00491 // Convert a CORBA::TCKind into a TAO_Literal_Type 00492 ACE_DECLARE_NEW_CORBA_ENV; 00493 TAO_Expression_Type return_value = TAO_UNKNOWN; 00494 CORBA::TCKind kind = CORBA::tk_null; 00495 ACE_TRY 00496 { 00497 kind = type->kind (ACE_ENV_SINGLE_ARG_PARAMETER); 00498 ACE_TRY_CHECK; 00499 } 00500 ACE_CATCHANY 00501 { 00502 return return_value; 00503 } 00504 ACE_ENDTRY; 00505 // Since this is a "top level try block, no need to check again. 00506 00507 switch (kind) 00508 { 00509 case CORBA::tk_ushort: 00510 case CORBA::tk_ulong: 00511 return_value = TAO_UNSIGNED; 00512 break; 00513 case CORBA::tk_long: 00514 case CORBA::tk_short: 00515 return_value = TAO_SIGNED; 00516 break; 00517 case CORBA::tk_boolean: 00518 return_value = TAO_BOOLEAN; 00519 break; 00520 case CORBA::tk_float: 00521 case CORBA::tk_double: 00522 return_value = TAO_DOUBLE; 00523 break; 00524 case CORBA::tk_string: 00525 return_value = TAO_STRING; 00526 break; 00527 case CORBA::tk_sequence: 00528 return_value = TAO_SEQUENCE; 00529 break; 00530 case CORBA::tk_alias: 00531 { 00532 CORBA::TCKind kind = CORBA::tk_void; 00533 ACE_TRY_EX (label2) 00534 { 00535 CORBA::TypeCode_var typecode = type->content_type (ACE_ENV_SINGLE_ARG_PARAMETER); 00536 ACE_TRY_CHECK_EX (label2); 00537 kind = typecode->kind (ACE_ENV_SINGLE_ARG_PARAMETER); 00538 ACE_TRY_CHECK_EX (label2);; 00539 } 00540 ACE_CATCHANY 00541 { 00542 return return_value; 00543 } 00544 ACE_ENDTRY; 00545 // Since this is a "top level try block, no need to check again. 00546 00547 if (kind == CORBA::tk_sequence) 00548 return_value = TAO_SEQUENCE; 00549 } 00550 break; 00551 default: 00552 return_value = TAO_UNKNOWN; 00553 } 00554 00555 return return_value; 00556 } |
|
Private copy method.
Definition at line 911 of file Constraint_Nodes.cpp. References op_, CORBA::string_dup(), TAO_BOOLEAN, TAO_DOUBLE, TAO_SEQUENCE, TAO_SIGNED, TAO_STRING, TAO_UNKNOWN, TAO_UNSIGNED, and type_. Referenced by operator=(), and TAO_Literal_Constraint().
00912 { 00913 this->type_ = lit.type_; 00914 if (this->type_ == TAO_STRING) 00915 this->op_.str_ = CORBA::string_dup (lit.op_.str_); 00916 else if (this->type_ == TAO_DOUBLE) 00917 this->op_.double_ = lit.op_.double_; 00918 else if (this->type_ == TAO_UNSIGNED) 00919 this->op_.uinteger_ = lit.op_.uinteger_; 00920 else if (this->type_ == TAO_SIGNED) 00921 this->op_.integer_ = lit.op_.integer_; 00922 else if (this->type_ == TAO_BOOLEAN) 00923 this->op_.bool_ = lit.op_.bool_; 00924 else if (this->type_ == TAO_SEQUENCE) 00925 this->op_.any_ = lit.op_.any_; 00926 else 00927 type_ = TAO_UNKNOWN; 00928 } |
|
Return the expression type represented by this node.
Implements TAO_Constraint. Definition at line 250 of file Constraint_Nodes.h. References TAO_Expression_Type. Referenced by operator-(), and widest_type().
00251 { return type_; } |
|
Definition at line 478 of file Constraint_Nodes.cpp. References TAO_STRING.
00479 { 00480 return (this->type_ == TAO_STRING) ? this->op_.str_ : 0; 00481 } |
|
Definition at line 483 of file Constraint_Nodes.cpp. References TAO_SEQUENCE.
00484 { 00485 return (this->type_ == TAO_SEQUENCE) ? this->op_.any_ : 0; 00486 } |
|
Definition at line 416 of file Constraint_Nodes.cpp. References TAO_BOOLEAN.
00417 { 00418 return (this->type_ == TAO_BOOLEAN) ? this->op_.bool_ : 0; 00419 } |
|
Definition at line 464 of file Constraint_Nodes.cpp. References TAO_DOUBLE, TAO_SIGNED, and TAO_UNSIGNED.
00465 { 00466 CORBA::Double return_value = (CORBA::Double)0.0; 00467 00468 if (this->type_ == TAO_DOUBLE) 00469 return_value = this->op_.double_; 00470 else if (this->type_ == TAO_SIGNED) 00471 return_value = (CORBA::Double) this->op_.integer_; 00472 else if (this->type_ == TAO_UNSIGNED) 00473 return_value = (CORBA::Double) this->op_.uinteger_; 00474 00475 return return_value; 00476 } |
|
Definition at line 441 of file Constraint_Nodes.cpp. References ACE_INT32_MAX, ACE_INT32_MIN, TAO_DOUBLE, TAO_SIGNED, and TAO_UNSIGNED.
00442 { 00443 CORBA::Long return_value = (CORBA::Long)0; 00444 00445 if (this->type_ == TAO_SIGNED) 00446 return_value = this->op_.integer_; 00447 else if (this->type_ == TAO_UNSIGNED) 00448 return_value = 00449 (this->op_.uinteger_ > (CORBA::ULong) ACE_INT32_MAX) ? 00450 ACE_INT32_MAX : (CORBA::Long) this->op_.uinteger_; 00451 else if (this->type_ == TAO_DOUBLE) 00452 return_value = 00453 (this->op_.double_ > 0) ? 00454 ((this->op_.double_ > ACE_INT32_MAX) ? 00455 ACE_INT32_MAX : 00456 (CORBA::Long) this->op_.double_) : 00457 ((this->op_.double_ < ACE_INT32_MIN) ? 00458 ACE_INT32_MIN : 00459 (CORBA::Long) this->op_.double_); 00460 00461 return return_value; 00462 } |
|
Definition at line 421 of file Constraint_Nodes.cpp. References ACE_UINT32_MAX, TAO_DOUBLE, TAO_SIGNED, and TAO_UNSIGNED.
00422 { 00423 CORBA::ULong return_value = (CORBA::ULong)0; 00424 00425 if (this->type_ == TAO_UNSIGNED) 00426 return_value = this->op_.uinteger_; 00427 else if (this->type_ == TAO_SIGNED) 00428 return_value = 00429 (this->op_.integer_ > 0) ? (CORBA::ULong) this->op_.integer_ : 0; 00430 else if (this->type_ == TAO_DOUBLE) 00431 return_value = 00432 (this->op_.double_ > 0) ? 00433 ((this->op_.double_ > ACE_UINT32_MAX) ? 00434 ACE_UINT32_MAX : 00435 (CORBA::ULong) this->op_.double_) 00436 : 0; 00437 00438 return return_value; 00439 } |
|
Assignment operator.
Definition at line 411 of file Constraint_Nodes.cpp. References copy().
00412 { 00413 this->copy (co); 00414 } |
|
Ensure both operands are of the same simple numeric type.
Definition at line 892 of file Constraint_Nodes.cpp. References expr_type(), and TAO_Expression_Type. Referenced by operator *(), operator!=(), operator+(), operator-(), operator/(), operator<(), operator<=(), operator==(), operator>(), and operator>=().
00894 { 00895 TAO_Expression_Type left_type = left.expr_type (), 00896 right_type = right.expr_type (), 00897 return_value = right_type; 00898 00899 if (right_type != left_type) 00900 { 00901 if (right_type > left_type) 00902 return_value = right_type; 00903 else 00904 return_value = left_type; 00905 } 00906 00907 return return_value; 00908 } |
|
Definition at line 809 of file Constraint_Nodes.cpp.
00811 { 00812 TAO_Expression_Type widest_type = 00813 TAO_Literal_Constraint::widest_type (left, right); 00814 00815 switch (widest_type) 00816 { 00817 case TAO_DOUBLE: 00818 { 00819 CORBA::Double result = (CORBA::Double) left * (CORBA::Double) right; 00820 return TAO_Literal_Constraint ((CORBA::Double) result); 00821 } 00822 case TAO_SIGNED: 00823 { 00824 CORBA::Long result = (CORBA::Long) left * (CORBA::Long) right; 00825 return TAO_Literal_Constraint ((CORBA::Long) result); 00826 } 00827 case TAO_UNSIGNED: 00828 { 00829 CORBA::ULong result = (CORBA::ULong) left * (CORBA::ULong) right; 00830 return TAO_Literal_Constraint ((CORBA::ULong) result); 00831 } 00832 default: 00833 return TAO_Literal_Constraint ((CORBA::Long)0); 00834 } 00835 } |
|
Definition at line 590 of file Constraint_Nodes.cpp.
00592 { 00593 bool return_value = false; 00594 TAO_Expression_Type widest_type = 00595 TAO_Literal_Constraint::widest_type (left, right); 00596 00597 switch (widest_type) 00598 { 00599 case TAO_STRING: 00600 return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) != 0); 00601 break; 00602 case TAO_DOUBLE: 00603 return_value = (CORBA::Double) left != (CORBA::Double) right; 00604 break; 00605 case TAO_SIGNED: 00606 return_value = (CORBA::Long) left != (CORBA::Long) right; 00607 break; 00608 case TAO_UNSIGNED: 00609 return_value = (CORBA::ULong) left != (CORBA::ULong) right; 00610 break; 00611 case TAO_BOOLEAN: 00612 return_value = (CORBA::Boolean) left != (CORBA::Boolean) right; 00613 break; 00614 } 00615 00616 return return_value; 00617 } |
|
Definition at line 751 of file Constraint_Nodes.cpp.
00753 { 00754 TAO_Expression_Type widest_type = 00755 TAO_Literal_Constraint::widest_type (left, right); 00756 00757 switch (widest_type) 00758 { 00759 case TAO_DOUBLE: 00760 { 00761 CORBA::Double result = (CORBA::Double) left + (CORBA::Double) right; 00762 return TAO_Literal_Constraint ((CORBA::Double) result); 00763 } 00764 case TAO_SIGNED: 00765 { 00766 CORBA::Long result = (CORBA::Long) left + (CORBA::Long) right; 00767 return TAO_Literal_Constraint ((CORBA::Long) result); 00768 } 00769 case TAO_UNSIGNED: 00770 { 00771 CORBA::ULong result = (CORBA::ULong) left + (CORBA::ULong) right; 00772 return TAO_Literal_Constraint ((CORBA::ULong) result); 00773 } 00774 default: 00775 return TAO_Literal_Constraint ((CORBA::Long)0); 00776 } 00777 } |
|
Definition at line 867 of file Constraint_Nodes.cpp.
00868 { 00869 switch (operand.expr_type ()) 00870 { 00871 case TAO_DOUBLE: 00872 { 00873 CORBA::Double result = - (CORBA::Double) operand; 00874 return TAO_Literal_Constraint ((CORBA::Double) result); 00875 } 00876 case TAO_SIGNED: 00877 { 00878 CORBA::Long result = - (CORBA::Long) operand; 00879 return TAO_Literal_Constraint ((CORBA::Long) result); 00880 } 00881 case TAO_UNSIGNED: 00882 { 00883 CORBA::Long result = - (CORBA::Long) ((CORBA::ULong) operand); 00884 return TAO_Literal_Constraint ((CORBA::ULong) result); 00885 } 00886 default: 00887 return TAO_Literal_Constraint ((CORBA::Long)0); 00888 } 00889 } |
|
Definition at line 780 of file Constraint_Nodes.cpp.
00782 { 00783 TAO_Expression_Type widest_type = 00784 TAO_Literal_Constraint::widest_type (left, right); 00785 00786 switch (widest_type) 00787 { 00788 case TAO_DOUBLE: 00789 { 00790 CORBA::Double result = (CORBA::Double) left - (CORBA::Double) right; 00791 return TAO_Literal_Constraint ((CORBA::Double) result); 00792 } 00793 case TAO_SIGNED: 00794 { 00795 CORBA::Long result = (CORBA::Long) left - (CORBA::Long) right; 00796 return TAO_Literal_Constraint ((CORBA::Long) result); 00797 } 00798 case TAO_UNSIGNED: 00799 { 00800 CORBA::ULong result = (CORBA::ULong) left - (CORBA::ULong) right; 00801 return TAO_Literal_Constraint ((CORBA::ULong) result); 00802 } 00803 default: 00804 return TAO_Literal_Constraint ((CORBA::Long)0); 00805 } 00806 } |
|
Definition at line 838 of file Constraint_Nodes.cpp.
00840 { 00841 TAO_Expression_Type widest_type = 00842 TAO_Literal_Constraint::widest_type (left, right); 00843 00844 switch (widest_type) 00845 { 00846 case TAO_DOUBLE: 00847 { 00848 CORBA::Double result = (CORBA::Double) left / (CORBA::Double) right; 00849 return TAO_Literal_Constraint ((CORBA::Double) result); 00850 } 00851 case TAO_SIGNED: 00852 { 00853 CORBA::Long result = (CORBA::Long) left / (CORBA::Long) right; 00854 return TAO_Literal_Constraint ((CORBA::Long) result); 00855 } 00856 case TAO_UNSIGNED: 00857 { 00858 CORBA::ULong result = (CORBA::ULong) left / (CORBA::ULong) right; 00859 return TAO_Literal_Constraint ((CORBA::ULong) result); 00860 } 00861 default: 00862 return TAO_Literal_Constraint ((CORBA::Long)0); 00863 } 00864 } |
|
Definition at line 620 of file Constraint_Nodes.cpp.
00622 { 00623 bool return_value = false; 00624 TAO_Expression_Type widest_type = 00625 TAO_Literal_Constraint::widest_type (left, right); 00626 00627 switch (widest_type) 00628 { 00629 case TAO_STRING: 00630 return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) < 0); 00631 break; 00632 case TAO_DOUBLE: 00633 return_value = (CORBA::Double) left < (CORBA::Double) right; 00634 break; 00635 case TAO_SIGNED: 00636 return_value = (CORBA::Long) left < (CORBA::Long) right; 00637 break; 00638 case TAO_UNSIGNED: 00639 return_value = (CORBA::ULong) left < (CORBA::ULong) right; 00640 break; 00641 case TAO_BOOLEAN: 00642 return_value = (CORBA::Boolean) left < (CORBA::Boolean) right; 00643 break; 00644 } 00645 00646 return return_value; 00647 } |
|
Definition at line 650 of file Constraint_Nodes.cpp.
00652 { 00653 bool return_value = false; 00654 TAO_Expression_Type widest_type = 00655 TAO_Literal_Constraint::widest_type (left, right); 00656 00657 switch (widest_type) 00658 { 00659 case TAO_STRING: 00660 return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) <= 0); 00661 break; 00662 case TAO_DOUBLE: 00663 return_value = (CORBA::Double) left <= (CORBA::Double) right; 00664 break; 00665 case TAO_SIGNED: 00666 return_value = (CORBA::Long) left <= (CORBA::Long) right; 00667 break; 00668 case TAO_UNSIGNED: 00669 return_value = (CORBA::ULong) left <= (CORBA::ULong) right; 00670 break; 00671 } 00672 00673 return return_value; 00674 } |
|
Definition at line 738 of file Constraint_Nodes.cpp.
00740 { 00741 bool result = false; 00742 00743 if ((const char*) right != 0) 00744 result = ACE_OS::strcmp ((const char*) left, 00745 (const char*) right) == 0; 00746 return result; 00747 } |
|
|
|
Definition at line 559 of file Constraint_Nodes.cpp.
00561 { 00562 bool return_value = false; 00563 TAO_Expression_Type widest_type = 00564 TAO_Literal_Constraint::widest_type (left, right); 00565 00566 switch (widest_type) 00567 { 00568 case TAO_STRING: 00569 return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) == 0); 00570 break; 00571 case TAO_DOUBLE: 00572 return_value = (CORBA::Double) left == (CORBA::Double) right; 00573 break; 00574 case TAO_SIGNED: 00575 return_value = (CORBA::Long) left == (CORBA::Long) right; 00576 break; 00577 case TAO_UNSIGNED: 00578 return_value = (CORBA::ULong) left == (CORBA::ULong) right; 00579 break; 00580 case TAO_BOOLEAN: 00581 return_value = (CORBA::Boolean) left == (CORBA::Boolean) right; 00582 break; 00583 } 00584 00585 return return_value; 00586 } |
|
Definition at line 677 of file Constraint_Nodes.cpp.
00679 { 00680 bool return_value = false; 00681 TAO_Expression_Type widest_type = 00682 TAO_Literal_Constraint::widest_type (left, right); 00683 00684 switch (widest_type) 00685 { 00686 case TAO_STRING: 00687 return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) > 0); 00688 break; 00689 case TAO_DOUBLE: 00690 return_value = (CORBA::Double) left > (CORBA::Double) right; 00691 break; 00692 case TAO_SIGNED: 00693 return_value = (CORBA::Long) left > (CORBA::Long) right; 00694 break; 00695 case TAO_UNSIGNED: 00696 return_value = (CORBA::ULong) left > (CORBA::ULong) right; 00697 break; 00698 } 00699 00700 return return_value; 00701 } |
|
Definition at line 704 of file Constraint_Nodes.cpp.
00706 { 00707 bool return_value = false; 00708 TAO_Expression_Type widest_type = 00709 TAO_Literal_Constraint::widest_type (left, right); 00710 00711 switch (widest_type) 00712 { 00713 case TAO_STRING: 00714 return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) >= 0); 00715 break; 00716 case TAO_DOUBLE: 00717 return_value = (CORBA::Double) left >= (CORBA::Double) right; 00718 break; 00719 case TAO_SIGNED: 00720 return_value = (CORBA::Long) left >= (CORBA::Long) right; 00721 break; 00722 case TAO_UNSIGNED: 00723 return_value = (CORBA::ULong) left >= (CORBA::ULong) right; 00724 break; 00725 } 00726 00727 return return_value; 00728 } |
|
Definition at line 338 of file Constraint_Nodes.h. |
|
Definition at line 341 of file Constraint_Nodes.h. |
|
Definition at line 342 of file Constraint_Nodes.h. |
|
Definition at line 340 of file Constraint_Nodes.h. |
|
Referenced by copy(). |
|
Definition at line 337 of file Constraint_Nodes.h. |
|
The actual types of the TAO_Literal_Constraint.
Definition at line 347 of file Constraint_Nodes.h. Referenced by copy(). |
|
Definition at line 339 of file Constraint_Nodes.h. |