本文整理汇总了Java中org.omg.CORBA.UnionMember类的典型用法代码示例。如果您正苦于以下问题:Java UnionMember类的具体用法?Java UnionMember怎么用?Java UnionMember使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UnionMember类属于org.omg.CORBA包,在下文中一共展示了UnionMember类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create_union_tc
import org.omg.CORBA.UnionMember; //导入依赖的package包/类
/** {@inheritDoc} */
public TypeCode create_union_tc(String id, String name,
TypeCode discriminator_type, UnionMember[] members
)
{
RecordTypeCode r = new RecordTypeCode(TCKind.tk_union);
r.setId(id);
r.setName(name);
r.setDiscriminator_type(discriminator_type);
r.setDefaultIndex(0);
for (int i = 0; i < members.length; i++)
{
r.add(members [ i ]);
}
return r;
}
示例2: UnionTypeCode
import org.omg.CORBA.UnionMember; //导入依赖的package包/类
public UnionTypeCode(String repositoryId, String name,
TypeCode discriminator_type,
org.omg.CORBA.UnionMember[] members)
{
super(TCKind.tk_union, repositoryId, name);
m_discriminator_type = discriminator_type;
boolean thereis_default = false;
int i = 0;
m_default_used = -1; // default_used mecanism not explicited in CORBA
// 2.3
TypeCode tc_default = TypeCodeFactory.tc_octet;
for (i = 0; i < members.length; i++) {
if (tc_default.equal(members[i].label.type())) {
m_default_used = i;
break;
}
}
m_members = members;
}
示例3: TypeCodeImpl
import org.omg.CORBA.UnionMember; //导入依赖的package包/类
public TypeCodeImpl(ORB orb,
int creationKind,
String id,
String name,
TypeCode discriminator_type,
UnionMember[] members)
// for unions
{
this(orb) ;
if (creationKind == TCKind._tk_union) {
_kind = creationKind;
setId(id);
_name = name;
_memberCount = members.length;
_discriminator = convertToNative(_orb, discriminator_type);
_memberNames = new String[_memberCount];
_memberTypes = new TypeCodeImpl[_memberCount];
_unionLabels = new AnyImpl[_memberCount];
for (int i = 0 ; i < _memberCount ; i++) {
_memberNames[i] = members[i].name;
_memberTypes[i] = convertToNative(_orb, members[i].type);
_memberTypes[i].setParent(this);
_unionLabels[i] = new AnyImpl(_orb, members[i].label);
// check whether this is the default branch.
if (_unionLabels[i].type().kind() == TCKind.tk_octet) {
if (_unionLabels[i].extract_octet() == (byte)0) {
_defaultIndex = i;
}
}
}
} // else initializes to null
}
示例4: create_union_tc
import org.omg.CORBA.UnionMember; //导入依赖的package包/类
/**
* Create a TypeCode for a union.
*
* @param id the logical id for the typecode.
* @param name the name for the typecode.
* @param discriminator_type
* the type of the union discriminator.
* @param members an array describing the members of the TypeCode.
* @return the requested TypeCode.
*/
public synchronized TypeCode create_union_tc(String id,
String name,
TypeCode discriminator_type,
UnionMember[] members)
{
checkShutdownState();
return new TypeCodeImpl(this,
TCKind._tk_union,
id,
name,
discriminator_type,
members);
}
示例5: create_union_tc
import org.omg.CORBA.UnionMember; //导入依赖的package包/类
public TypeCode create_union_tc(String id,
String name,
TypeCode discriminator_type,
UnionMember[] members)
{
return new TypeCodeImpl(this,
TCKind._tk_union,
id,
name,
discriminator_type,
members);
}
示例6: add
import org.omg.CORBA.UnionMember; //导入依赖的package包/类
/**
* Adds a new field, taking values from the passed
* {@link UnionMember}.
*/
public void add(UnionMember m)
{
Field f = field();
f.name = m.name;
f.type = m.type;
f.label = m.label;
}
示例7: readParams
import org.omg.CORBA.UnionMember; //导入依赖的package包/类
public void readParams(es.tid.TIDorbj.core.cdr.CDRInputStream input)
{
super.readParams(input);
m_discriminator_type = input.read_TypeCode();
m_default_used = input.read_long();
int length = input.read_ulong();
m_members = new UnionMember[length];
for (int i = 0; i < length; i++) {
m_members[i] = new org.omg.CORBA.UnionMember();
// Change, only the the value of label is marshaled
//_members[i].label = input.read_any();
m_members[i].label = input.orb().create_any();
m_members[i].label.read_value(input, m_discriminator_type);
if (!m_discriminator_type.equal(m_members[i].label.type())) {
if (m_members[i].label.type().kind().value()
== TCKind._tk_octet) {
if (m_default_used != i)
throw new MARSHAL(
"Bad label: Union does not have any "
+ "defalt member.",
0, CompletionStatus.COMPLETED_NO);
} else {
throw new MARSHAL("Invalid Union discriminator TypeCode",
0, CompletionStatus.COMPLETED_NO);
}
}
m_members[i].name = input.read_string();
m_members[i].type = input.read_TypeCode();
}
}