summaryrefslogtreecommitdiff
path: root/TAO/tests/Demux_Test/CodeGen/client.cpp
blob: 9260285ce37044fbd99b218484026cb950c8a152 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "tao.h"


// Generate the client side include file "client.i". This file has a table of
// function pointers to the the different operations of the
// interface. Depending on the strategy chosen, we make appropriate calls

long GenClientCode(ACE_Unbounded_Queue<ACE_CString> &arr, int limit)
{
  fstream client_incl;
  int i;
  ACE_CString *str;

  client_incl.open("client.i", ios::out);

  for(i=0; i < limit; i++){
    if (arr.get(str, i) == -1)
      {
	return -1;
      }
    client_incl << "void " << str->rep() << "(tao_demux_ptr obj)" << endl;
    client_incl << "{" << endl;
    client_incl << "\tCORBA_Environment env;" << endl << endl;
    client_incl << "\tobj->" << str->rep() << "(env);" << endl;
    client_incl << "}" << endl;
  }
  client_incl << endl;
  client_incl << "static const method_db mtbl[] = {" << endl;
  for (i=0; i < limit; i++){
    if (arr.get(str, i) == -1)
      {
	return -1;
      }
    client_incl << "\t" << str->rep() << "," << endl;
  }
  client_incl << "};" << endl << endl;
  client_incl.close();
}