#include "orbsvcs/Trader/Constraint_Nodes.h"#include "orbsvcs/Trader/Constraint_Visitors.h"#include "orbsvcs/Trader/Constraint_Tokens.h"#include "tao/AnyTypeCode/Any.h"#include "ace/OS_NS_string.h"
Go to the source code of this file.
| ACE_RCSID | ( | Trader | , | |
| Constraint_Nodes | , | |||
| "$Id: Constraint_Nodes.cpp 82804 2008-09-22 14:58:36Z jtc $" | ||||
| ) |
Definition at line 14 of file Constraint_Nodes.cpp.
00016 : Constraint_Nodes.cpp 82804 2008-09-22 14:58:36Z jtc $") 00017 00018 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00019 00020 int 00021 TAO_Noop_Constraint::accept (TAO_Constraint_Visitor* visitor) 00022 { 00023 int return_value = -1; 00024 switch (this->type_) 00025 { 00026 case TAO_FIRST: 00027 return_value = visitor->visit_first (this); 00028 break; 00029 case TAO_RANDOM: 00030 return_value = visitor->visit_random (this); 00031 } 00032 00033 return return_value; 00034 }
| TAO_Literal_Constraint operator* | ( | const TAO_Literal_Constraint & | left, | |
| const TAO_Literal_Constraint & | right | |||
| ) |
Definition at line 758 of file Constraint_Nodes.cpp.
00760 { 00761 TAO_Expression_Type widest_type = 00762 TAO_Literal_Constraint::widest_type (left, right); 00763 00764 switch (widest_type) 00765 { 00766 case TAO_DOUBLE: 00767 { 00768 CORBA::Double result = (CORBA::Double) left * (CORBA::Double) right; 00769 return TAO_Literal_Constraint (result); 00770 } 00771 case TAO_SIGNED: 00772 { 00773 CORBA::LongLong result = static_cast<CORBA::LongLong> (left) * 00774 static_cast<CORBA::LongLong> (right); 00775 return TAO_Literal_Constraint (result); 00776 } 00777 case TAO_UNSIGNED: 00778 { 00779 CORBA::ULongLong result = static_cast<CORBA::ULongLong> (left) * 00780 static_cast<CORBA::ULongLong> (right); 00781 return TAO_Literal_Constraint (result); 00782 } 00783 default: 00784 return TAO_Literal_Constraint (static_cast<CORBA::LongLong> (0)); 00785 } 00786 }
| TAO_Literal_Constraint operator+ | ( | const TAO_Literal_Constraint & | left, | |
| const TAO_Literal_Constraint & | right | |||
| ) |
Definition at line 696 of file Constraint_Nodes.cpp.
00698 { 00699 TAO_Expression_Type widest_type = 00700 TAO_Literal_Constraint::widest_type (left, right); 00701 00702 switch (widest_type) 00703 { 00704 case TAO_DOUBLE: 00705 { 00706 CORBA::Double result = (CORBA::Double) left + (CORBA::Double) right; 00707 return TAO_Literal_Constraint (result); 00708 } 00709 case TAO_SIGNED: 00710 { 00711 CORBA::LongLong result = static_cast<CORBA::LongLong> (left) + 00712 static_cast<CORBA::LongLong> (right); 00713 return TAO_Literal_Constraint (result); 00714 } 00715 case TAO_UNSIGNED: 00716 { 00717 CORBA::ULongLong result = static_cast<CORBA::ULongLong> (left) + 00718 static_cast<CORBA::ULongLong> (right); 00719 return TAO_Literal_Constraint (result); 00720 } 00721 default: 00722 return TAO_Literal_Constraint (static_cast<CORBA::LongLong> (0)); 00723 } 00724 }
| TAO_Literal_Constraint operator- | ( | const TAO_Literal_Constraint & | operand | ) |
Definition at line 829 of file Constraint_Nodes.cpp.
00830 { 00831 switch (operand.expr_type ()) 00832 { 00833 case TAO_DOUBLE: 00834 { 00835 CORBA::Double result = - (CORBA::Double) operand; 00836 return TAO_Literal_Constraint (result); 00837 } 00838 case TAO_SIGNED: 00839 { 00840 CORBA::LongLong result = - static_cast<CORBA::LongLong> (operand); 00841 return TAO_Literal_Constraint (result); 00842 } 00843 case TAO_UNSIGNED: 00844 { 00845 CORBA::LongLong result = - static_cast<CORBA::LongLong> ( 00846 static_cast<CORBA::ULongLong> (operand)); 00847 return TAO_Literal_Constraint (static_cast<CORBA::ULongLong> (result)); 00848 } 00849 default: 00850 return TAO_Literal_Constraint (static_cast<CORBA::LongLong> (0)); 00851 } 00852 }
| TAO_Literal_Constraint operator- | ( | const TAO_Literal_Constraint & | left, | |
| const TAO_Literal_Constraint & | right | |||
| ) |
Definition at line 727 of file Constraint_Nodes.cpp.
00729 { 00730 TAO_Expression_Type widest_type = 00731 TAO_Literal_Constraint::widest_type (left, right); 00732 00733 switch (widest_type) 00734 { 00735 case TAO_DOUBLE: 00736 { 00737 CORBA::Double result = (CORBA::Double) left - (CORBA::Double) right; 00738 return TAO_Literal_Constraint (result); 00739 } 00740 case TAO_SIGNED: 00741 { 00742 CORBA::LongLong result = static_cast<CORBA::LongLong> (left) - 00743 static_cast<CORBA::LongLong> (right); 00744 return TAO_Literal_Constraint (result); 00745 } 00746 case TAO_UNSIGNED: 00747 { 00748 CORBA::ULongLong result = static_cast<CORBA::ULongLong> (left) - 00749 static_cast<CORBA::ULongLong> (right); 00750 return TAO_Literal_Constraint (result); 00751 } 00752 default: 00753 return TAO_Literal_Constraint (static_cast<CORBA::LongLong> (0)); 00754 } 00755 }
| TAO_Literal_Constraint operator/ | ( | const TAO_Literal_Constraint & | left, | |
| const TAO_Literal_Constraint & | right | |||
| ) |
Definition at line 789 of file Constraint_Nodes.cpp.
00791 { 00792 TAO_Expression_Type widest_type = 00793 TAO_Literal_Constraint::widest_type (left, right); 00794 00795 switch (widest_type) 00796 { 00797 case TAO_DOUBLE: 00798 { 00799 if ((CORBA::Double) right == 0.0) 00800 return TAO_Literal_Constraint ((CORBA::Double) 0.0); 00801 00802 CORBA::Double result = (CORBA::Double) left / (CORBA::Double) right; 00803 return TAO_Literal_Constraint (result); 00804 } 00805 case TAO_SIGNED: 00806 { 00807 if (static_cast<CORBA::LongLong> (right) == 0) 00808 return TAO_Literal_Constraint (static_cast<CORBA::LongLong> (0)); 00809 00810 CORBA::LongLong result = static_cast<CORBA::LongLong> (left) / 00811 static_cast<CORBA::LongLong> (right); 00812 return TAO_Literal_Constraint (result); 00813 } 00814 case TAO_UNSIGNED: 00815 { 00816 if (static_cast<CORBA::ULongLong> (right) == 0) 00817 return TAO_Literal_Constraint (static_cast<CORBA::ULongLong> (0)); 00818 00819 CORBA::ULongLong result = static_cast<CORBA::ULongLong> (left) / 00820 static_cast<CORBA::ULongLong> (right); 00821 return TAO_Literal_Constraint (result); 00822 } 00823 default: 00824 return TAO_Literal_Constraint (static_cast<CORBA::LongLong> (0)); 00825 } 00826 }
| bool operator< | ( | const TAO_Literal_Constraint & | left, | |
| const TAO_Literal_Constraint & | right | |||
| ) |
Definition at line 616 of file Constraint_Nodes.cpp.
00618 { 00619 bool return_value = false; 00620 TAO_Expression_Type widest_type = 00621 TAO_Literal_Constraint::widest_type (left, right); 00622 00623 switch (widest_type) 00624 { 00625 case TAO_STRING: 00626 return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) < 0); 00627 break; 00628 case TAO_DOUBLE: 00629 return_value = (CORBA::Double) left < (CORBA::Double) right; 00630 break; 00631 case TAO_SIGNED: 00632 return_value = static_cast<CORBA::LongLong> (left) < 00633 static_cast<CORBA::LongLong> (right); 00634 break; 00635 case TAO_UNSIGNED: 00636 return_value = static_cast<CORBA::ULongLong> (left) < 00637 static_cast<CORBA::ULongLong> (right); 00638 break; 00639 case TAO_BOOLEAN: 00640 return_value = (CORBA::Boolean) left < (CORBA::Boolean) right; 00641 break; 00642 } 00643 00644 return return_value; 00645 }
| bool operator== | ( | const TAO::String_Manager & | left, | |
| const TAO_Literal_Constraint & | right | |||
| ) |
Definition at line 683 of file Constraint_Nodes.cpp.
00685 { 00686 bool result = false; 00687 00688 if ((const char*) right != 0) 00689 result = ACE_OS::strcmp ((const char*) left, 00690 (const char*) right) == 0; 00691 return result; 00692 }
| bool operator== | ( | CORBA::Double | left, | |
| const TAO_Literal_Constraint & | right | |||
| ) |
Definition at line 677 of file Constraint_Nodes.cpp.
00678 { 00679 return (left == (CORBA::Double) right); 00680 }
| bool operator== | ( | const TAO_Literal_Constraint & | left, | |
| const TAO_Literal_Constraint & | right | |||
| ) |
Definition at line 582 of file Constraint_Nodes.cpp.
00584 { 00585 bool return_value = false; 00586 TAO_Expression_Type widest_type = 00587 TAO_Literal_Constraint::widest_type (left, right); 00588 00589 switch (widest_type) 00590 { 00591 case TAO_STRING: 00592 return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) == 0); 00593 break; 00594 case TAO_DOUBLE: 00595 return_value = (CORBA::Double) left == (CORBA::Double) right; 00596 break; 00597 case TAO_SIGNED: 00598 return_value = static_cast<CORBA::LongLong> (left) == 00599 static_cast<CORBA::LongLong> (right); 00600 break; 00601 case TAO_UNSIGNED: 00602 return_value = static_cast<CORBA::ULongLong> (left) == 00603 static_cast<CORBA::ULongLong> (right); 00604 break; 00605 case TAO_BOOLEAN: 00606 return_value = (CORBA::Boolean) left == (CORBA::Boolean) right; 00607 break; 00608 } 00609 00610 return return_value; 00611 }
| bool operator> | ( | const TAO_Literal_Constraint & | left, | |
| const TAO_Literal_Constraint & | right | |||
| ) |
Definition at line 648 of file Constraint_Nodes.cpp.
00650 { 00651 bool return_value = false; 00652 TAO_Expression_Type widest_type = 00653 TAO_Literal_Constraint::widest_type (left, right); 00654 00655 switch (widest_type) 00656 { 00657 case TAO_STRING: 00658 return_value = (ACE_OS::strcmp ((const char*) left, (const char*) right) > 0); 00659 break; 00660 case TAO_DOUBLE: 00661 return_value = (CORBA::Double) left > (CORBA::Double) right; 00662 break; 00663 case TAO_SIGNED: 00664 return_value = static_cast<CORBA::LongLong> (left) > 00665 static_cast<CORBA::LongLong> (right); 00666 break; 00667 case TAO_UNSIGNED: 00668 return_value = static_cast<CORBA::ULongLong> (left) > 00669 static_cast<CORBA::ULongLong> (right); 00670 break; 00671 } 00672 00673 return return_value; 00674 }
int(* dispatch_table[])(TAO_Constraint_Visitor *, TAO_Binary_Constraint *) [static] |
{
TAO_Binary_Constraint::visit_greater_than,
TAO_Binary_Constraint::visit_greater_than_equal,
TAO_Binary_Constraint::visit_less_than,
TAO_Binary_Constraint::visit_less_than_equal,
TAO_Binary_Constraint::visit_equal,
TAO_Binary_Constraint::visit_not_equal,
0,
TAO_Binary_Constraint::visit_and,
TAO_Binary_Constraint::visit_or,
0,
TAO_Binary_Constraint::visit_in,
TAO_Binary_Constraint::visit_twiddle,
0,
TAO_Binary_Constraint::visit_add,
TAO_Binary_Constraint::visit_sub,
TAO_Binary_Constraint::visit_mult,
TAO_Binary_Constraint::visit_div
}
1.6.1