Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / Tagged_Components.h
blob89c4e2ac87d5ba260be7ee90d10271b43ba43f75
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Tagged_Components.h
7 * @author Carlos O'Ryan (coryan@cs.wustl.edu)
8 */
9 //=============================================================================
11 #ifndef TAO_TAGGED_COMPONENTS_H
12 #define TAO_TAGGED_COMPONENTS_H
14 #include /**/ "ace/pre.h"
16 #include "tao/IOPC.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "tao/CONV_FRAMEC.h"
25 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
27 class TAO_Profile;
29 /// Tag for storing multiple endpoints within a single profile.
30 /**
31 * This is TAO-specific, and is mostly used by TAO's RTCORBA support.
32 * The standard TAG_ALTERNATE_IIOP_ADDRESSES tagged component is the
33 * portable alternative.
35 static const CORBA::ULong TAO_TAG_ENDPOINTS = 0x54414f02U;
37 /**
38 * @class TAO_Tagged_Components
40 * @brief The policy manager implementation.
42 * This class is used to manipulate and access the <components>
43 * field of an IIOP profile (and other GIOP profiles).
44 * The definition for that field is simply a sequence of the
45 * following structures:
46 * typedef unsigned long ComponentId;
47 * struct TaggedComponent {
48 * ComponentId tag;
49 * sequence<octet> component_data;
50 * };
51 * the real motivation is to minimize the marshaling and
52 * demarshaling of the <component_data> field for certain critical
53 * components.
55 class TAO_Export TAO_Tagged_Components
57 public:
58 /// Constructor
59 TAO_Tagged_Components ();
61 // = Standard OMG that require fast access.
62 /// The the IOP::TAG_ORB_TYPE component value
63 void set_orb_type (CORBA::ULong orb_type);
65 /// Gets the IOP::TAG_ORB_TYPE component value, return 0 if the
66 /// component is not present.
67 int get_orb_type (CORBA::ULong& orb_type) const;
69 /**
70 * The the IOP::TAG_CODE_SETS component value, the first version
71 * copies the data, the second version steal all the sequence
72 * buffers.
74 void set_code_sets (const CONV_FRAME::CodeSetComponentInfo &);
75 void set_code_sets (CONV_FRAME::CodeSetComponentInfo &);
77 /// Gets a reference of the IOP::TAG_CODE_SETS component value,
78 /// return 0 if the component is not present.
79 int get_code_sets (const CONV_FRAME::CodeSetComponentInfo* &) const;
81 /// Gets a copy of the IOP::TAG_CODE_SETS component value, return 0
82 /// if the component is not present.
83 int get_code_sets (CONV_FRAME::CodeSetComponentInfo &) const;
85 // = Generic components
87 /// Insert the component into the list, making a copy of the octet
88 /// sequence.
89 void set_component (const IOP::TaggedComponent& component);
91 /// Insert the component into the list, but efficiently stealing the
92 /// contents of the octet sequence.
93 void set_component (IOP::TaggedComponent& component);
95 /// Get a copy of the component identified by <component.tag>, return
96 /// 0 if the component is not present.
97 int get_component (IOP::TaggedComponent& component) const;
99 /// Remove a component, if present. Return number of components
100 /// removed.
101 int remove_component (IOP::ComponentId id);
103 // = Marshaling and demarshaling
105 /// Marshal the list.
106 int encode (TAO_OutputCDR& cdr) const;
108 /// Demarshal the list.
109 int decode (TAO_InputCDR& cdr);
112 * Read/Write access to the underlying
113 * MutipleComponentProfile. Added by request from Chris Hafey
114 * <chris@stentorsoft.com>
116 IOP::MultipleComponentProfile &components ();
118 private:
119 /// Helper method to implement set_code_sets()
120 void set_code_sets_i (CONV_FRAME::CodeSetComponent &lhs,
121 CONV_FRAME::CodeSetComponent &rhs);
123 /// Helper methods to implement set_component()
124 void set_known_component_i (const IOP::TaggedComponent& component);
125 void set_component_i (const IOP::TaggedComponent& component);
126 void set_component_i (IOP::TaggedComponent& component);
127 void add_component_i (const IOP::TaggedComponent& component);
128 void add_component_i (IOP::TaggedComponent& component);
129 void set_component_i (IOP::ComponentId tag, TAO_OutputCDR &cdr);
131 /// Helper methods to implement remove_component()
132 int remove_known_component_i (IOP::ComponentId tag);
133 int remove_component_i (IOP::ComponentId tag);
135 /// Helper methods to implement set_component()
136 int get_known_component_i (IOP::TaggedComponent& component) const;
137 int get_component_i (IOP::TaggedComponent& component) const;
139 /// Is @a tag a well-known component?
140 bool known_tag (IOP::ComponentId tag) const;
142 /// Does @a tag show up only once?
143 bool unique_tag (IOP::ComponentId tag) const;
145 private:
146 /// The ORB_TYPE component value
147 CORBA::ULong orb_type_;
149 /// The ORB_TYPE component value
150 CONV_FRAME::CodeSetComponentInfo code_sets_;
152 /// The rest of the components, to be compliant we cannot drop a
153 /// bunch of them.
154 IOP::MultipleComponentProfile components_;
156 /// A flag for each component...
157 CORBA::Octet orb_type_set_;
158 CORBA::Octet code_sets_set_;
161 TAO_END_VERSIONED_NAMESPACE_DECL
163 #if defined (__ACE_INLINE__)
164 # include "tao/Tagged_Components.inl"
165 #endif /* __ACE_INLINE__ */
167 #include /**/ "ace/post.h"
169 #endif /* TAO_TAGGED_COMPONENTS_H */