1 #include "tao/Strategies/SHMIOP_Factory.h"
3 #if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
5 #include "tao/Strategies/SHMIOP_Acceptor.h"
6 #include "tao/Strategies/SHMIOP_Connector.h"
8 #include "tao/ORB_Constants.h"
10 #include "ace/Arg_Shifter.h"
11 #include "ace/Argv_Type_Converter.h"
12 #include "ace/OS_NS_strings.h"
14 static const char prefix_
[] = "shmiop";
16 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
18 TAO_SHMIOP_Protocol_Factory::TAO_SHMIOP_Protocol_Factory ()
19 : TAO_Protocol_Factory (TAO_TAG_SHMEM_PROFILE
),
21 min_bytes_ (10*1024) // @@ Nanbor, remove this magic number!!
25 TAO_SHMIOP_Protocol_Factory::~TAO_SHMIOP_Protocol_Factory ()
27 delete [] this->mmap_prefix_
;
31 TAO_SHMIOP_Protocol_Factory::match_prefix (const ACE_CString
&prefix
)
33 // Check for the proper prefix for this protocol.
34 return (ACE_OS::strcasecmp (prefix
.c_str (), ::prefix_
) == 0);
38 TAO_SHMIOP_Protocol_Factory::prefix () const
44 TAO_SHMIOP_Protocol_Factory::options_delimiter () const
50 TAO_SHMIOP_Protocol_Factory::make_acceptor ()
52 TAO_SHMIOP_Acceptor
*acceptor
= 0;
54 ACE_NEW_RETURN (acceptor
,
58 acceptor
->set_mmap_options (this->mmap_prefix_
,
65 TAO_SHMIOP_Protocol_Factory::init (int argc
,
68 // Copy command line parameter not to use original as well as type conversion.
69 ACE_Argv_Type_Converter
command_line(argc
, argv
);
71 ACE_Arg_Shifter
arg_shifter (command_line
.get_argc(), command_line
.get_TCHAR_argv());
73 while (arg_shifter
.is_anything_left ())
75 const ACE_TCHAR
*current_arg
= 0;
77 if (0 != (current_arg
= arg_shifter
.get_the_parameter (ACE_TEXT("-MMAPFileSize"))))
79 this->min_bytes_
= ACE_OS::atoi (current_arg
);
80 arg_shifter
.consume_arg ();
82 else if (0 != (current_arg
= arg_shifter
.get_the_parameter (ACE_TEXT("-MMAPFilePrefix"))))
84 this->mmap_prefix_
= ACE::strnew (current_arg
);
85 arg_shifter
.consume_arg ();
88 // Any arguments that don't match are ignored so that the
89 // caller can still use them.
90 arg_shifter
.ignore_arg ();
97 TAO_SHMIOP_Protocol_Factory::make_connector ()
99 TAO_Connector
*connector
= 0;
101 ACE_NEW_RETURN (connector
,
102 TAO_SHMIOP_Connector
,
108 TAO_SHMIOP_Protocol_Factory::requires_explicit_endpoint () const
114 ACE_STATIC_SVC_DEFINE (TAO_SHMIOP_Protocol_Factory
,
115 ACE_TEXT ("SHMIOP_Factory"),
117 &ACE_SVC_NAME (TAO_SHMIOP_Protocol_Factory
),
118 ACE_Service_Type::DELETE_THIS
|
119 ACE_Service_Type::DELETE_OBJ
,
122 ACE_FACTORY_DEFINE (TAO_Strategies
, TAO_SHMIOP_Protocol_Factory
)
124 TAO_END_VERSIONED_NAMESPACE_DECL
126 #endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */