summaryrefslogtreecommitdiff
path: root/TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.h
blob: 50d125e819349eebb2e5914a6292d22b5e15a853 (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
// $Id$
#ifndef SERVERAPP_H
#define SERVERAPP_H

#include "TestAppBase.h"
#include "ServantList_T.h"
#include "ClientTask.h"
#include "Foo_B_i.h"
#include "Callback_i.h"
#include "tao/CSD_ThreadPool/CSD_TP_Strategy.h"
#include "ace/SString.h"


class ServerApp : public TestAppBase
{
  public:

    ServerApp();
    virtual ~ServerApp();


  protected:

    virtual int run_i(int argc, ACE_TCHAR* argv[]);


  private:

    // These are all called, in order, by the run_i() method.
    int init(int argc, ACE_TCHAR* argv[]);
    void poa_setup(void);
    void csd_setup(void);
    void servant_setup(void);
    void collocated_setup(void);
    void poa_activate(void);
    void run_collocated_clients(void);
    void run_orb_event_loop(void);
    bool check_validity ();
    void cleanup();


    // Helper methods used by the methods above.
    int parse_args(int argc, ACE_TCHAR* argv[]);

    int set_arg(unsigned&   value,
                 const ACE_TCHAR* arg,
                 char        opt,
                 const char* name,
                 int         min = 0);

    void usage_statement();
    int arg_dependency_checks();


    PortableServer::POA_ptr create_poa(CORBA::ORB_ptr orb,
                                       const char* poa_name);

    typedef ServantList<Foo_B_i> FooServantListType;
    typedef ServantList<Callback_i> CallbackServantListType;

    CORBA::ORB_var               orb_;
    PortableServer::POA_var      poa_;
    TAO::CSD::TP_Strategy_Handle tp_strategy_;

    PortableServer::POA_var      cb_poa_;
    TAO::CSD::TP_Strategy_Handle cb_tp_strategy_;

    FooServantListType foo_servants_;
    CallbackServantListType cb_servants_;

    ClientTask collocated_client_task_;

    ACE_TString exe_name_;

    ACE_TString ior_filename_prefix_;
    unsigned num_servants_;
    unsigned num_csd_threads_;
    unsigned num_orb_threads_;
    unsigned num_remote_clients_;
    unsigned num_collocated_clients_;
    unsigned collocated_client_kind_;
};

#endif