e.g.
stringsHelper
|
// C#
public class stringsHelper
{
///
/// Insert strings into an any
/// @param a an any
/// @param t strings value
///
public static void Insert(Org.Omg.CORBA.Any a, string[] t )
{
a.Type(Type());
Write(a.Create_Output_Stream(),t);
}
///
/// Extract strings from an any
/// @param a an any
/// @return the extracted strings value
///
public static string[] Extract(Org.Omg.CORBA.Any a)
{
if (!a.Type().Equal(Type()))
throw new Org.Omg.CORBA.MARSHAL(); return Read(a.Create_Input_Stream());
}
///
/// Internal TypeCode value
///
private static Org.Omg.CORBA.TypeCode _tc = null;
///
/// Return the strings TypeCode
/// @return a TypeCode
///
public static Org.Omg.CORBA.TypeCode Type()
{
if (_tc == null)
{
Org.Omg.CORBA.ORB orb = Org.Omg.CORBA.ORB.Init();
_tc = orb.Create_Alias_TC(Id(),"strings",
orb.Create_Array_TC(3,orb.Get_Primitive_TC(
Org.Omg.CORBA.TCKind.tk_string)));
}
return _tc;
}
///
/// Return the strings IDL ID
/// @return an ID
///
public static string Id()
{
return _id;
}
private static string _id = "IDL:demo/any/strings:1.0";
///
/// Read strings from a marshalled stream
/// @param istream the input stream
/// @return the readed strings value
///
public static string[] Read(Org.Omg.CORBA.Portable.InputStream istream)
{
string[] new_one;
{
int size2 = 3;
new_one = new string[size2];
for (int i2=0; i2 < new_one.Length; i2++)
{
new_one[i2] = istream.Read_String();
}
}
return new_one;
}
///
/// Write strings into a marshalled stream
/// @param ostream the output stream
/// @param value strings value
///
public static void Write(Org.Omg.CORBA.Portable.OutputStream ostream, string[] value)
{
if (value.Length != 3)
throw new Org.Omg.CORBA.MARSHAL();
for (int i2=0; i2 < value.Length; i2++)
{
ostream.Write_String(value[i2]);
}
}
}
|