summaryrefslogtreecommitdiff
path: root/modules/CIAO/DAnCE/Plan_Generator/PCVisitorBase.h
blob: ac34dc4d26160e7bb2949b6d643b8447a933360f (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/* -*- C++ -*- */

//========================================================================
/**
 *  file  PCVisitorBase.h
 *
 *  $Id$
 *
 *  This file contains the virtual base class for the PackageConfiguration
 *  Visitor which is used to traverse the PackageConfiguration element
 *  defined in the PackagingData.idl. The PackageConfiguration has a
 *  number of sequence elements. This class actually implements the
 *  operations which involve sequences and delegates the calls to
 *  the operations which handle single elements from the sequence type.
 *
 *  author Stoyan Paunov <spaunov@isis.vanderbilt.edu>
 */
//========================================================================

#ifndef PC_VISITOR_BASE_H
#define PC_VISITOR_BASE_H

#include /**/ "ace/pre.h"
#include "ciao/DeploymentC.h"

//========================================================================
/**
 *  class PCVisitorBase
 *
 *  This class is a virtual base class for the PackageConfiguration Visitor
 *  The operation which deal with sequences are implemented here by means
 *  of the visit_sequence function above, in order to make the logic of
 *  derived classes easier to write. Writers of derived classes need only
 *  overload the functions which deal with single elements. Sequences are
 *  always handled here.
 */
//========================================================================


class  PCVisitorBase
{
public:
  /// Constructor
  PCVisitorBase (void);

  /// Destructor
  virtual ~PCVisitorBase (void);

  /// Function what dispatches sequences
  template <typename SEQ>
  friend void visit_sequence (SEQ &seq, PCVisitorBase& v);

  /// A whole slew of overloaded routines for different IDL
  /// data types part of the PackageConfiguration.

  virtual
  void Visit (Deployment::PackageConfiguration &pc) = 0;
  void Visit (Deployment::PackageConfigurations &pcs);

  /// ComponentPackageDescription descendents
  virtual
  void Visit (Deployment::ComponentPackageDescription &cpd) = 0;
  void Visit (Deployment::ComponentPackageDescriptions &cpds);

  virtual
  void Visit (Deployment::ComponentInterfaceDescription &cid) = 0;
  //void Visit (Deployment::ComponentInterfaceDescriptions &cids);

  virtual
  void Visit (Deployment::PackagedComponentImplementation &pci) = 0;
  void Visit (Deployment::PackagedComponentImplementations &pcis);

  virtual
  void Visit (Deployment::ComponentImplementationDescription &cid) = 0;
  //void Visit (Deployment::ComponentImplementationDescriptions &cids);

  virtual
  void Visit (Deployment::ComponentAssemblyDescription &cad) = 0;
  void Visit (Deployment::ComponentAssemblyDescriptions &cads);

  virtual
  void Visit (Deployment::SubcomponentInstantiationDescription &sid) = 0;
  void Visit (Deployment::SubcomponentInstantiationDescriptions &sids);

  virtual
  void Visit (Deployment::MonolithicImplementationDescription &mid) = 0;
  void Visit (Deployment::MonolithicImplementationDescriptions &mids);

  virtual
  void Visit (Deployment::NamedImplementationArtifact &nia) = 0;
  void Visit (Deployment::NamedImplementationArtifacts &nias);

  virtual
  void Visit (Deployment::ImplementationArtifactDescription &iad) = 0;
  //void Visit (Deployment::ImplementationArtifactDescriptions &iads);

  //ComponentPackageReference descendents
  virtual
  void Visit (Deployment::ComponentPackageReference &cpr) = 0;
  void Visit (Deployment::ComponentPackageReferences &cprs);

  //properties
  virtual
  void Visit (Deployment::AssemblyPropertyMapping &apm) = 0;
  void Visit (Deployment::AssemblyPropertyMappings &apms);

  virtual
  void Visit (Deployment::Property &property) = 0;
  void Visit (Deployment::Properties &properties);

  //requirements & capabilities
  virtual
  void Visit (Deployment::Requirement &requirement) = 0;
  void Visit (Deployment::Requirements &requirements);

  virtual
  void Visit (Deployment::Capability &capability) = 0;
  void Visit (Deployment::Capabilities &capabilities);

  virtual
  void Visit (Deployment::ImplementationRequirement &ir) = 0;
  void Visit (Deployment::ImplementationRequirements &irs);

  virtual
  void Visit (Deployment::ImplementationDependency &id) = 0;
  void Visit (Deployment::ImplementationDependencies &ids);

  //ports and connections
  virtual
  void Visit (Deployment::AssemblyConnectionDescription &acd) = 0;
  void Visit (Deployment::AssemblyConnectionDescriptions &acds);

  virtual
  void Visit (Deployment::SubcomponentPortEndpoint &spe) = 0;
  void Visit (Deployment::SubcomponentPortEndpoints &spes);

  virtual
  void Visit (Deployment::ComponentExternalPortEndpoint &cepe) = 0;
  void Visit (Deployment::ComponentExternalPortEndpoints &cepes);
};

template <typename T>
void Accept (PCVisitorBase &v, T& element_to_visit)
{
  v.Visit (element_to_visit);
}

/**
 *  function - visit_sequence
 *
 *  This function is used to handle sequences of elements where each
 *  element takes the form of a Visitor Node.
 */
template <typename SEQ>
void visit_sequence (SEQ &seq, PCVisitorBase& v)
{
   CORBA::ULong const size = seq.length ();

   for (CORBA::ULong i = 0; i < size; ++i)
   {
     Accept(v, seq[i]);
   }
}

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

#include /**/ "ace/post.h"

#endif /* PC_VISITOR_BASE_H */