summaryrefslogtreecommitdiff
path: root/TAO/performance-tests/Demux/CodeGen/codegen.h
blob: 6f684d1267304a7eef78d51d366b9a26e5e7d91b (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#if !defined (TAO_DEMUX_TEST_CODEGEN_H)
#define TAO_DEMUX_TEST_CODEGEN_H

// $Id$
// ============================================================================
//
// = LIBRARY
//    TAO/performance-tests/Demux/CodeGen
//
// = FILENAME
//    codegen.h
//
//    Defines the code generator class for the Demux_Test
//
// = AUTHOR
//
//    Aniruddha Gokhale
//
// ============================================================================


#include <iostream.h>
#include <fstream.h>

#include "ace/Get_Opt.h"
#include "ace/SString.h"
#include "ace/Containers_T.h"
#include "ace/Singleton.h"
#include "ace/OS.h"

class Demux_Test_CodeGenerator
{
public:
  Demux_Test_CodeGenerator (void);
  // ctor

  ~Demux_Test_CodeGenerator (void);
  // dtor

  int init (int argc, char *argv []);
  // initialize

  int run (void);
  // run the various algorithms

private:
  int parse_args (int argc, char *argv []);
  // parse arguments

  int gen_poa_names (void);
  // generate names of POAs

  int gen_object_names (void);
  // generate object names

  int gen_operation_names (void);
  // generate operation names

  int gen_idl_interface (void);
  // generate the IDL interface definition

  int gen_object_create_code (void);
  // generate code that activates the objs and o/ps their IOR

  int gen_servant_hdr_code (void);
  // generate the servant impl header file

  int gen_servant_impl_code (void);
  // generate servant implementation

  int gen_client_incl_code (void);
  // generate the client side include code

  int print_names (void);
  // print generated names

  void usage (void);
  // print the usage

  int gen_names (ACE_Unbounded_Queue<ACE_CString> &, int limit);
  // common fn used by others to generate names in a table of size = limit

  int insert_unique_string (ACE_Unbounded_Queue<ACE_CString> &);
  // insert a unique string at location locn distinct from all strings inserted
  // from locations 0 to locn-1

  long gen_rand (int, int);

  int is_present (ACE_Unbounded_Queue<ACE_CString> &, ACE_CString &);
  // is the given string present in the queue?

  int create_string (int len, ACE_CString &s);
  // create a valid identifier of length len

  char gen_valid_char (int);
  // generate a valid character. The argument indicates what position it will
  // be inserted.

  int print_array (ACE_Unbounded_Queue<ACE_CString> &);
  // print the array

  int num_POAs_;
  // number of POAs

  int num_objs_;
  // number of objects

  int num_ops_;
  // number of operations

  ACE_Unbounded_Queue <ACE_CString> poa_array_;
  // array of POA names

  ACE_Unbounded_Queue <ACE_CString> obj_array_;
  // array of object names

  ACE_Unbounded_Queue <ACE_CString> op_array_;
  // array of operation names

  int oneway_;
  // whether operations must be oneway or not

  int debug_;
  // whether to print debugging info
};


#endif /* TAO_DEMUX_TEST_CODEGEN_H */