summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/Trading_Service/Trading_Service.h
blob: 8caed4cca02d5e8fd8893caa3ccc4354d4ed2f0f (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
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Trading_Service.h
 *
 *  @author Seth Widoff <sbw1@cs.wustl.edu>
 */
//=============================================================================


#ifndef _TRADING_SERVICE_H
#define _TRADING_SERVICE_H

#include "ace/Auto_Ptr.h"
#include "ace/Sig_Handler.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "orbsvcs/IOR_Multicast.h"
#include "orbsvcs/Trader/Trader.h"
#include "orbsvcs/Trader/Service_Type_Repository.h"
#include "orbsvcs/Trader/Trading_Loader.h"

class Trading_Service;

/**
 * @class Trading_Shutdown
 *
 * @brief A class that shutsdown a Trading Service instance.
 */
class Trading_Shutdown : public ACE_Event_Handler
{
public:
  /// Constructor.
  Trading_Shutdown (Trading_Service& trader);

  /// Signal handler.
  virtual int handle_signal (int,
                             siginfo_t *,
                             ucontext_t *);

protected:
  Trading_Service &trader_;
  ACE_Sig_Handler shutdown_;
};

/**
 * @class Trading_Service
 *
 * @brief A class that initializes a Trading Service instance.
 */
class Trading_Service
{
public:

  /// Default constructor.
  Trading_Service (void);

  /// Destructor
  ~Trading_Service (void);

  /// Initialize the Trading Service with arguments.
  int init (int argc,
            ACE_TCHAR *argv[]);

  /// Run the Trading Service.
  int run (void);

  int shutdown (void);

protected:

  /// Pointer to the linked trader.
  auto_ptr<TAO_Trader_Factory::TAO_TRADER> trader_;

  /// Instance of TAO_Trading_Laoder
  TAO_Trading_Loader trading_loader_;
};

#endif /* _TRADING_SERVICE_H */