| module m1
{
typedef sequence<string> tUseqUstr;
typedef string<10> tBstr10;
typedef sequence<tBstr10> tUseqBstr10;
typedef struct tUDT1_
{
tBstr10 Bstr10_1;
tBstr10 Bstr10_2;
tBstr10 Bstr10_3;
string Ustr;
} tUDT1;
typedef sequence<tUDT1> tUseqUDT1;
typedef struct tUDT2_
{
string Ustr_1;
string Ustr_2;
string Ustr_3;
string Ustr_4;
} tUDT2;
typedef sequence<tUDT2> tUseqUDT2;
typedef struct tUDT3_
{
tBstr10 Bstr10_1;
tBstr10 Bstr10_2;
tBstr10 Bstr10_3;
tBstr10 Bstr10_4;
} tUDT3;
typedef sequence<tUDT3> tUseqUDT3;
typedef struct tUDT4_
{
tBstr10 Bstr10_1;
} tUDT4;
typedef sequence<tUDT4> tUseqUDT4;
interface i1
{
void OUseqUstr
(
in long totalUseq,
in long totalUstr,
out tUseqUstr oseq
);
void OUseqBstr10
(
in long totalUseq,
in long totalBstr,
out tUseqBstr10 oseq
);
void OUseqUDT1
(
in long totalUseq,
in long totalUstr,
in long totalBstr,
out tUseqUDT1 oseq
);
void OUseqUDT2
(
in long totalUseq,
in long totalUstr,
out tUseqUDT2 oseq
);
void OUseqUDT3
(
in long totalUseq,
in long totalBstr,
out tUseqUDT3 oseq
);
void OUseqUDT4
(
in long totalUseq,
in long totalBstr,
out tUseqUDT4 oseq
);
};
};
#pragma repository_id( "m1::tUseqUstr", "7b1ed45fb488.02.c1.50.32.68.00.00.00")
#pragma interface_id( "m1::i1", "7b1ed45fb489.02.c1.50.32.68.00.00.00")
#pragma operation_id( "m1::i1::OUseqUstr", "7b1ed45fb48a.02.c1.50.32.68.00.00.00", 1)
#pragma repository_id( "m1::tBstr10", "7b1fb93f4bb2.02.c1.50.32.68.00.00.00")
#pragma repository_id( "m1::tUseqBstr10", "7b1fb93f4bb3.02.c1.50.32.68.00.00.00")
#pragma operation_id( "m1::i1::OUseqBstr10", "7b1fb93f4bb4.02.c1.50.32.68.00.00.00", 2)
#pragma repository_id( "m1::tUDT1_", "7b21560765c1.02.c1.50.32.68.00.00.00")
#pragma repository_id( "m1::tUDT1", "7b21560765c2.02.c1.50.32.68.00.00.00")
#pragma repository_id( "m1::tUseqUDT1", "7b21560765c3.02.c1.50.32.68.00.00.00")
#pragma operation_id( "m1::i1::OUseqUDT1", "7b21560765c4.02.c1.50.32.68.00.00.00", 3)
#pragma repository_id( "m1::tUDT2_", "7b21a6e42c8b.02.c1.50.32.68.00.00.00")
#pragma repository_id( "m1::tUDT2", "7b21a6e42c8c.02.c1.50.32.68.00.00.00")
#pragma repository_id( "m1::tUseqUDT2", "7b21a6e42c8d.02.c1.50.32.68.00.00.00")
#pragma operation_id( "m1::i1::OUseqUDT2", "7b21a6e42c8e.02.c1.50.32.68.00.00.00", 4)
#pragma repository_id( "m1::tUDT3_", "7b21c3cdd19f.02.c1.50.32.68.00.00.00")
#pragma repository_id( "m1::tUDT3", "7b21c3cdd1a0.02.c1.50.32.68.00.00.00")
#pragma repository_id( "m1::tUseqUDT3", "7b21c3cdd1a1.02.c1.50.32.68.00.00.00")
#pragma operation_id( "m1::i1::OUseqUDT3", "7b21c3cdd1a2.02.c1.50.32.68.00.00.00", 5)
#pragma repository_id( "m1::tUDT4_", "7b2819b9ad65.02.c1.50.32.68.00.00.00")
#pragma repository_id( "m1::tUDT4", "7b2819b9ad66.02.c1.50.32.68.00.00.00")
#pragma repository_id( "m1::tUseqUDT4", "7b2819b9ad67.02.c1.50.32.68.00.00.00")
#pragma operation_id( "m1::i1::OUseqUDT4", "7b2819b9ad68.02.c1.50.32.68.00.00.00", 6)
|
| /*
*
* ROUTINE NAME: i1Impl::i1Impl_OUseqUDT1
*
* FUNCTIONAL DESCRIPTION:
*
* Method routine for OUseqUDT1.
* (Implementation : i1Impl)
*
*/
void i1Impl::i1Impl_OUseqUDT1 (
CORBA::Long totalUseq,
CORBA::Long totalUstr,
CORBA::Long totalBstr,
m1::tUseqUDT1 *& oseq,
CORBA::Environment & ev)
{
/* OBB_PRESERVE_BEGIN(i1Impl::i1Impl_OUseqUDT1) */
cout << endl << "Entering i1Impl::i1Impl_OUseqUDT1" << endl;
cout << " totalUseq=" << totalUseq << endl;
cout << " totalUstr=" << totalUstr << endl;
cout << " totalBstr=" << totalBstr << endl;
// create the buffer of the sequence
m1::tUDT1 *seqBuffer = m1::tUseqUDT1::allocbuf( totalUseq);
// make strings and build them into the sequence buffer
for (short i=0; i<totalUseq; i++)
{
m1::tUDT1 *pUDT = &((seqBuffer)[i]);
m1::tBstr10 Bstr = (m1::tBstr10)malloc(totalBstr+1);
for (short j=0; j<totalBstr; j++)
{
Bstr[j] = 'a';
}
Bstr[totalBstr] = '\0';
pUDT->Bstr10_1 = Bstr;
Bstr = (m1::tBstr10)malloc(totalBstr+1);
for (j=0; j<totalBstr; j++)
{
Bstr[j] = 'b';
}
Bstr[totalBstr] = '\0';
pUDT->Bstr10_2 = Bstr;
Bstr = (m1::tBstr10)malloc(totalBstr+1);
for (j=0; j<totalBstr; j++)
{
Bstr[j] = 'c';
}
Bstr[totalBstr] = '\0';
pUDT->Bstr10_3 = Bstr;
CORBA::Char *Ustr = (CORBA::Char*)malloc(totalUstr+1);
for (j=0; j<totalUstr; j++)
{
Ustr[j] = 'd';
}
Ustr[totalUstr] = '\0';
pUDT->Ustr = Ustr;
}
// construct the sequence
oseq = new m1::tUseqUDT1( totalUseq, totalUseq, seqBuffer, CORBA_TRUE);
// print out the result locally to check its ok
cout << endl;
cout << "maximum=" << oseq->maximum() << endl;
cout << "length =" << oseq->length() << endl;
for (i=0; i<long(oseq->length()); i++)
{
m1::tUDT1 *pUDT = &((*oseq)[i]);
cout <<
"<" << pUDT->Bstr10_1 << "> " <<
"<" << pUDT->Bstr10_2 << "> " <<
"<" << pUDT->Bstr10_3 << "> " <<
"<" << pUDT->Ustr << "> " << i << endl;
};
cout << endl;
cout << "Exiting i1Impl::i1Impl_OUseqUDT1" << endl;
/* OBB_PRESERVE_END(i1Impl::i1Impl_OUseqUDT1) */
return ;
}
|
| void TestUseqUDT1( m1::i1_ptr i1Ptr)
{
CORBA::Environment ev;
m1::tUseqUDT1 *theSeq;
short seqSize;
short uStrSize;
short bStrSize;
cout << endl << "Test: Unbounded sequence of user-defined type 1" << endl;
cout << "Size of unbounded sequence: " << flush;
cin >> seqSize;
cout << "Size of unbounded string: " << flush;
cin >> uStrSize;
cout << "Size of bounded string: " << flush;
cin >> bStrSize;
i1Ptr->OUseqUDT1( seqSize, uStrSize, bStrSize, theSeq, ev);
exitIfException( &ev, "i1Ptr->OUseqUDT1");
cout << endl;
cout << "maximum=" << theSeq->maximum() << endl;
cout << "length =" << theSeq->length() << endl;
for (short i=0; i<long(theSeq->length()); i++)
{
m1::tUDT1 *pUDT = &((*theSeq)[i]);
cout <<
"<" << pUDT->Bstr10_1 << "> " <<
"<" << pUDT->Bstr10_2 << "> " <<
"<" << pUDT->Bstr10_3 << "> " <<
"<" << pUDT->Ustr << "> " << i << endl;
};
cout << endl;
// clean up. Do we need to freebuf first?
delete theSeq;
};
|