#include <Trader.h>
Definition at line 53 of file Trader.h.
enum TAO_Trader_Factory::Conformance [private] |
Definition at line 87 of file Trader.h.
00087 { TAO_TRADER_QUERY, 00088 TAO_TRADER_SIMPLE, 00089 TAO_TRADER_STANDALONE, 00090 TAO_TRADER_LINKED };
TAO_Trader_Factory::TAO_Trader_Factory | ( | int & | argc, | |
ACE_TCHAR ** | argv | |||
) | [protected] |
Definition at line 650 of file Trader.cpp.
References parse_args().
00651 : conformance_ (TAO_TRADER_LINKED), 00652 threadsafe_ (0), 00653 supports_dynamic_properties_ (1), 00654 supports_modifiable_properties_ (1), 00655 def_search_card_ (20), 00656 max_search_card_ (50), 00657 def_match_card_ (20), 00658 max_match_card_ (50), 00659 def_return_card_ (20), 00660 max_return_card_ (50), 00661 def_hop_count_ (5), 00662 max_hop_count_ (10), 00663 def_follow_policy_ (CosTrading::if_no_local), 00664 max_follow_policy_ (CosTrading::always) 00665 { 00666 this->parse_args (argc, argv); 00667 }
TAO_Trader_Factory::TAO_Trader_Factory | ( | const TAO_Trader_Factory & | ) | [private] |
TAO_END_VERSIONED_NAMESPACE_DECL TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Trader_Factory::TAO_TRADER * TAO_Trader_Factory::create_trader | ( | int & | argc, | |
ACE_TCHAR ** | argv | |||
) | [static] |
Creates an instance of the trader according to parameters whose default values can be overrided with the following command line arguments:
-TSthreadsafe, default is not thread-safe -TSconformance {query, simple, stand-alone, linked}, default is linked -TSsupports_dynamic_properties {true, false}, default is true -TSsupports_modifiable_propertise {true, false}, default is true -TSdef_search_card {integer}, default is 20 -TSmax_search_card {integer}, default is 50 -TSdef_match_card {integer}, default is 20 -TSmax_match_card {integer}, default is 50 -TSdef_return_card {integer}, default is 20 -TSmax_return_card {integer}, default is 50 -TSdef_hop_count {integer}, default is 5, -TSmax_hop_count {integer}, default is 10 -TSdef_follow_policy {always,if_no_local,local_only}, default is if_no_local, -TSmax_follow_policy {always,if_no_local,local_only}, default is always
Definition at line 644 of file Trader.cpp.
References manufacture_trader().
Referenced by TAO_Trading_Loader::create_object().
00645 { 00646 TAO_Trader_Factory trader_factory (argc, argv); 00647 return trader_factory.manufacture_trader (); 00648 }
TAO_Trader_Factory::TAO_TRADER * TAO_Trader_Factory::manufacture_trader | ( | void | ) | [private] |
Definition at line 670 of file Trader.cpp.
References ACE_NEW_RETURN, TAO_Trader_Base::ADMIN, TAO_Import_Attributes_i::def_follow_policy(), TAO_Import_Attributes_i::def_hop_count(), TAO_Import_Attributes_i::def_match_card(), TAO_Import_Attributes_i::def_return_card(), TAO_Import_Attributes_i::def_search_card(), TAO_Trader_Base::import_attributes(), TAO_Trader_Base::LINK, TAO_Trader_Base::LOOKUP, TAO_Import_Attributes_i::max_follow_policy(), TAO_Import_Attributes_i::max_hop_count(), TAO_Import_Attributes_i::max_match_card(), TAO_Import_Attributes_i::max_return_card(), TAO_Import_Attributes_i::max_search_card(), TAO_Trader_Base::REGISTER, TAO_Trader_Base::support_attributes(), TAO_Support_Attributes_i::supports_dynamic_properties(), TAO_Support_Attributes_i::supports_modifiable_properties(), TAO_TRADER_LINKED, TAO_TRADER_SIMPLE, and TAO_TRADER_STANDALONE.
Referenced by create_trader().
00671 { 00672 typedef TAO_Trader<ACE_Null_Mutex, ACE_Null_Mutex> TRADER; 00673 00674 #if defined ACE_HAS_THREADS 00675 typedef TAO_Trader<TAO_SYNCH_MUTEX, TAO_SYNCH_RW_MUTEX> MT_TRADER; 00676 #else 00677 typedef TAO_Trader<ACE_Null_Mutex, ACE_Null_Mutex> MT_TRADER; 00678 #endif /* ACE_HAS_THREADS */ 00679 00680 TAO_TRADER* return_value = 0; 00681 int components = static_cast<int> (TAO_Trader_Base::LOOKUP); 00682 00683 if (this->conformance_ >= TAO_TRADER_SIMPLE) 00684 components |= static_cast<int> (TAO_Trader_Base::REGISTER); 00685 00686 if (this->conformance_ >= TAO_TRADER_STANDALONE) 00687 components |= static_cast<int> (TAO_Trader_Base::ADMIN); 00688 00689 if (this->conformance_ >= TAO_TRADER_LINKED) 00690 components |= static_cast<int> (TAO_Trader_Base::LINK); 00691 00692 if (this->threadsafe_) 00693 ACE_NEW_RETURN (return_value, 00694 MT_TRADER (static_cast<TAO_Trader_Base::Trader_Components> (components)), 00695 0); 00696 else 00697 ACE_NEW_RETURN (return_value, 00698 TRADER (static_cast<TAO_Trader_Base::Trader_Components> (components)), 00699 0); 00700 00701 TAO_Import_Attributes_i &import_attributes = 00702 return_value->import_attributes (); 00703 TAO_Support_Attributes_i &support_attributes = 00704 return_value->support_attributes (); 00705 00706 import_attributes.max_search_card (this->max_search_card_); 00707 import_attributes.def_search_card (this->def_search_card_); 00708 import_attributes.max_match_card (this->max_match_card_); 00709 import_attributes.def_match_card (this->def_match_card_); 00710 import_attributes.max_return_card (this->max_return_card_); 00711 import_attributes.def_return_card (this->def_return_card_); 00712 import_attributes.max_hop_count (this->max_hop_count_); 00713 import_attributes.def_hop_count (this->def_hop_count_); 00714 import_attributes.max_follow_policy (this->max_follow_policy_); 00715 import_attributes.def_follow_policy (this->def_follow_policy_); 00716 support_attributes.supports_modifiable_properties (this->supports_modifiable_properties_); 00717 support_attributes.supports_dynamic_properties (this->supports_dynamic_properties_); 00718 00719 return return_value; 00720 }
TAO_Trader_Factory& TAO_Trader_Factory::operator= | ( | const TAO_Trader_Factory & | ) | [private] |
void TAO_Trader_Factory::parse_args | ( | int & | argc, | |
ACE_TCHAR ** | argv | |||
) | [private] |
Definition at line 723 of file Trader.cpp.
References ACE_TEXT(), CosTrading::always, ACE_OS::atoi(), conformance_, ACE_Arg_Shifter_T< CHAR_TYPE >::consume_arg(), def_follow_policy_, def_hop_count_, def_match_card_, def_return_card_, def_search_card_, ACE_Arg_Shifter_T< CHAR_TYPE >::get_current(), CosTrading::if_no_local, ACE_Arg_Shifter_T< CHAR_TYPE >::ignore_arg(), ACE_Arg_Shifter_T< CHAR_TYPE >::is_anything_left(), ACE_Arg_Shifter_T< CHAR_TYPE >::is_parameter_next(), CosTrading::local_only, max_follow_policy_, max_hop_count_, max_match_card_, max_return_card_, max_search_card_, ACE_OS::strcasecmp(), ACE_OS::strcmp(), ACE_OS::strstr(), supports_dynamic_properties_, supports_modifiable_properties_, TAO_TRADER_LINKED, TAO_TRADER_QUERY, TAO_TRADER_SIMPLE, TAO_TRADER_STANDALONE, and threadsafe_.
Referenced by TAO_Trader_Factory().
00724 { 00725 ACE_Arg_Shifter arg_shifter (argc, argv); 00726 00727 while (arg_shifter.is_anything_left ()) 00728 { 00729 const ACE_TCHAR* current_arg = arg_shifter.get_current (); 00730 00731 if (ACE_OS::strcmp (current_arg, ACE_TEXT("-TSthreadsafe")) == 0) 00732 { 00733 arg_shifter.consume_arg (); 00734 this->threadsafe_ = 1; 00735 } 00736 else if (ACE_OS::strcmp (current_arg, ACE_TEXT("-TSconformance")) == 0) 00737 { 00738 arg_shifter.consume_arg (); 00739 if (arg_shifter.is_parameter_next ()) 00740 { 00741 const ACE_TCHAR* conformance_str = arg_shifter.get_current (); 00742 00743 if (ACE_OS::strcasecmp (conformance_str, ACE_TEXT("Linked")) == 0) 00744 this->conformance_ = TAO_TRADER_LINKED; 00745 else if (ACE_OS::strcasecmp (conformance_str, ACE_TEXT("Query")) == 0) 00746 this->conformance_ = TAO_TRADER_QUERY; 00747 else if (ACE_OS::strcasecmp (conformance_str, ACE_TEXT("Simple")) == 0) 00748 this->conformance_ = TAO_TRADER_SIMPLE; 00749 else if (ACE_OS::strcasecmp (conformance_str, ACE_TEXT("Standalone")) == 0) 00750 this->conformance_ = TAO_TRADER_STANDALONE; 00751 00752 arg_shifter.consume_arg (); 00753 } 00754 } 00755 else if (ACE_OS::strcmp (current_arg, ACE_TEXT("-TSsupports_dynamic_properties")) == 0) 00756 { 00757 arg_shifter.consume_arg (); 00758 if (arg_shifter.is_parameter_next ()) 00759 { 00760 const ACE_TCHAR* arg_str = arg_shifter.get_current (); 00761 00762 if (ACE_OS::strcasecmp (arg_str, ACE_TEXT("true")) == 0) 00763 this->supports_dynamic_properties_ = 1; 00764 else if (ACE_OS::strcasecmp (arg_str, ACE_TEXT("false")) == 0) 00765 this->supports_dynamic_properties_ = 0; 00766 00767 arg_shifter.consume_arg (); 00768 } 00769 00770 } 00771 else if (ACE_OS::strcmp (current_arg, ACE_TEXT("-TSsupports_modifiable_properties")) == 0) 00772 { 00773 arg_shifter.consume_arg (); 00774 if (arg_shifter.is_parameter_next ()) 00775 { 00776 const ACE_TCHAR* arg_str = arg_shifter.get_current (); 00777 00778 if (ACE_OS::strcasecmp (arg_str, ACE_TEXT("true")) == 0) 00779 this->supports_modifiable_properties_ = 1; 00780 else if (ACE_OS::strcasecmp (arg_str, ACE_TEXT("false")) == 0) 00781 this->supports_modifiable_properties_ = 0; 00782 00783 arg_shifter.consume_arg (); 00784 } 00785 } 00786 else if (ACE_OS::strcmp (current_arg, ACE_TEXT("-TSdef_search_card")) == 0 || 00787 ACE_OS::strcmp (current_arg, ACE_TEXT("-TSmax_search_card")) == 0 || 00788 ACE_OS::strcmp (current_arg, ACE_TEXT("-TSdef_match_card")) == 0 || 00789 ACE_OS::strcmp (current_arg, ACE_TEXT("-TSmax_match_card")) == 0 || 00790 ACE_OS::strcmp (current_arg, ACE_TEXT("-TSdef_return_card")) == 0 || 00791 ACE_OS::strcmp (current_arg, ACE_TEXT("-TSmax_return_card")) == 0 || 00792 ACE_OS::strcmp (current_arg, ACE_TEXT("-TSdef_hop_count")) == 0 || 00793 ACE_OS::strcmp (current_arg, ACE_TEXT("-TSmax_hop_count")) == 0) 00794 { 00795 arg_shifter.consume_arg (); 00796 if (arg_shifter.is_parameter_next ()) 00797 { 00798 CORBA::ULong value = 00799 static_cast<CORBA::ULong> (ACE_OS::atoi (arg_shifter.get_current ())); 00800 arg_shifter.consume_arg (); 00801 00802 if (ACE_OS::strstr (current_arg, ACE_TEXT("card"))) 00803 { 00804 if (ACE_OS::strstr (current_arg, ACE_TEXT("max"))) 00805 { 00806 if (ACE_OS::strstr (current_arg, ACE_TEXT("search"))) 00807 this->max_search_card_ = value; 00808 else if (ACE_OS::strstr (current_arg, ACE_TEXT("match"))) 00809 this->max_match_card_ = value; 00810 else 00811 this->max_return_card_ = value; 00812 } 00813 else 00814 { 00815 if (ACE_OS::strstr (current_arg, ACE_TEXT("search"))) 00816 this->def_search_card_ = value; 00817 else if (ACE_OS::strstr (current_arg, ACE_TEXT("match"))) 00818 this->def_match_card_ = value; 00819 else 00820 this->def_return_card_ = value; 00821 } 00822 } 00823 else 00824 { 00825 if (ACE_OS::strstr (current_arg, ACE_TEXT("max"))) 00826 this->max_hop_count_ = value; 00827 else 00828 this->def_hop_count_ = value; 00829 } 00830 } 00831 } 00832 else if (ACE_OS::strcmp (current_arg, ACE_TEXT("-TSdef_follow_policy")) == 0 00833 || ACE_OS::strcmp (current_arg, ACE_TEXT("-TSmax_follow_policy")) == 0) 00834 { 00835 arg_shifter.consume_arg (); 00836 if (arg_shifter.is_parameter_next ()) 00837 { 00838 const ACE_TCHAR* arg_str = arg_shifter.get_current (); 00839 CosTrading::FollowOption follow_option; 00840 00841 if (ACE_OS::strcasecmp (arg_str, ACE_TEXT("always")) == 0) 00842 follow_option = CosTrading::always; 00843 else if (ACE_OS::strcasecmp (arg_str, ACE_TEXT("if_no_local")) == 0) 00844 follow_option = CosTrading::if_no_local; 00845 else if (ACE_OS::strcasecmp (arg_str, ACE_TEXT("local_only")) == 0) 00846 follow_option = CosTrading::local_only; 00847 else if (ACE_OS::strstr (current_arg, ACE_TEXT("def"))) 00848 follow_option = this->def_follow_policy_; 00849 else 00850 follow_option = this->max_follow_policy_; 00851 00852 if (ACE_OS::strstr (current_arg, ACE_TEXT("def"))) 00853 this->def_follow_policy_ = follow_option; 00854 else 00855 this->max_follow_policy_ = follow_option; 00856 00857 arg_shifter.consume_arg (); 00858 } 00859 } 00860 else 00861 arg_shifter.ignore_arg (); 00862 } 00863 }
Conformance TAO_Trader_Factory::conformance_ [private] |