summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/EC_Config/Config_Factory.h
blob: 95af81c062040f53434344e65d3a4f2814dde524 (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
/* -*- C++ -*- */
// $Id$
//
// ============================================================================
//
// = FILENAME
//   Config_Factory
//
// = AUTHOR
//   Bryan Thrall (thrall@cse.wustl.edu)
//
// ============================================================================

#ifndef CONFIGFACTORY_H
#define CONFIGFACTORY_H

#include "TestConfig.h"
#include "ace/Service_Object.h"

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

namespace ConfigFactory {

/**
 * @class Config_Factory
 *
 * @brief Abstract base factory for Test Configurators.
 *
 * Defines the Config_Factory interface.
 *
 * <H2>Memory Management</H2>
 * The objects it creates are owned by this class, the client must
 * invoke the corresponding destroy() method to release them.
 */
class Config_Factory : ACE_Service_Object
{
public:
  virtual ~Config_Factory (void);

  /// Create and destroy the TestConfig module.
  virtual TestConfig::Test_Config* create_testconfig ()       = 0;
  virtual void destroy_testconfig (TestConfig::Test_Config *) = 0;

};

/** Enumerates the different scheduling strategies certain
 *  Test_Configs generated by Config_Factories can use.
 */
enum Sched_Type {
  RMS,
  MUF,
  EDF,
  RMSMLF,
  MIF
};

/**
 * @class Default_Config_Factory
 *
 * @brief A generic factory for TestConfigs.
 *
 * This class allows the user to experiment with different TestConfig
 * implementations.  Using a command-line like interface the user
 * can specify which strategies will this factory generate.
 * Since the class can be dynamically loaded the strategies can be
 * set in the service configurator file.
 */
class Default_Config_Factory : public Config_Factory
{
public:
  /// Constructor
  Default_Config_Factory (void);

  /// destructor...
  virtual ~Default_Config_Factory (void);

  /// Helper function to register the default factory into the service
  /// configurator.
  static int init_svcs (void);

  // = The Service_Object entry points
  virtual int init (int argc, ACE_TCHAR* argv[]);
  virtual int fini (void);

  virtual TestConfig::Test_Config* create_testconfig ();

  virtual void destroy_testconfig (TestConfig::Test_Config *);
protected:
  int test_config_;
  Sched_Type sched_type_;
};

} /* namespace ConfigFactory */

//ACE_STATIC_SVC_DECLARE (Default_Config_Factory)
//ACE_FACTORY_DECLARE (TestConfig, Default_Config_Factory)

#endif /* CONFIGFACTORY_H */