本文整理汇总了C++中ACE_TString::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_TString::c_str方法的具体用法?C++ ACE_TString::c_str怎么用?C++ ACE_TString::c_str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_TString
的用法示例。
在下文中一共展示了ACE_TString::c_str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// Insert <naming_context> with <name> relative to <this> context
// (String version)
int
ACE_Registry::Naming_Context::bind_new_context (const ACE_TString &name,
Naming_Context &naming_context,
u_long persistence,
u_long security_access,
LPSECURITY_ATTRIBUTES security_attributes)
{
u_long reason;
long result = ACE_TEXT_RegCreateKeyEx (this->key_,
name.c_str (),
0,
0,
persistence,
security_access,
security_attributes,
&naming_context.key_,
&reason);
if (result == ERROR_SUCCESS)
// If create succeeds
{
if (reason == REG_CREATED_NEW_KEY)
// If new key: success
{
// Set the correct parent
naming_context.parent (this->key_);
// Set the correct name
naming_context.name (name);
}
else
// reason == REG_OPENED_EXISTING_KEY
// Failed to make new key
{
// reset result to failure
result = -1;
// Close the key first
::RegCloseKey (naming_context.key_);
// Reset key
naming_context.key_ = (HKEY) 0;
}
}
ACE_REGISTRY_CALL_RETURN (result);
}
示例2: key
int
ACE_Registry_Name_Space::list_name_entries (ACE_BINDING_SET &set,
const ACE_NS_WString &pattern)
{
ACE_UNUSED_ARG(pattern);
ACE_Registry::Binding_List list;
int result = this->context_.list (list);
if (result != 0)
return result;
// Iterator through all entries
for (ACE_Registry::Binding_List::iterator i = list.begin ();
i != list.end ();
i++)
{
// Yeeesss! STL rules!
ACE_Registry::Binding &binding = *i;
if (binding.type () == ACE_Registry::OBJECT)
{
// Key
ACE_TString string = binding.name ();
ACE_NS_WString key (string.c_str ());
// Value
ACE_NS_WString value;
char *type = 0;
result = this->resolve (key,
value,
type);
if (result != 0)
ACELIB_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_Registry::Naming_Context::resolve")),
result);
// Complete binding
ACE_Name_Binding binding (key, value, type);
set.insert (binding);
}
}
return 0;
}
示例3: get_scheduler_alg_thr_count
int KSGateway::get_scheduler_alg_thr_count(const std::string &alg_name)
{
int count = 0;
std::string config_path = KSGOSUtil::JoinPath(_configuration._basedir,KSG_CONFIG_FILENAME);
ACE_Configuration_Heap config;
if(config.open() == -1)
{
ACE_ERROR_RETURN((LM_ERROR,ACE_TEXT("读取前置机配置失败")),-1);
}
ACE_Ini_ImpExp config_importer(config);
if(config_importer.import_config(config_path.c_str()) == -1)
{
ACE_ERROR_RETURN((LM_ERROR,ACE_TEXT("读取前置机配置失败")),-1);
}
ACE_Configuration_Section_Key section;
if(config.open_section(config.root_section(),ACE_TEXT(KSG_COMMON_SECT)
,0,section) == -1)
{
ACE_ERROR_RETURN((LM_ERROR,ACE_TEXT("读取前置机配置失败")),-1);
}
ACE_TString v;
if(config.open_section(config.root_section(),ACE_TEXT(KSG_SCHEDULER_SECT)
,0,section) == -1)
ACE_ERROR_RETURN((LM_ERROR,ACE_TEXT("读取前置机配置失败")),-1);
std::string key_name = alg_name;
key_name += "_thr_count";
if(config.get_string_value(section,key_name.c_str(),v) == -1)
{
count = 5;
}
else
{
count = ACE_OS::atoi(v.c_str());
count = (count <= 0) ? 5 : count;
}
return count;
}
示例4: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR* argv[])
{
try {
// Initialize the ORB.
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
if (parse_args(argc, argv) != 0) {
return 1;
}
// Read and destringify the Messenger object's IOR.
CORBA::Object_var obj = orb->string_to_object(ior.c_str());
if( CORBA::is_nil( obj.in() ) ) {
std::cerr << "Could not get Messenger IOR." << std::endl;
return 1;
}
// Narrow the IOR to a Messenger object reference.
DevGuide::Messenger_var messenger =
DevGuide::Messenger::_narrow( obj.in() );
if( CORBA::is_nil( messenger.in() ) ) {
std::cerr << "IOR was not a Messenger object reference." << std::endl;
return 1;
}
// Send a message the the Messenger object.
CORBA::String_var msg = CORBA::string_dup( "Hello!" );
messenger->send_message( "TAO User", "TAO Test", msg.inout() );
// Print the Messenger's reply.
std::cout << "Reply: " << msg.in() << std::endl;
orb->destroy();
return 0;
}
catch(const CORBA::Exception& ex) {
std::cerr << "CORBA exception: " << ex << std::endl;
}
return 1;
}
示例5: GetBoolDefault
bool Config::GetBoolDefault(const char* name, bool def)
{
ACE_TString val;
if (!GetValueHelper(mConf, name, val))
{
return def;
}
const char* str = val.c_str();
if (strcmp(str, "true") == 0 || strcmp(str, "TRUE") == 0 ||
strcmp(str, "yes") == 0 || strcmp(str, "YES") == 0 ||
strcmp(str, "1") == 0)
{
return true;
}
else
{
return false;
}
}
示例6:
// Find <naming_context> with <name> in <this> context
// (String version)
int
ACE_Registry::Naming_Context::resolve_context (const ACE_TString &name,
Naming_Context &naming_context,
u_long security_access)
{
long result = ACE_TEXT_RegOpenKeyEx (this->key_,
name.c_str (),
0,
security_access,
&naming_context.key_);
if (result == ERROR_SUCCESS)
{
// set the correct parent
naming_context.parent (this->key_);
// set the correct name
naming_context.name (name);
}
ACE_REGISTRY_CALL_RETURN (result);
}
示例7: pub_id_str
int
SubDriver::parse_pub_arg(const ACE_TString& arg)
{
size_t pos;
// Find the first ':' character, and make sure it is in a legal spot.
if ((pos = std::find(arg.c_str(), arg.c_str() + arg.length(), ACE_TEXT(':')) - arg.c_str()) == arg.length()) {
ACE_ERROR((LM_ERROR,
"(%P|%t) Bad -p command-line value (%s). Missing ':' char.\n",
arg.c_str()));
return -1;
}
if (pos == 0) {
ACE_ERROR((LM_ERROR,
"(%P|%t) Bad -p command-line value (%s). "
"':' char cannot be first char.\n",
arg.c_str()));
return -1;
}
if (pos == (arg.length() - 1)) {
ACE_ERROR((LM_ERROR,
"(%P|%t) Bad -p command-line value (%s) - "
"':' char cannot be last char.\n",
arg.c_str()));
return -1;
}
// Parse the pub_id from left of ':' char, and remainder to right of ':'.
ACE_TString pub_id_str(arg.c_str(), pos);
this->pub_addr_str_ = arg.c_str() + pos + 1;
this->pub_id_fname_ = pub_id_str.c_str();
this->pub_addr_ = ACE_INET_Addr(this->pub_addr_str_.c_str());
return 0;
}
示例8: Config_Error
void
IDREF_Base<T>::bind_next_available (ACE_TString &id)
{
// Note: For this function to compile and work properly,
// T must have the postincrement operator defined.
DANCE_TRACE ("IDREF_Base<T>::bind_next_available");
// ACE_DEBUG ((LM_DEBUG, "**** Binding %s to %i\n",
// id.c_str (),
// this->next_));
int retval = idref_map_.bind (id, this->next_);
int pos_retval = pos_map_.bind (this->next_, id);
++this->next_;
if (retval < 0 || pos_retval < 0)
throw Config_Error (id.c_str (),
ACE_TEXT ("Failed to bind an IDRef. This likely indicates a name clash"));
}
示例9:
CORBA::Contained_ptr
TAO_Repository_i::lookup_id_i (const char *search_id)
{
if (ACE_OS::strcmp (search_id, "IDL:omg.org/CORBA/Object:1.0") == 0
|| ACE_OS::strcmp (search_id, "IDL:omg.org/CORBA/ValueBase:1.0") == 0)
{
return CORBA::Contained::_nil ();
}
ACE_TString path;
if (this->config_->get_string_value (this->repo_ids_key_,
search_id,
path)
!= 0)
{
return CORBA::Contained::_nil ();
}
ACE_Configuration_Section_Key key;
this->config_->expand_path (this->root_key_,
path,
key);
u_int kind = 0;
this->config_->get_integer_value (key,
"def_kind",
kind);
CORBA::DefinitionKind def_kind =
static_cast<CORBA::DefinitionKind> (kind);
CORBA::Object_var obj =
TAO_IFR_Service_Utils::create_objref (def_kind,
path.c_str (),
this->repo_);
return CORBA::Contained::_narrow (obj.in ());
}
示例10: process
virtual int process (Message *message)
{
ACE_TRACE ("SaveMetaData::process()");
ACE_TString path (message->addr ().get_path_name ());
path += ACE_TEXT (".xml");
ACE_FILE_Connector connector;
ACE_FILE_IO file;
ACE_FILE_Addr addr (path.c_str ());
if (connector.connect (file, addr) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("create meta-data file")),
0);
file.truncate (0);
this->write (file, "<Message>\n");
// ...
this->write (file, "</Message>\n");
file.close ();
return 0;
}
示例11:
CORBA::DefinitionKind
TAO_IFR_Service_Utils::path_to_def_kind (ACE_TString &path,
TAO_Repository_i *repo)
{
int status =
repo->config ()->expand_path (repo->root_key (),
path,
TAO_IFR_Service_Utils::tmp_key_,
0);
if (status != 0)
{
ORBSVCS_DEBUG ((LM_DEBUG,
"path_to_def_kind - bad path: '%s'\n",
path.c_str ()));
return CORBA::dk_none;
}
u_int kind = 0;
repo->config ()->get_integer_value (TAO_IFR_Service_Utils::tmp_key_,
"def_kind",
kind);
return static_cast<CORBA::DefinitionKind> (kind);
}
示例12: impl
void
TAO_OperationDef_i::make_description (
CORBA::OperationDescription &od)
{
od.name = this->name_i ();
od.id = this->id_i ();
ACE_TString container_id;
this->repo_->config ()->get_string_value (this->section_key_,
"container_id",
container_id);
od.defined_in = container_id.c_str ();
od.version = this->version_i ();
od.result = this->result_i ();
od.mode = this->mode_i ();
CORBA::ContextIdSeq_var cid_seq =
this->contexts_i ();
od.contexts = cid_seq.in ();
CORBA::ParDescriptionSeq_var pd_seq =
this->params_i ();
od.parameters = pd_seq.in ();
ACE_Configuration_Section_Key excepts_key;
int status =
this->repo_->config ()->open_section (this->section_key_,
"excepts",
0,
excepts_key);
// This section may not have been created.
if (status == 0)
{
int index = 0;
int status = 0;
ACE_TString field_name, type_path;
ACE_Configuration::VALUETYPE type;
ACE_Unbounded_Queue<ACE_TString> path_queue;
while (this->repo_->config ()->enumerate_values (excepts_key,
index++,
field_name,
type)
== 0)
{
status =
this->repo_->config ()->get_string_value (excepts_key,
field_name.c_str (),
type_path);
if (status == 0)
{
path_queue.enqueue_tail (type_path);
}
}
CORBA::ULong size = static_cast<CORBA::ULong> (path_queue.size ());
od.exceptions.length (size);
for (CORBA::ULong i = 0; i < size; ++i)
{
ACE_TString type_path;
path_queue.dequeue_head (type_path);
ACE_Configuration_Section_Key type_key;
this->repo_->config ()->expand_path (this->repo_->root_key (),
type_path,
type_key,
0);
ACE_TString name;
this->repo_->config ()->get_string_value (type_key,
"name",
name);
od.exceptions[i].name = name.c_str ();
ACE_TString id;
this->repo_->config ()->get_string_value (type_key,
"id",
id);
od.exceptions[i].id = id.c_str ();
ACE_TString container_id;
this->repo_->config ()->get_string_value (type_key,
"container_id",
container_id);
od.exceptions[i].defined_in = container_id.c_str ();
//.........这里部分代码省略.........
示例13: init
void init ()
{
participant
= dpf->create_participant(domain_id,
PARTICIPANT_QOS_DEFAULT,
::DDS::DomainParticipantListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil (participant.in ()))
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT("(%P|%t) create_participant failed.\n")));
throw TestException ();
}
::Xyz::FooTypeSupportImpl* fts_servant
= new ::Xyz::FooTypeSupportImpl();
if (::DDS::RETCODE_OK != fts_servant->register_type(participant.in (), type_name))
{
ACE_ERROR ((LM_ERROR, ACE_TEXT("(%P|%t) register_type failed.\n")));
throw TestException ();
}
::DDS::TopicQos topic_qos;
participant->get_default_topic_qos(topic_qos);
topic[0]
= participant->create_topic (topic_name[0],
type_name,
topic_qos,
::DDS::TopicListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil (topic[0].in ()))
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT("(%P|%t) create_topic failed.\n")));
throw TestException ();
}
topic[1]
= participant->create_topic (topic_name[1],
type_name,
topic_qos,
::DDS::TopicListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil (topic[1].in ()))
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT("(%P|%t) create_topic failed.\n")));
throw TestException ();
}
writer_impl
= TheTransportFactory->create_transport_impl (PUB_TRAFFIC_TCP,
ACE_TEXT("SimpleTcp"),
OpenDDS::DCPS::DONT_AUTO_CONFIG);
OpenDDS::DCPS::TransportConfiguration_rch writer_config
= TheTransportFactory->create_configuration (PUB_TRAFFIC_TCP, ACE_TEXT("SimpleTcp"));
OpenDDS::DCPS::SimpleTcpConfiguration* writer_tcp_config
= static_cast <OpenDDS::DCPS::SimpleTcpConfiguration*> (writer_config.in ());
if (writer_address_given)
{
ACE_INET_Addr writer_address (writer_address_str.c_str ());
writer_tcp_config->local_address_ = writer_address;
writer_tcp_config->local_address_str_ = writer_address_str.c_str ();
}
// else use default address - OS assigned.
if (writer_impl->configure(writer_config.in()) != 0)
{
ACE_ERROR((LM_ERROR,
ACE_TEXT("(%P|%t) init_writer_tranport: pub TCP")
ACE_TEXT(" Failed to configure the transport.\n")));
throw TestException ();
}
// Create the default publisher
publisher = participant->create_publisher(PUBLISHER_QOS_DEFAULT,
::DDS::PublisherListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil (publisher.in ()))
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT("(%P|%t) create_publisher failed.\n")));
throw TestException ();
}
// Attach the publisher to the transport.
OpenDDS::DCPS::PublisherImpl* pub_impl
= dynamic_cast<OpenDDS::DCPS::PublisherImpl*>
(publisher.in ());
if (0 == pub_impl)
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT("(%P|%t) Failed to obtain publisher servant \n")));
throw TestException ();
//.........这里部分代码省略.........
示例14: INTF_REPOS
CORBA::ParDescriptionSeq *
TAO_OperationDef_i::params_i (void)
{
CORBA::ULong i = 0;
ACE_Configuration_Section_Key params_key;
int status =
this->repo_->config ()->open_section (this->section_key_,
"params",
0,
params_key);
ACE_Unbounded_Queue<ACE_Configuration_Section_Key> key_queue;
// This section may not have been created.
if (status == 0)
{
u_int count = 0;
this->repo_->config ()->get_integer_value (params_key,
"count",
count);
for (i = 0; i < count; ++i)
{
ACE_Configuration_Section_Key param_key;
char *stringified = TAO_IFR_Service_Utils::int_to_string (i);
status =
this->repo_->config ()->open_section (params_key,
stringified,
0,
param_key);
if (status == 0)
{
key_queue.enqueue_tail (param_key);
}
}
}
CORBA::ULong size = static_cast<CORBA::ULong> (key_queue.size ());
CORBA::ParDescriptionSeq *pd_seq = 0;
ACE_NEW_THROW_EX (pd_seq,
CORBA::ParDescriptionSeq (size),
CORBA::NO_MEMORY ());
pd_seq->length (size);
if (size == 0)
{
return pd_seq;
}
CORBA::ParDescriptionSeq_var retval = pd_seq;
for (i = 0; i < size; ++i)
{
ACE_Configuration_Section_Key key;
key_queue.dequeue_head (key);
ACE_TString name;
this->repo_->config ()->get_string_value (key,
"name",
name);
retval[i].name = name.c_str ();
u_int mode = 0;
this->repo_->config ()->get_integer_value (key,
"mode",
mode);
retval[i].mode = static_cast<CORBA::ParameterMode> (mode);
ACE_TString type_path;
this->repo_->config ()->get_string_value (key,
"type_path",
type_path);
TAO_IDLType_i *impl =
TAO_IFR_Service_Utils::path_to_idltype (type_path,
this->repo_);
// We have an undefined interface
if (impl == 0)
{
ORBSVCS_DEBUG ((LM_DEBUG,
ACE_TEXT ("Encountered undefined parameter type "
"for variable: %s\n"),
name.c_str ()));
throw CORBA::INTF_REPOS ();
}
retval[i].type = impl->type_i ();
CORBA::Object_var obj =
TAO_IFR_Service_Utils::path_to_ir_object (type_path,
this->repo_);
retval[i].type_def = CORBA::IDLType::_narrow (obj.in ());
//.........这里部分代码省略.........
示例15: while
CORBA::ExceptionDefSeq *
TAO_OperationDef_i::exceptions_i ( )
{
ACE_Configuration_Section_Key excepts_key;
int status =
this->repo_->config ()->open_section (this->section_key_,
"excepts",
0,
excepts_key);
int index = 0;
ACE_Unbounded_Queue<ACE_TString> path_queue;
// This section may not have been created.
if (status == 0)
{
ACE_TString field_name, type_path;
ACE_Configuration::VALUETYPE type;
while (this->repo_->config ()->enumerate_values (excepts_key,
index++,
field_name,
type)
== 0)
{
this->repo_->config ()->get_string_value (excepts_key,
field_name.c_str (),
type_path);
path_queue.enqueue_tail (type_path);
}
}
CORBA::ULong size = static_cast<CORBA::ULong> (path_queue.size ());
CORBA::ExceptionDefSeq *ed_seq = 0;
ACE_NEW_THROW_EX (ed_seq,
CORBA::ExceptionDefSeq (size),
CORBA::NO_MEMORY ());
ed_seq->length (size);
if (index == 0)
{
return ed_seq;
}
CORBA::ExceptionDefSeq_var retval = ed_seq;
for (CORBA::ULong i = 0; i < size; ++i)
{
ACE_TString path;
path_queue.dequeue_head (path);
CORBA::Object_var obj =
TAO_IFR_Service_Utils::create_objref (CORBA::dk_Exception,
path.c_str (),
this->repo_);
retval[i] = CORBA::ExceptionDef::_narrow (obj.in ());
}
return retval._retn ();
}