summaryrefslogtreecommitdiff
path: root/TAO/CIAO/tools/XML_Helpers/RTConfig_Handlers.h
blob: 1cbc4ba8c91828912e5538794c3c3f3f8b9876bf (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
129
130
131
132
133
134
135
// $Id$

//=============================================================================
/**
 *  @file RTConfig_Handlers.h
 *
 *  This file contains XML SAX content handler(s) for parsing CIAO's
 *  RT cad file extension descriptor.
 *
 *  These handlers assume the underlying XML parser is a *validating* parser.
 *
 *  $Id$
 *
 *  @author Nanbor Wang <nanbor@cs.wustl.edu>
 */
//=============================================================================

#ifndef CIAO_RTCONFIG_HANDLERS_H
#define CIAO_RTCONFIG_HANDLERS_H

#include "Cascadable_DocHandler.h"
#include "XML_Utils.h"

namespace CIAO
{

  /**
   * @class Assembly_Handler
   *
   * @brief Assembly_Handler parse the root componentassembly descriptors
   *
   */
  class RTConfig_Handler : public CIAO::XMLHelpers::Cascadable_DocHandler
  {
  public:
    enum CS_States
      {
        START,                  // initial state
        RTRESOURCES,            // parsing an rtresources element
        TPWLANES,               // parsing a threadpoolwithlanes element
        CONNBANDS,              // parsing a connectionbands element
        RTPOLICYSET             // parsing rtpolicyset elements
      };

    /**
     * Default constructor.
     */
    RTConfig_Handler (ACEXML_XMLReader *parser,
                      RTConfiguration::RTORB_Resource_Info &rtr,
                      RTConfiguration::Policy_Sets &ps
                      ACEXML_ENV_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException)) ;

    /**
     * Default destructor.
     */
    virtual ~RTConfig_Handler (void);

    // Methods inherit from ACEXML_ContentHandler.

    /**
     * Receive notification of the end of an element.
     */
    virtual void endElement (const ACEXML_Char *namespaceURI,
                             const ACEXML_Char *localName,
                             const ACEXML_Char *qName ACEXML_ENV_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException)) ;

    /**
     * Receive notification of the beginning of an element.
     */
    virtual void startElement (const ACEXML_Char *namespaceURI,
                               const ACEXML_Char *localName,
                               const ACEXML_Char *qName,
                               ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException)) ;

  protected:
    /// Internal state of the handler.
    CS_States state_;

    /// parse the threadpool attributes
    void parse_threadpool_attrs (ACEXML_Attributes *atts
                                 ACEXML_ENV_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException));

    /// parse the threadpoolwithlanes attributes
    void parse_threadpoollanes_attrs (ACEXML_Attributes *atts
                                      ACEXML_ENV_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException));

    /// parse and add the threadpoollane attributes
    void add_threadpoollane (ACEXML_Attributes *atts
                             ACEXML_ENV_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException));

    /// parse and add the priorityband attributes
    void add_priorityband (ACEXML_Attributes *atts
                           ACEXML_ENV_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException));

    /// parse and create a new policyset from attributes
    void create_new_policyset (ACEXML_Attributes *atts
                               ACEXML_ENV_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException));

    /// parse and set up the priority model configuration information
    void parse_priority_model_config (ACEXML_Attributes *atts,
                                      RTConfiguration::Priority_Model_Config &config
                                      ACEXML_ENV_ARG_DECL)
      ACE_THROW_SPEC ((ACEXML_SAXException));

  private:
    // Current context when filling RTConfiguration::ThreadPoolLanes_Configuration
    RTConfiguration::ThreadPoolLanes_Configuration_var tpl_config_;

    // Current context when filling RTConfiguration::PriorityBands_Configuration
    RTConfiguration::PriorityBands_Configuration_var bands_config_;

    // Current context when filling RTConfiguration::Policy_Set
    RTConfiguration::Policy_Set_var policy_set_;

    // RTORB related info.
    RTConfiguration::RTORB_Resource_Info &rtresources;

    // Sequence of named policy sets.
    RTConfiguration::Policy_Sets &policysets;
  };

}

#if defined (__ACE_INLINE__)
# include "RTConfig_Handlers.inl"
#endif /* __ACE_INLINE__ */
#endif /* CIAO_RTCONFIG_HANDLERS_H */