本文整理汇总了C++中corba::TypeCode_var::kind方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeCode_var::kind方法的具体用法?C++ TypeCode_var::kind怎么用?C++ TypeCode_var::kind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corba::TypeCode_var
的用法示例。
在下文中一共展示了TypeCode_var::kind方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
// Get the length from the (possibly aliased) typecode.
CORBA::ULong
TAO_DynArray_i::get_tc_length (CORBA::TypeCode_ptr tc)
{
CORBA::TypeCode_var tctmp = CORBA::TypeCode::_duplicate (tc);
CORBA::TCKind kind = tctmp->kind ();
while (kind == CORBA::tk_alias)
{
tctmp = tctmp->content_type ();
kind = tctmp->kind ();
}
return tctmp->length ();
}
示例2: if
TAO_Literal_Constraint::
TAO_Literal_Constraint (CORBA::Any* any)
{
CORBA::Any& any_ref = *any;
CORBA::TypeCode_var type = any_ref.type ();
// @@ No where to throw exception back.
CORBA::TCKind corba_type = CORBA::tk_null;
try
{
corba_type = type->kind ();
}
catch (const CORBA::Exception&)
{
// @@ Seth: Don't know what else to do. Make sure we can tell
// when this constructor fails.
return;
}
this->type_ = TAO_Literal_Constraint::comparable_type (type.in ());
switch (this->type_)
{
case TAO_SIGNED:
this->op_.integer_ = 0;
if (corba_type == CORBA::tk_short)
{
CORBA::Short sh;
any_ref >>= sh;
this->op_.integer_ = static_cast<CORBA::LongLong> (sh);
}
else if (corba_type == CORBA::tk_long)
示例3:
//----------------------------------------------------------------------
CORBA::TCKind
AnyAide::getRealType(const CORBA::Any& any)
{
//have to create an _var type because this is actually a CORBA object
CORBA::TypeCode_var tc;
//get the type from the any
tc = any.type();
//return the kind...simple enough.
return tc->kind();
}
示例4: throw
/* execute *****************************************************************
- executes a process on the device
************************************************************************* */
CF::ExecutableDevice::ProcessID_Type ExecutableDevice_impl::execute (
const char* name,
const CF::Properties& options,
const CF::Properties& parameters)
throw (CORBA::SystemException,
CF::Device::InvalidState,
CF::ExecutableDevice::InvalidFunction,
CF::ExecutableDevice::InvalidParameters,
CF::ExecutableDevice::InvalidOptions,
CF::InvalidFileName,
CF::ExecutableDevice::ExecuteFail)
{
CORBA::TypeCode_var tc; // CORBA type code
const char* tempStr; // temporary character string
CF::ExecutableDevice::ProcessID_Type PID; // process ID
int size = 2 * parameters.length () + 2; // length of the POSIX argv arguments
char** argv = new char *[size]; // POSIX arguments
CORBA::ULong stackSize, priority; // CORBA unsigned longs for options storage
// verify device is in the correct state
if (!isUnlocked () || isDisabled ()) {
DEBUG(5, ExecutableDevice_impl, "Cannot execute. System is either LOCKED, SHUTTING DOWN or DISABLED.")
throw (CF::Device::InvalidState("Cannot execute. System is either LOCKED, SHUTTING DOWN or DISABLED."));
}
priority = 0; // this is the default value for the priority (it's actually meaningless in this version)
stackSize = 4096; // this is the default value for the stacksize (it's actually meaningless in this version)
{
// verify valid options, both STACK_SIZE_ID and PRIORITY_ID must have unsigned-long types
CF::Properties invalidOptions;
invalidOptions.length(0);
for (unsigned i = 0; i < options.length (); i++) {
tc = options[i].value.type ();
// extract priority and stack size from the options list
if (strcmp (options[i].id, CF::ExecutableDevice::PRIORITY_ID)) {
if (tc->kind () == CORBA::tk_ulong) {
options[i].value >>= priority;
} else {
LOG_ERROR(ExecutableDevice_impl, "Incorrect type provided for option PRIORITY");
invalidOptions.length(invalidOptions.length() + 1);
invalidOptions[invalidOptions.length() - 1] = options[i];
}
} else if (strcmp (options[i].id, CF::ExecutableDevice::STACK_SIZE_ID)) {
示例5: current_member_kind
CORBA::TCKind DynStructImpl::current_member_kind()
throw(DynamicAny::DynAny::TypeMismatch,
DynamicAny::DynAny::InvalidValue, CORBA::SystemException)
{
if (_destroyed)
{
throw CORBA::OBJECT_NOT_EXIST("DynAny destroyed");
}
if (_current == -1)
{
throw DynamicAny::DynAny::InvalidValue(); // "No member (current = -1)"
}
CORBA::TypeCode_var type = _base_type->member_type(_current);
return type->kind();
}
示例6: push_structured_event
virtual void push_structured_event(CosNotification::StructuredEvent const& event)
throw(CosEventComm::Disconnected)
{
cout << "domain_name: " << event.header.fixed_header.event_type.domain_name
<< " type_name: " << event.header.fixed_header.event_type.type_name << " " << flush;
if (false) {
Miro::Client client;
DynamicAny::DynAnyFactory_var daf =
client.resolveInit<DynamicAny::DynAnyFactory>("DynAnyFactory");
DynamicAny::DynAny_var da = daf->create_dyn_any(event.remainder_of_body);
CORBA::TypeCode_var tc = da->type();
if (tc->kind() == CORBA::tk_struct) {
CORBA::String_var name = tc->name();
CORBA::String_var id = tc->id();
DynamicAny::DynStruct_var ds =
DynamicAny::DynStruct::_narrow(da);
for (CORBA::ULong i = 0; i < ds->component_count(); ++i) {
DynamicAny::DynAny_var member = ds->current_component();
CORBA::String_var name = ds->current_member_name();
if (std::string("timestamp") == name.in()) {
long long int i = member->get_ulonglong();
ACE_Time_Value t;
ORBSVCS_Time::Absolute_TimeT_to_Time_Value(t, i);
cout << "latency: " << ACE_OS::gettimeofday() - t << endl;
break;
}
ds->next();
}
}
else {
cerr << "unknown event layout" << endl;
}
}
ACE_Time_Value t;
t.set(time_out);
ACE_OS::sleep(t);
cout << "waking up after sleep" << endl;
}
示例7: tab
void
DynAnyAnalyzer::analyze_basic_seq (CORBA::TypeCode_ptr tc,
DynamicAny::DynAny_ptr da)
{
CORBA::TypeCode_var ct = tc->content_type ();
CORBA::TCKind tk = ct->kind ();
tab (level_);
if (debug_)
{
ACE_DEBUG ((LM_DEBUG,
"BASIC TYPE SEQUENCE\n"));
}
switch (tk)
{
CASEBS (boolean, Boolean, " Value (bool) = %d\n");
CASEBS (octet, Octet, " Value (octet) = %c\n");
CASEBS (char, Char, " Value (char) = %c\n");
CASEBS (wchar, WChar, " Value (wchar) = %u\n");
CASEBS (short, Short, " Value (short) = %d\n");
CASEBS (ushort, UShort, " Value (ushort) = %u\n");
CASEBS (long, Long, " Value (long) = %d\n");
CASEBS (ulong, ULong, " Value (ulong) = %u\n");
CASEBS (longlong, LongLong, " Value (longlong) = %Ld\n");
CASEBS (ulonglong, ULongLong, " Value (ulonglong) = %Lu\n");
CASEBS (float, Float, " Value (float) = %f\n");
CASEBS (double, Double, " Value (double) = %f\n");
case CORBA::tk_longdouble:
default:
tab (level_);
if (debug_)
{
ACE_DEBUG ((LM_DEBUG,
" unhandled typecode = %d\n",
static_cast<int> (tk)));
}
break;
}
}
示例8:
// Store the exception value.
void
CORBA::ServerRequest::set_exception (const CORBA::Any &value)
{
CORBA::TypeCode_var tc = value.type ();
CORBA::TCKind const kind = tc->kind ();
// set_exception() can be called at any time, but the Any arg MUST
// contain an exception.
if (kind != CORBA::tk_except)
{
throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 21, CORBA::COMPLETED_MAYBE);
}
ACE_NEW_THROW_EX (this->exception_,
CORBA::Any (value),
CORBA::NO_MEMORY ());
this->orb_server_request_.reply_status (GIOP::USER_EXCEPTION);
}
示例9: BAD_PARAM
void TIDorb::core::ContextImpl::set_one_value(const char* prop_name, const CORBA::Any& value)
{
if(!prop_name)
throw CORBA::BAD_PARAM(0,CORBA::COMPLETED_NO);
CORBA::TypeCode_var type = value.type();
if (type->kind() != CORBA::tk_string)
throw CORBA::BAD_PARAM(0,CORBA::COMPLETED_NO); // "Value must have a string TypeCode."
{
TIDThr::Synchronized sync(*this);
if (!m_values)
m_orb->create_list(1, m_values);
}
// new value
m_values->add_value(prop_name, value, 0);
}
示例10: in_cdr
void
TAO_UnionDef_i::fetch_label (const ACE_Configuration_Section_Key member_key,
CORBA::UnionMember &member)
{
ACE_Configuration::VALUETYPE vt;
this->repo_->config ()->find_value (member_key,
"label",
vt);
if (vt == ACE_Configuration::STRING)
{
member.label <<= CORBA::Any::from_octet (0);
return;
}
u_int value = 0;
this->repo_->config ()->get_integer_value (member_key,
"label",
value);
CORBA::TypeCode_var tc =
this->discriminator_type_i ();
CORBA::TCKind kind = tc->kind ();
switch (kind)
{
case CORBA::tk_char:
member.label <<= CORBA::Any::from_char (static_cast<CORBA::Char> (value));
break;
case CORBA::tk_wchar:
member.label <<= CORBA::Any::from_wchar (static_cast<CORBA::WChar> (value));
break;
case CORBA::tk_boolean:
member.label <<= CORBA::Any::from_boolean (static_cast<CORBA::Boolean> (value));
break;
case CORBA::tk_short:
member.label <<= static_cast<CORBA::Short> (value);
break;
case CORBA::tk_ushort:
member.label <<= static_cast<CORBA::UShort> (value);
break;
case CORBA::tk_long:
member.label <<= static_cast<CORBA::Long> (value);
break;
case CORBA::tk_ulong:
member.label <<= static_cast<CORBA::ULong> (value);
break;
case CORBA::tk_longlong:
member.label <<= static_cast<CORBA::LongLong> (value);
break;
case CORBA::tk_ulonglong:
member.label <<= static_cast<CORBA::ULongLong> (value);
break;
case CORBA::tk_enum:
{
TAO_OutputCDR cdr;
cdr.write_ulong (static_cast<CORBA::ULong> (value));
TAO_InputCDR in_cdr (cdr);
TAO::Unknown_IDL_Type *impl = 0;
ACE_NEW (impl,
TAO::Unknown_IDL_Type (tc.in (),
in_cdr));
member.label.replace (impl);
break;
}
default:
break;
}
}
示例11: result_path
CORBA::OperationDef_ptr
TAO_InterfaceDef_i::create_operation_i (const char *id,
const char *name,
const char *version,
CORBA::IDLType_ptr result,
CORBA::OperationMode mode,
const CORBA::ParDescriptionSeq ¶ms,
const CORBA::ExceptionDefSeq &exceptions,
const CORBA::ContextIdSeq &contexts)
{
// This will throw an exception if a name clash is found.
// create_common() will check for all other errors.
this->check_inherited (name,
CORBA::dk_Operation);
TAO_Container_i::tmp_name_holder_ = name;
ACE_Configuration_Section_Key new_key;
// Common to all IR objects created in CORBA::Container.
ACE_TString path =
TAO_IFR_Service_Utils::create_common (CORBA::dk_Interface,
CORBA::dk_Operation,
this->section_key_,
new_key,
this->repo_,
id,
name,
&TAO_Container_i::same_as_tmp_name,
version,
"ops");
// Get the TypeCode for the return type.
ACE_TString result_path (TAO_IFR_Service_Utils::reference_to_path (result));
TAO_IDLType_i *result_impl =
TAO_IFR_Service_Utils::path_to_idltype (result_path,
this->repo_);
CORBA::TypeCode_var rettype =
result_impl->type_i ();
CORBA::TCKind kind = rettype->kind ();
// Oneway operations cannot have a non-void return type.
if (mode == CORBA::OP_ONEWAY && kind != CORBA::tk_void)
{
throw CORBA::BAD_PARAM (CORBA::OMGVMCID | 31, CORBA::COMPLETED_NO);
}
this->repo_->config ()->set_string_value (new_key,
"result",
result_path);
// Store the operation mode.
this->repo_->config ()->set_integer_value (new_key,
"mode",
mode);
CORBA::ULong i = 0;
// Store the operation's parameter info.
CORBA::ULong length = params.length ();
if (length > 0)
{
ACE_Configuration_Section_Key params_key;
this->repo_->config ()->open_section (new_key,
"params",
1,
params_key);
this->repo_->config ()->set_integer_value (params_key,
"count",
length);
char *type_path = 0;
for (i = 0; i < length; ++i)
{
// Oneway operations cannot have INOUT or OUT parameters.
if (mode == CORBA::OP_ONEWAY && params[i].mode != CORBA::PARAM_IN)
{
throw CORBA::BAD_PARAM (31, CORBA::COMPLETED_NO);
}
ACE_Configuration_Section_Key param_key;
char *stringified = TAO_IFR_Service_Utils::int_to_string (i);
this->repo_->config ()->open_section (params_key,
stringified,
1,
param_key);
this->repo_->config ()->set_string_value (param_key,
"name",
params[i].name.in ());
type_path =
TAO_IFR_Service_Utils::reference_to_path (
params[i].type_def.in ()
);
this->repo_->config ()->set_string_value (param_key,
"type_path",
//.........这里部分代码省略.........
示例12: ftr
void
ReplicaController::send_reply (
PortableInterceptor::ServerRequestInfo_ptr ri)
{
FT::FTRequestServiceContext_var ftr (
extract_context (ri));
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) Sending reply for %s with rid %i\n",
ftr->client_id.in (),
ftr->retention_id));
// Prepare reply for logging.
CORBA::Any_var result =
ri->result ();
TAO_OutputCDR cdr;
result->impl ()->marshal_value (cdr);
Dynamic::ParameterList_var pl =
ri->arguments ();
CORBA::ULong len = pl->length ();
for (CORBA::ULong index = 0; index != len ; ++index)
{
//@@ No chance for PARAM_OUT
if ((*pl)[index].mode == CORBA::PARAM_INOUT)
{
(*pl)[index].argument.impl ()->marshal_value (cdr);
}
}
CORBA::OctetSeq_var reply;
ACE_NEW (reply.out (), CORBA::OctetSeq (cdr.total_length ()));
reply->length (cdr.total_length ());
CORBA::Octet* buf = reply->get_buffer ();
// @@ What if this throws an exception?? We don't have any way to
// check whether this succeeded
for (ACE_Message_Block const* mb = cdr.begin ();
mb != 0;
mb = mb->cont ())
{
ACE_OS::memcpy (buf, mb->rd_ptr (), mb->length ());
buf += mb->length ();
}
// Logging the reply and state update.
//
// First send message to members.
//
{
// Extract state update.
CORBA::OctetSeq_var oid = ri->object_id ();
PortableInterceptor::AdapterName_var an = ri->adapter_name ();
CORBA::Any_var state = ri->get_slot (state_slot_id ());
CORBA::TypeCode_var tc = state->type ();
if (tc->kind () == CORBA::tk_null)
{
ACE_DEBUG ((LM_DEBUG, "Slot update is void\n"));
PortableServer::POA_var poa = resolve_poa (an.in ());
PortableServer::ServantBase_var servant =
poa->id_to_servant (oid.in ());
Checkpointable* target =
dynamic_cast<Checkpointable*> (servant.in ());
if (target)
{
CORBA::Any_var tmp = target->get_state ();
if (tmp.ptr () != 0) state = tmp._retn ();
}
}
TAO_OutputCDR cdr;
cdr << oid.in ();
cdr << an.in ();
cdr << ftr->client_id.in ();
cdr << ftr->retention_id;
cdr << reply.in ();
cdr << state.in ();
size_t size = cdr.total_length ();
//.........这里部分代码省略.........
示例13: cdr
void ReplicaController::
listener ()
{
try
{
for (char buffer[1024];;)
{
size_t n = group_->recv (buffer, sizeof (buffer));
ACE_HEX_DUMP ((LM_DEBUG, buffer, n));
TAO_InputCDR cdr (buffer, n);
CORBA::OctetSeq object_id;
PortableInterceptor::AdapterName adapter_name;
CORBA::String_var client_id;
CORBA::Long retention_id;
CORBA::OctetSeq reply;
CORBA::Any state;
cdr >> object_id;
cdr >> adapter_name;
cdr >> client_id.out ();
cdr >> retention_id;
cdr >> reply;
cdr >> state;
if (!cdr.good_bit ())
{
ACE_DEBUG ((LM_DEBUG, "CDR failed\n"));
//@@ what to do?
}
ACE_DEBUG ((LM_DEBUG,
"Received log for %s with rid %i\n",
client_id.in (),
retention_id));
RecordId rid (client_id.in (), retention_id);
CORBA::OctetSeq_var tmp (new CORBA::OctetSeq (reply));
log_.insert (rid, tmp);
// Update state.
CORBA::TypeCode_var tc = state.type ();
if (tc->kind () != CORBA::tk_null)
{
PortableServer::POA_var poa = resolve_poa (adapter_name);
PortableServer::ServantBase_var servant =
poa->id_to_servant (object_id);
Checkpointable* target =
dynamic_cast<Checkpointable*> (servant.in ());
if (target) target->set_state (state);
}
}
}
catch (ACE_TMCast::Group::Failed const&)
{
ACE_DEBUG ((LM_DEBUG,
"Group failure. Perhaps, I am alone in the group.\n"));
}
catch (ACE_TMCast::Group::InsufficienSpace const&)
{
ACE_DEBUG ((LM_DEBUG, "Group::InsufficienSpace\n"));
}
orb_->shutdown (0);
}
示例14: analyze
void DynAnyAnalyzer::analyze (DynamicAny::DynAny_ptr da)
{
CORBA::TypeCode_var tc = da->type ();
CORBA::TCKind kind = tc->kind ();
CORBA::TypeCode_var dup = CORBA::TypeCode::_duplicate (tc.in ());
// strip aliases
while (kind == CORBA::tk_alias)
{
dup = dup->content_type ();
kind = dup->kind ();
}
switch (kind)
{
case CORBA::tk_struct:
{
DynamicAny::DynStruct_var ds
= DynamicAny::DynStruct::_narrow (da);
tab (level_);
if (debug_)
{
ACE_DEBUG ((LM_DEBUG,
"STRUCT\n"));
}
if (da->seek (0) )
{
level_++;
do
{
DynamicAny::DynAny_var cc =
ds->current_component ();
DynamicAny::FieldName_var fn =
ds->current_member_name ();
tab(level_);
if (debug_)
{
ACE_DEBUG ((LM_DEBUG,
"Member = %C\n", fn.in ()));
}
if (!CORBA::is_nil (cc.in ()))
{
this->analyze (cc.in ());
}
} while (da->next ());
level_--;
}
}
break; // end tk_struct
case CORBA::tk_sequence:
{
if (TAO_DynCommon::is_basic_type_seq (tc.in ()))
{
this->analyze_basic_seq (dup.in (), da);
}
else
{
DynamicAny::DynSequence_var ds =
DynamicAny::DynSequence::_narrow (da);
int i = 0;
tab(level_);
if (debug_)
{
ACE_DEBUG ((LM_DEBUG,
"SEQUENCE\n"));
}
if (ds->seek (0UL))
{
level_++;
do
{
tab(level_);
if (debug_)
ACE_DEBUG ((LM_DEBUG,
"[%d]\n", i));
DynamicAny::DynAny_var cc (ds->current_component ());
if (!CORBA::is_nil (cc.in ()))
{
analyze (cc.in ());
//.........这里部分代码省略.........